[Merge] lp:~xnox/ubuntu/trusty/ofono/python3 into lp:ubuntu/ofono

Barry Warsaw barry at canonical.com
Wed Feb 26 16:15:33 UTC 2014


--- test/cdma-list-call	2012-08-22 19:59:08 +0000
+++ test/cdma-list-call	2014-02-25 11:56:39 +0000
> @@ -20,6 +20,6 @@
>  
>  	properties = mgr.GetProperties()
>  
> -	for key in properties.keys():
> +	for key in list(properties.keys()):

You shouldn't need to list()-ify this to iterate over it.  Also, if properties
is a dict, you don't even need to get the .keys() since dicts iterate over
their keys by default.  So I suggest:

        for key in properties:

=== modified file 'test/get-network-time' (properties changed: -x to +x)
--- test/get-network-time	2013-10-08 10:47:02 +0000
+++ test/get-network-time	2014-02-25 11:56:39 +0000
> @@ -21,7 +21,7 @@
>  	if t in _dbus2py:
>  		return _dbus2py[t](d)
>  	if t is dbus.Dictionary:
> -		return dict([(dbus2py(k), dbus2py(v)) for k, v in d.items()])
> +		return dict([(dbus2py(k), dbus2py(v)) for k, v in list(d.items())])

Similarly to above, you shouldn't need to list()-ify d.items() to iterate over
them.

>  	if t is dbus.Array and d.signature == "y":
>  		return "".join([chr(b) for b in d])
>  	if t is dbus.Array or t is list:
> @@ -37,7 +37,7 @@
>  	if t in (dict, tuple, list) and len(d) > 0:
>  		if t is dict:
>  			d = ", ".join(["%s = %s" % (k, pretty(v))
> -					for k, v in d.items()])
> +					for k, v in list(d.items())])

Nor here either.

=== modified file 'test/get-operators'
--- test/get-operators	2010-11-30 20:01:20 +0000
+++ test/get-operators	2014-02-25 11:56:39 +0000
> @@ -22,16 +22,16 @@
>  	path = entry[0]
>  	properties = entry[1]
>  
> -	print "[ %s ]" % (path)
> +	print("[ %s ]" % (path))
>  
> -	for key in properties.keys():
> +	for key in list(properties.keys()):

As above, I suggest:

        for key in properties:

=== modified file 'test/list-calls'
--- test/list-calls	2013-01-28 16:25:32 +0000
+++ test/list-calls	2014-02-25 11:56:39 +0000
> @@ -21,11 +21,11 @@
>  	calls = mgr.GetCalls()
>  
>  	for path, properties in calls:
> -		print "    [ %s ]" % (path)
> +		print("    [ %s ]" % (path))
>  
> -		for key in properties.keys():
> +		for key in list(properties.keys()):

I'll stop being a broken record now. :) There are more instances like this in
the diff.

-- 
https://code.launchpad.net/~xnox/ubuntu/trusty/ofono/python3/+merge/208117
Your team Ubuntu branches is requested to review the proposed merge of lp:~xnox/ubuntu/trusty/ofono/python3 into lp:ubuntu/ofono.



More information about the Ubuntu-reviews mailing list