On 02/13/2012 07:18 AM, [email protected] wrote:
> From: Alex Jia<[email protected]>
>
> To improve code style, and comma, operator are followed by a space.

Applied, with a little correction on the commit message:

https://github.com/autotest/autotest/commit/cb7fbac8dab6840994b4b4f8b736f4a1a23c0d9c

Thanks!

> Signed-off-by: Alex Jia<[email protected]>
> ---
>   cli/acl.py                           |    4 ++--
>   cli/host_unittest.py                 |    4 ++--
>   cli/topic_common_unittest.py         |   28 ++++++++++++++--------------
>   cli/user_unittest.py                 |    4 ++--
>   client/bin/autotest_local.py         |    2 +-
>   client/bin/base_utils.py             |    2 +-
>   client/bin/cpuset.py                 |    4 ++--
>   client/bin/fsdev_disks.py            |   10 +++++-----
>   client/bin/kernel.py                 |    2 +-
>   client/bin/kernel_config.py          |    2 +-
>   client/bin/kernel_versions.py        |    2 +-
>   client/bin/net/net_utils.py          |    4 ++--
>   client/bin/net/net_utils_unittest.py |   16 ++++++++--------
>   client/bin/test_config.py            |    6 +++---
>   client/virt/libvirt_vm.py            |    2 +-
>   15 files changed, 46 insertions(+), 46 deletions(-)
>
> diff --git a/cli/acl.py b/cli/acl.py
> index 0b20acf..c101666 100644
> --- a/cli/acl.py
> +++ b/cli/acl.py
> @@ -128,9 +128,9 @@ class acl_list(action_common.atest_list, acl):
>       def output(self, results):
>           # If an ACL was specified, always print its details
>           if self.acls or self.verbose:
> -            sublist_keys=('hosts', 'users')
> +            sublist_keys = ('hosts', 'users')
>           else:
> -            sublist_keys=()
> +            sublist_keys = ()
>
>           super(acl_list, self).output(results,
>                                        keys=('name', 'description'),
> diff --git a/cli/host_unittest.py b/cli/host_unittest.py
> index 6ead561..3745cc5 100755
> --- a/cli/host_unittest.py
> +++ b/cli/host_unittest.py
> @@ -63,7 +63,7 @@ class host_list_unittest(cli_mock.cli_unittest):
>           mfile = cli_mock.create_file('host0\nhost3\nhost4\n')
>           sys.argv = ['atest', 'host1', '--mlist', mfile.name, 'host3']
>           (options, leftover) = hl.parse()
> -        self.assertEqualNoOrder(['host0', 'host1','host3', 'host4'],
> +        self.assertEqualNoOrder(['host0', 'host1', 'host3', 'host4'],
>                                   hl.hosts)
>           self.assertEqual(leftover, [])
>           mfile.clean()
> @@ -107,7 +107,7 @@ class host_list_unittest(cli_mock.cli_unittest):
>           sys.argv = ['atest', 'host1', '--mlist', mfile.name, 'host3',
>                       '--label', 'label0']
>           (options, leftover) = hl.parse()
> -        self.assertEqualNoOrder(['host0', 'host1','host3', 'host4'],
> +        self.assertEqualNoOrder(['host0', 'host1', 'host3', 'host4'],
>                                   hl.hosts)
>           self.assertEqual(['label0'], hl.labels)
>           self.assertEqual(leftover, [])
> diff --git a/cli/topic_common_unittest.py b/cli/topic_common_unittest.py
> index a3c340f..63fee87 100755
> --- a/cli/topic_common_unittest.py
> +++ b/cli/topic_common_unittest.py
> @@ -221,12 +221,12 @@ class item_parse_info_unittest(cli_mock.cli_unittest):
>
>
>       def test_file_list_add_on_space(self):
> -        self.__test_parsing_leftover_good(['a','c','b'],
> +        self.__test_parsing_leftover_good(['a', 'c', 'b'],
>                                             ['a', 'b', 'c'])
>
>
>       def test_file_list_add_on_mix_space_comma(self):
> -        self.__test_parsing_leftover_good(['a', 'c','b,d'],
> +        self.__test_parsing_leftover_good(['a', 'c', 'b,d'],
>                                             ['a', 'b', 'c', 'd'])
>
>
> @@ -778,18 +778,18 @@ class atest_unittest(cli_mock.cli_unittest):
>       #
>       def __test_print_fields(self, func, expected, **dargs):
>           if not dargs.has_key('items'):
> -            dargs['items']=[{'hostname': 'h0',
> -                            'platform': 'p0',
> -                            'labels': [u'l0', u'l1'],
> -                            'locked': 1,
> -                            'id': 'id0',
> -                            'name': 'name0'},
> -                           {'hostname': 'h1',
> -                            'platform': 'p1',
> -                            'labels': [u'l2', u'l3'],
> -                            'locked': 0,
> -                            'id': 'id1',
> -                            'name': 'name1'}]
> +            dargs['items'] = [{'hostname': 'h0',
> +                             'platform': 'p0',
> +                             'labels': [u'l0', u'l1'],
> +                             'locked': 1,
> +                             'id': 'id0',
> +                             'name': 'name0'},
> +                              {'hostname': 'h1',
> +                             'platform': 'p1',
> +                             'labels': [u'l2', u'l3'],
> +                             'locked': 0,
> +                             'id': 'id1',
> +                             'name': 'name1'}]
>           self.god.mock_io()
>           func(**dargs)
>           (output, err) = self.god.unmock_io()
> diff --git a/cli/user_unittest.py b/cli/user_unittest.py
> index 5e12c6c..8c32969 100755
> --- a/cli/user_unittest.py
> +++ b/cli/user_unittest.py
> @@ -27,7 +27,7 @@ class user_list_unittest(cli_mock.cli_unittest):
>           ufile = cli_mock.create_file('user0\nuser3\nuser4\n')
>           sys.argv = ['atest', 'user1', '--ulist', ufile.name, 'user3']
>           (options, leftover) = ul.parse()
> -        self.assertEqualNoOrder(['user0', 'user1','user3', 'user4'],
> +        self.assertEqualNoOrder(['user0', 'user1', 'user3', 'user4'],
>                                   ul.users)
>           self.assertEqual(leftover, [])
>           ufile.clean()
> @@ -55,7 +55,7 @@ class user_list_unittest(cli_mock.cli_unittest):
>           sys.argv = ['atest', 'user1', '--ulist', ufile.name, 'user3',
>                       '-l', '4', '-a', 'acl0']
>           (options, leftover) = ul.parse()
> -        self.assertEqualNoOrder(['user0', 'user1','user3', 'user4'],
> +        self.assertEqualNoOrder(['user0', 'user1', 'user3', 'user4'],
>                                   ul.users)
>           self.assertEqual('acl0', ul.acl)
>           self.assertEqual('4', ul.access_level)
> diff --git a/client/bin/autotest_local.py b/client/bin/autotest_local.py
> index 485deda..fbf5f6e 100644
> --- a/client/bin/autotest_local.py
> +++ b/client/bin/autotest_local.py
> @@ -25,7 +25,7 @@ os.environ['PYTHONPATH'] = autodirbin
>   cmd_parser = cmdparser.CommandParser() # Allow access to instance in parser
>
>   commandinfo = "[command] (optional)\tOne of: " + str(cmd_parser.cmdlist)
> -if sys.version_info[0:2]<  (2,6):
> +if sys.version_info[0:2]<  (2, 6):
>       parser = OptionParser(usage='Usage: %prog [options] 
> [command]<control-file>',
>                             description=commandinfo)
>   else:
> diff --git a/client/bin/base_utils.py b/client/bin/base_utils.py
> index 39c7475..6c3b5f8 100644
> --- a/client/bin/base_utils.py
> +++ b/client/bin/base_utils.py
> @@ -433,7 +433,7 @@ def dump_object(object):
>       for item in object.__dict__.iteritems():
>           print item
>           try:
> -            (key,value) = item
> +            (key, value) = item
>               dump_object(value)
>           except Exception:
>               continue
> diff --git a/client/bin/cpuset.py b/client/bin/cpuset.py
> index 68fe50a..ffddb40 100644
> --- a/client/bin/cpuset.py
> +++ b/client/bin/cpuset.py
> @@ -408,8 +408,8 @@ def set_io_controls(container_name, disks=[], 
> ioprio_classes=[PROPIO_NORMAL],
>           return  # kernel predates propio features
>               # or io cgroup is mounted separately from cpusets
>       disk_infos = []
> -    for disk,ioclass,limit,share in zip(disks, ioprio_classes,
> -                                        io_limits, io_shares):
> +    for disk, ioclass, limit, share in zip(disks, ioprio_classes,
> +                                           io_limits, io_shares):
>           parts = (disk, str(ioclass), str(limit), str(share))
>           disk_info = ' '.join(parts)
>           utils.write_one_line(service_level, disk_info)
> diff --git a/client/bin/fsdev_disks.py b/client/bin/fsdev_disks.py
> index 6e0ede7..efbb56b 100644
> --- a/client/bin/fsdev_disks.py
> +++ b/client/bin/fsdev_disks.py
> @@ -384,15 +384,15 @@ def prepare_fsdev(job):
>       # Avoid preparing the same thing more than once
>       FSDEV_PREP_CNT += 1
>       if FSDEV_PREP_CNT>  1:
> -        return (FSDEV_DISKLIST[0]['mountpt'],FSDEV_DISKLIST)
> +        return (FSDEV_DISKLIST[0]['mountpt'], FSDEV_DISKLIST)
>
>       FSDEV_JOB = job
>
> -    (path,toss,disks) = prepare_disks(job, fs_desc    = FSDEV_FS_DESC,
> -                                           disk1_only = FSDEV_DISK1_ONLY,
> -                                           disk_list  = None)
> +    (path, toss, disks) = prepare_disks(job, fs_desc    = FSDEV_FS_DESC,
> +                                             disk1_only = FSDEV_DISK1_ONLY,
> +                                             disk_list  = None)
>       FSDEV_DISKLIST = disks
> -    return (path,disks)
> +    return (path, disks)
>
>
>   def finish_fsdev(force_cleanup=False):
> diff --git a/client/bin/kernel.py b/client/bin/kernel.py
> index 8bfb58f..f66c336 100644
> --- a/client/bin/kernel.py
> +++ b/client/bin/kernel.py
> @@ -875,4 +875,4 @@ def auto_kernel(job, path, subdir, tmp_dir, build_dir, 
> leave=False):
>       else:
>           if len(kernel_paths)>  1:
>               raise error.TestError("don't know what to do with more than one 
> non-rpm kernel file")
> -        return kernel(job,kernel_paths[0], subdir, tmp_dir, build_dir, leave)
> +        return kernel(job, kernel_paths[0], subdir, tmp_dir, build_dir, 
> leave)
> diff --git a/client/bin/kernel_config.py b/client/bin/kernel_config.py
> index 4b6473b..104c141 100644
> --- a/client/bin/kernel_config.py
> +++ b/client/bin/kernel_config.py
> @@ -136,5 +136,5 @@ class kernel_config(object):
>           to = self.config_dir + '/config.%s' % name
>           while os.path.exists(to):
>               i += 1
> -            to = self.config_dir + '/config.%s.%d' % (name,i)
> +            to = self.config_dir + '/config.%s.%d' % (name, i)
>           shutil.copyfile(self.build_dir + '/.config', to)
> diff --git a/client/bin/kernel_versions.py b/client/bin/kernel_versions.py
> index 1b796c1..df38de2 100644
> --- a/client/bin/kernel_versions.py
> +++ b/client/bin/kernel_versions.py
> @@ -3,7 +3,7 @@
>   #
>   __author__ = """Copyright Andy Whitcroft 2007"""
>
> -import sys,re
> +import sys, re
>
>   #
>   # Sort key for ordering versions chronologically.  The key ordering
> diff --git a/client/bin/net/net_utils.py b/client/bin/net/net_utils.py
> index 681b5cf..7c7960c 100644
> --- a/client/bin/net/net_utils.py
> +++ b/client/bin/net/net_utils.py
> @@ -38,7 +38,7 @@ class network_utils(object):
>           """
>           ip = client_utils.system_output("ip addr show to %s/%s" %
>                                           (query_ip, netmask))
> -        ip = re.search(r"inet ([0-9.]*)/",ip)
> +        ip = re.search(r"inet ([0-9.]*)/", ip)
>           if ip is None:
>               return ip
>           return ip.group(1)
> @@ -695,7 +695,7 @@ class ethernet(object):
>           Returns:
>            A text string.
>           """
> -        return "%02x:%02x:%02x:%02x:%02x:%02x" % tuple(map(ord,hwaddr))
> +        return "%02x:%02x:%02x:%02x:%02x:%02x" % tuple(map(ord, hwaddr))
>
>
>       @staticmethod
> diff --git a/client/bin/net/net_utils_unittest.py 
> b/client/bin/net/net_utils_unittest.py
> index f3ebace..6cb2643 100755
> --- a/client/bin/net/net_utils_unittest.py
> +++ b/client/bin/net/net_utils_unittest.py
> @@ -25,7 +25,7 @@ class TestNetUtils(unittest.TestCase):
>           self.god.stub_function(net_utils, "open")
>           self.god.stub_function(time, 'sleep')
>
> -        self.god.stub_with(net_utils,"bond", net_utils.bonding)
> +        self.god.stub_with(net_utils, "bond", net_utils.bonding)
>           self.god.stub_with(os, 'open', net_utils_mock.os_open)
>           self.god.stub_with(net_utils, 'netif', 
> net_utils_mock.netutils_netif)
>
> @@ -253,7 +253,7 @@ class TestNetUtils(unittest.TestCase):
>           self.god.stub_function(os, 'listdir')
>           stat_path = '/sys/class/net/%s/statistics/' % mock_netif._name
>
> -        os.listdir.expect_call(stat_path).and_return(('stat1','stat2', 
> 'stat4'))
> +        os.listdir.expect_call(stat_path).and_return(('stat1', 'stat2', 
> 'stat4'))
>           f = self.god.create_mock_class(file, 'file')
>           net_utils.open.expect_call(stat_path + 'stat1', 'r').and_return(f)
>           f.read.expect_call().and_return(1234)
> @@ -349,7 +349,7 @@ class TestNetUtils(unittest.TestCase):
>           except ValueError:
>               pass
>           else:
> -            self.assertEquals(0,1)
> +            self.assertEquals(0, 1)
>           self.god.check_playback()
>
>
> @@ -575,7 +575,7 @@ class TestNetUtils(unittest.TestCase):
>           except error.TestError:
>               pass
>           else:
> -            self.assertEquals(0,1)
> +            self.assertEquals(0, 1)
>           self.god.check_playback()
>
>           # catch exception on bond enabled
> @@ -585,7 +585,7 @@ class TestNetUtils(unittest.TestCase):
>           except error.TestError:
>               pass
>           else:
> -            self.assertEquals(0,1)
> +            self.assertEquals(0, 1)
>           self.god.check_playback()
>
>           # check that setting tg3 and bnx2x driver have a sleep call
> @@ -644,7 +644,7 @@ class TestNetUtils(unittest.TestCase):
>           except error.TestError:
>               pass
>           else:
> -            self.assertEquals(0,1)
> +            self.assertEquals(0, 1)
>           self.god.check_playback()
>
>
> @@ -657,7 +657,7 @@ class TestNetUtils(unittest.TestCase):
>           except error.TestError:
>               pass
>           else:
> -            self.assertEquals(0,1)
> +            self.assertEquals(0, 1)
>           self.god.check_playback()
>
>           self.god.stub_function(net_utils.bonding, 'is_enabled')
> @@ -996,7 +996,7 @@ class TestNetUtils(unittest.TestCase):
>           protocol = 2030
>           payload = 'some payload'
>           frame = struct.pack("!6s6sH", dst, src, protocol) + payload
> -        self.assertEquals(net_utils.ethernet.pack(dst, src,protocol, 
> payload),
> +        self.assertEquals(net_utils.ethernet.pack(dst, src, protocol, 
> payload),
>                             frame)
>
>
> diff --git a/client/bin/test_config.py b/client/bin/test_config.py
> index 620191f..d7d5fbc 100644
> --- a/client/bin/test_config.py
> +++ b/client/bin/test_config.py
> @@ -116,7 +116,7 @@ class config_loader:
>           Check if the config file has valid values
>           """
>           if not self.parser.has_section(section):
> -            return False, "Section not found: %s"%(section)
> +            return False, "Section not found: %s" %(section)
>
>           options = self.parser.items(section)
>           for i in range(options.__len__()):
> @@ -124,10 +124,10 @@ class config_loader:
>               aux = string.split(param, '.')
>
>               if aux.__len__<  2:
> -                return False, "Invalid parameter syntax at %s"%(param)
> +                return False, "Invalid parameter syntax at %s" %(param)
>
>               if not self.check_parameter(aux[0], options[i][1]):
> -                return False, "Invalid value at %s"%(param)
> +                return False, "Invalid value at %s" %(param)
>
>           return True, None
>
> diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
> index a84590e..53441b5 100644
> --- a/client/virt/libvirt_vm.py
> +++ b/client/virt/libvirt_vm.py
> @@ -176,7 +176,7 @@ def virsh_save(name, path, uri = ""):
>       if state not in ('paused',):
>           raise virt_vm.VMStatusError("Cannot save a VM that is %s" % state)
>       logging.debug("Saving VM %s to %s" %(name, path))
> -    virsh_cmd("save %s %s" % (name,path), uri)
> +    virsh_cmd("save %s %s" % (name, path), uri)
>       # libvirt always stops VM after saving
>       state = virsh_domstate(name, uri)
>       if state not in ('shut off',):

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to