[PATCH 1/9] Make the iter*() dictionary methods Python 3 compatible (#1014220)

Anne Mulhern amulhern at redhat.com
Wed Jan 28 23:43:34 UTC 2015





----- Original Message -----
> From: "Martin Kolman" <mkolman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Wednesday, January 28, 2015 12:43:15 PM
> Subject: [PATCH 1/9] Make the iter*() dictionary methods Python 3 compatible	(#1014220)
> 
> Python 3 deprecates the iteritems(),
> iterkeys() and itervalues()) methods and instead makes
> the items(), keys() and values() methods returns an iterator.
> 
> This makes the affected dictionaries Python 3 compatible,
> while still preserving Python 2 compatibility at a cost
> of slight memory usage increase and/or slight slowdown.
> 
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>  pyanaconda/addons.py                       | 6 +++---
>  pyanaconda/anaconda.py                     | 2 +-
>  pyanaconda/anaconda_argparse.py            | 4 ++--
>  pyanaconda/kickstart.py                    | 2 +-
>  pyanaconda/localization.py                 | 2 +-
>  pyanaconda/packaging/dnfpayload.py         | 4 ++--
>  pyanaconda/threads.py                      | 2 +-
>  pyanaconda/ui/__init__.py                  | 4 ++--
>  pyanaconda/ui/gui/hubs/__init__.py         | 2 +-
>  pyanaconda/ui/gui/spokes/custom.py         | 6 +++---
>  pyanaconda/ui/gui/spokes/datetime_spoke.py | 2 +-
>  pyanaconda/ui/gui/spokes/lib/resize.py     | 2 +-
>  pyanaconda/ui/gui/spokes/source.py         | 2 +-
>  pyanaconda/ui/gui/spokes/storage.py        | 4 ++--
>  pyanaconda/ui/gui/xkl_wrapper.py           | 4 ++--
>  pyanaconda/ui/tui/hubs/__init__.py         | 4 ++--
>  pyanaconda/ui/tui/spokes/time_spoke.py     | 3 +--
>  scripts/makeupdates                        | 2 +-
>  tests/pyanaconda_tests/ks_version_test.py  | 4 ++--
>  tests/pyanaconda_tests/timezone_test.py    | 4 ++--
>  20 files changed, 32 insertions(+), 33 deletions(-)
> 
> diff --git a/pyanaconda/addons.py b/pyanaconda/addons.py
> index 5083167..e01eb4a 100644
> --- a/pyanaconda/addons.py
> +++ b/pyanaconda/addons.py
> @@ -75,17 +75,17 @@ class AddonRegistry(object):
>  
>      def __str__(self):
>          return functools.reduce(lambda acc, (id, addon): acc + str(addon),
> -                                self.__dict__.iteritems(), "")
> +                                iter(self.__dict__.items()), "")

It seems like iter() call here ought to be unnecessary.

<-- SNIP -->

other than that, ack.

- mulhern


More information about the anaconda-patches mailing list