[csw-devel] SF.net SVN: gar:[18140] csw/mgar/gar/v2-solaris11/lib/python/system_pkgmap. py

Maciej (Matchek) Bliziński maciej at opencsw.org
Wed May 30 21:01:26 CEST 2012


2012/5/27 <chninkel at users.sourceforge.net>

> Revision: 18140
>          http://gar.svn.sourceforge.net/gar/?rev=18140&view=rev
> Author:   chninkel
> Date:     2012-05-27 21:50:40 +0000 (Sun, 27 May 2012)
> Log Message:
> -----------
> no, None is not iterable...
>
> Modified Paths:
> --------------
>    csw/mgar/gar/v2-solaris11/lib/python/system_pkgmap.py
>
> Modified: csw/mgar/gar/v2-solaris11/lib/python/system_pkgmap.py
> ===================================================================
> --- csw/mgar/gar/v2-solaris11/lib/python/system_pkgmap.py       2012-05-27
> 21:47:40 UTC (rev 18139)
> +++ csw/mgar/gar/v2-solaris11/lib/python/system_pkgmap.py       2012-05-27
> 21:50:40 UTC (rev 18140)
> @@ -268,6 +268,8 @@
>     streams_and_parsers = zip(streams, (self._ParsePkgmapLine,
> self._ParsePkgContentsLine))
>     for stream_info in streams_and_parsers:
>       parseMethod = stream_info[1]
> +      if stream_info[0] == None:
> +        continue
>

The better Python idiom is:

if foo is None:
  ...

but in this case, it's enough to test for the boolean value:

if not stream_info[0]:
  continue


>       for line in stream_info[0]:
>         if show_progress:
>           if not c.next() % 1000:
> @@ -377,9 +379,10 @@
>     for line in streams[0]:
>       pkgname, pkg_desc = self._ParsePkginfoLine(line)
>       packages_by_pkgname.setdefault(pkgname, pkg_desc)
> -    for line in streams[1]:
> -      pkgname, pkg_desc = self._ParsePkgListLine(line)
> -      packages_by_pkgname.setdefault(pkgname, pkg_desc)
> +    if streams[1] != None:
>

Same deal:

if streams[1]:
  for line in streams[1]:
    (...)


> +      for line in streams[1]:
> +        pkgname, pkg_desc = self._ParsePkgListLine(line)
> +        packages_by_pkgname.setdefault(pkgname, pkg_desc)
>     logging.debug("<- _ParsePkginfoOutput()")
>     return packages_by_pkgname
>
>
> This was sent by the SourceForge.net collaborative development platform,
> the world's largest Open Source development site.
>
> _______________________________________________
> devel mailing list
> devel at lists.opencsw.org
> https://lists.opencsw.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencsw.org/pipermail/devel/attachments/20120530/39d4c047/attachment.html>


More information about the devel mailing list