[ovs-git] Open vSwitch: python: Use enumerate() builtin function to simplify counted iteration. (master)

dev at openvswitch.org dev at openvswitch.org
Wed Aug 24 19:16:09 UTC 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  367da738332b88425ca3e8599aa349f567f69b91 (commit)
       via  8ba31bf16d03c449fbf40ec00d9a816b4ec05018 (commit)
       via  63b1a5213331cd962be05df57f1375db902216c5 (commit)
       via  1f9dd59cf178b0765727f6908e135f48c766e213 (commit)
       via  90d9dcfc12cbfa7ac103ea6d0e38797c10598d57 (commit)
       via  0a61b042a59ce62a91db68645c9f6023cb04bccf (commit)
       via  2ad4ef89208cf683859b1a269f3c5328a998c47d (commit)
       via  22bb61e9ee9576e77495c0c5c71fa2d243a98fb6 (commit)
       via  17af14360014d8dd05cdc7814cb755a1b6b5d4ef (commit)
       via  e0b2332760c97b8dbe6fdd89e18634a7e8f8050e (commit)
       via  32fcdd44c5e43e41c285220da5db49fd9870d225 (commit)
       via  1304578aeb3c57b43fc6634635f880f005a4dec0 (commit)
       via  71607f575e8eac278b61774faa81fc47b7f8c00b (commit)
       via  ca2c5d3d32270210986c76158c0b321aa75e735a (commit)
       via  f09aa106ee66e387d68c339cdcd7426a01c4bf8d (commit)
       via  1a98f75260289f72d430abef026c6da2b1d5a255 (commit)
       via  693e5dc7484b15c159cb9f644d28dc759db01b7c (commit)
       via  c29e06be0e224f1c2392e892016bd6b80749611d (commit)
       via  bf6ec045b7dacb243347a5b84d4c3cff466d6528 (commit)
       via  7d48f8f8bd90922bebbbd46106d8343b2eb1571e (commit)
       via  4c0f62718ff9f83613c7f87805ee40495f642583 (commit)
       via  6a6f8d167357a1f1751cdd54b9491c531a371ae1 (commit)
       via  0233401f12fe5ef8f9d63d660d2bd3f739766025 (commit)
       via  a7675d4e56d5108c554de25e7772c2eb60470abc (commit)
       via  91c637960c57f4b415213ea46c22fefcb2534825 (commit)
       via  8758e8a373338e409d7f2863ee91e01060f35628 (commit)
       via  d272c10ecdba8a5dc7adba30c98d8d4273dfd1ae (commit)
       via  f2d8ad13e1819a6553b30ba33a28abf7603f5b9b (commit)
       via  b33a04c63adc29096fe50c08c7b8781398f885c7 (commit)
       via  523a3bc7733b13cbfb4b702739cd26d0c29b05f7 (commit)
       via  57d6a4c71bd0b4ed477ec273d4d4f84c5e4ed465 (commit)
       via  9601fa824d2c3968fda75204488e347d66d62d1f (commit)
      from  92f8ebf943aab10ad5923516a3d2803a555eed44 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 367da738332b88425ca3e8599aa349f567f69b91
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=367da738332b88425ca3e8599aa349f567f69b91
Author: Ben Pfaff <blp at nicira.com>
		
python: Use enumerate() builtin function to simplify counted iteration.
		
Suggested-by: Reid Price <reid at nicira.com>


commit 8ba31bf16d03c449fbf40ec00d9a816b4ec05018
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=8ba31bf16d03c449fbf40ec00d9a816b4ec05018
Author: Ben Pfaff <blp at nicira.com>
		
ovs.stream: Simplify logic in Stream.wait().
		
Suggested-by: Reid Price <reid at nicira.com>


commit 63b1a5213331cd962be05df57f1375db902216c5
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=63b1a5213331cd962be05df57f1375db902216c5
Author: Ben Pfaff <blp at nicira.com>
		
ovs.stream: Drop Stream.get_name() since clients can use 'name' directly.
		
Suggested-by: Reid Price <reid at nicira.com>


commit 1f9dd59cf178b0765727f6908e135f48c766e213
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1f9dd59cf178b0765727f6908e135f48c766e213
Author: Ben Pfaff <blp at nicira.com>
		
ovs.stream: Use %d in place of %ld since the two are equivalent in Python.
		
Reported-by: Reid Price <reid at nicira.com>


commit 90d9dcfc12cbfa7ac103ea6d0e38797c10598d57
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=90d9dcfc12cbfa7ac103ea6d0e38797c10598d57
Author: Ben Pfaff <blp at nicira.com>
		
ovs.reconnect: Fix typo in documentation.
		
Reported-by: Reid Price <reid at nicira.com>


commit 0a61b042a59ce62a91db68645c9f6023cb04bccf
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=0a61b042a59ce62a91db68645c9f6023cb04bccf
Author: Ben Pfaff <blp at nicira.com>
		
ovs.reconnect: Make Reconnect.Reconnect inherit from object.
		
Reported-by: Reid Price <reid at nicira.com>


commit 2ad4ef89208cf683859b1a269f3c5328a998c47d
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=2ad4ef89208cf683859b1a269f3c5328a998c47d
Author: Ben Pfaff <blp at nicira.com>
		
ovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings.
		
Suggested-by: Reid Price <reid at nicira.com>


commit 22bb61e9ee9576e77495c0c5c71fa2d243a98fb6
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=22bb61e9ee9576e77495c0c5c71fa2d243a98fb6
Author: Ben Pfaff <blp at nicira.com>
		
ovs.jsonrpc: Remove Connection.get_name()--clients can use 'name' directly.
		
Suggested-by: Reid Price <reid at nicira.com>


commit 17af14360014d8dd05cdc7814cb755a1b6b5d4ef
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=17af14360014d8dd05cdc7814cb755a1b6b5d4ef
Author: Ben Pfaff <blp at nicira.com>
		
ovs.jsonrpc: Remove dead class variable Message.__next_id.
		
Reported-by: Reid Price <reid at nicira.com>


commit e0b2332760c97b8dbe6fdd89e18634a7e8f8050e
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=e0b2332760c97b8dbe6fdd89e18634a7e8f8050e
Author: Ben Pfaff <blp at nicira.com>
		
ovs.json: Optimize __dump_string().
		
Suggested-by: Reid Price <reid at nicira.com>


commit 32fcdd44c5e43e41c285220da5db49fd9870d225
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=32fcdd44c5e43e41c285220da5db49fd9870d225
Author: Ben Pfaff <blp at nicira.com>
		
ovs.fatal_signal: Remove unnecessary "global" statement.
		
Suggested-by: Reid Price <reid at nicira.com>


commit 1304578aeb3c57b43fc6634635f880f005a4dec0
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1304578aeb3c57b43fc6634635f880f005a4dec0
Author: Ben Pfaff <blp at nicira.com>
		
ovs.fatal_signal: Reorder definitions to be more easily readable.
		
Suggested-by: Reid Price <reid at nicira.com>


commit 71607f575e8eac278b61774faa81fc47b7f8c00b
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=71607f575e8eac278b61774faa81fc47b7f8c00b
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.types: Introduce DEFAULT_MIN, DEFAULT_MAX as Type class members.
		
Suggested-by: Reid Price <reid at nicira.com>


commit ca2c5d3d32270210986c76158c0b321aa75e735a
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=ca2c5d3d32270210986c76158c0b321aa75e735a
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.types: Use toAtomicType() instead of open-coding it.
		
Suggested-by: Reid Price <reid at nicira.com>


commit f09aa106ee66e387d68c339cdcd7426a01c4bf8d
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=f09aa106ee66e387d68c339cdcd7426a01c4bf8d
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.types: Simplify code to avoid try/except case.
		
Also fixes a typo that caused one version of the error message to have a
hyphen and the other to have a space.

Suggested-by: Reid Price <reid at nicira.com>


commit 1a98f75260289f72d430abef026c6da2b1d5a255
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1a98f75260289f72d430abef026c6da2b1d5a255
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.types: Use .append instead of += for adding to lists.
		
Python does not do a good job of appending lists to lists.

Suggested-by: Reid Price <reid at nicira.com>


commit 693e5dc7484b15c159cb9f644d28dc759db01b7c
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=693e5dc7484b15c159cb9f644d28dc759db01b7c
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.schema: Factor common checks for identifiers into new function.
		
Suggested-by: Reid Price <reid at nicira.com>


commit c29e06be0e224f1c2392e892016bd6b80749611d
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=c29e06be0e224f1c2392e892016bd6b80749611d
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.parser: Simplify code.
		
Suggested-by: Reid Price <reid at nicira.com>


commit bf6ec045b7dacb243347a5b84d4c3cff466d6528
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=bf6ec045b7dacb243347a5b84d4c3cff466d6528
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.idl: Use top-level class to represent IDL rows.
		
According to Reid, there may be some disadvantages to having this class be
anonymous, for example, cannot do instance/typechecking, might be
allocating a new class for every row as well, which isn't the most memory
efficient.

Suggested-by: Reid Price <reid at nicira.com>


commit 7d48f8f8bd90922bebbbd46106d8343b2eb1571e
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=7d48f8f8bd90922bebbbd46106d8343b2eb1571e
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.idl: Actually use Idl.__modify_row()'s return value.
		
Idl.__parse_row_update() assumed that every change that the database server
sent down actually modified the database.  This is generally true, but
since Idl.__modify_row() already returns whether there was a change, we
might as well use it.

Reported-by: Reid Price <reid at nicira.com>


commit 4c0f62718ff9f83613c7f87805ee40495f642583
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=4c0f62718ff9f83613c7f87805ee40495f642583
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.idl: Improve error reporting for bad <row-update>s.
		
Strangely malformed <row-update>s could hypothetically get confusing error
message.  Using the Parser class should avoid that.

Reported-by: Reid Price <reid at nicira.com>


commit 6a6f8d167357a1f1751cdd54b9491c531a371ae1
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=6a6f8d167357a1f1751cdd54b9491c531a371ae1
Author: Ben Pfaff <blp at nicira.com>
		
ovsdb-data: Simplify converting an OVSDB datum to JSON by reordering logic.
		
Putting the "map" case first avoids duplicate tests.

Suggested-by: Reid Price <reid at nicira.com>


commit 0233401f12fe5ef8f9d63d660d2bd3f739766025
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=0233401f12fe5ef8f9d63d660d2bd3f739766025
Author: Ben Pfaff <blp at nicira.com>
		
daemon: Stylistic improvement for __read_pidfile in Python implementation.
		
Suggested-by: Reid Price <reid at nicira.com>


commit a7675d4e56d5108c554de25e7772c2eb60470abc
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=a7675d4e56d5108c554de25e7772c2eb60470abc
Author: Ben Pfaff <blp at nicira.com>
		
daemon: Correct comment in Python implementation.
		
Reported-by: Reid Price <reid at nicira.com>


commit 91c637960c57f4b415213ea46c22fefcb2534825
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=91c637960c57f4b415213ea46c22fefcb2534825
Author: Ben Pfaff <blp at nicira.com>
		
python: Avoid using 'tuple' as a variable name.
		
'tuple' is a Python built-in function, so it's best to avoid using it as a
variable name.

Suggested-by: Reid Price <reid at nicira.com>


commit 8758e8a373338e409d7f2863ee91e01060f35628
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=8758e8a373338e409d7f2863ee91e01060f35628
Author: Ben Pfaff <blp at nicira.com>
		
python: Avoid using 'type' as a variable name.
		
'type' is a Python built-in function, so it's best to avoid using it as
a variable name.

Reported-by: Reid Price <reid at nicira.com>


commit d272c10ecdba8a5dc7adba30c98d8d4273dfd1ae
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=d272c10ecdba8a5dc7adba30c98d8d4273dfd1ae
Author: Ben Pfaff <blp at nicira.com>
		
python: Take advantage of Python "x < y < z" syntax.
		
Suggested-by: Reid Price <reid at nicira.com>


commit f2d8ad13e1819a6553b30ba33a28abf7603f5b9b
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=f2d8ad13e1819a6553b30ba33a28abf7603f5b9b
Author: Ben Pfaff <blp at nicira.com>
		
python: Avoid lots of \" in quoted strings by using '' as outermost quotes.
		
Suggested-by: Reid Price <reid at nicira.com>


commit b33a04c63adc29096fe50c08c7b8781398f885c7
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=b33a04c63adc29096fe50c08c7b8781398f885c7
Author: Ben Pfaff <blp at nicira.com>
		
python: Join a list of strings instead of concatenating a long string.
		
Python does not do a good job of appending strings: it takes O(n**2) time
to append n strings.

Suggested-by: Reid Price <reid at nicira.com>


commit 523a3bc7733b13cbfb4b702739cd26d0c29b05f7
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=523a3bc7733b13cbfb4b702739cd26d0c29b05f7
Author: Ben Pfaff <blp at nicira.com>
		
python: Use getattr() and setattr() instead of __dict__.
		
This leaves one use of __dict__ used for iterating through attributes.
I could use dir() instead, but I was put off by this note in its
documentation in the Python Library Reference:

    Because dir() is supplied primarily as a convenience for use at an
    interactive prompt, it tries to supply an interesting set of names more
    than it tries to supply a rigorously or consistently defined set of names,
    and its detailed behavior may change across releases.  For example,
    metaclass attributes are not in the result list when the argument is a
    class.

Suggested-by: Reid Price <reid at nicira.com>


commit 57d6a4c71bd0b4ed477ec273d4d4f84c5e4ed465
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=57d6a4c71bd0b4ed477ec273d4d4f84c5e4ed465
Author: Ben Pfaff <blp at nicira.com>
		
ovs.db.data: Fix bugs in Atom.is_default() and Datum.is_default().
		
Reported-by: Reid Price <reid at nicira.com>


commit 9601fa824d2c3968fda75204488e347d66d62d1f
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=9601fa824d2c3968fda75204488e347d66d62d1f
Author: Ben Pfaff <blp at nicira.com>
		
ovs.stream: Fix logic bug in Stream.connect().
		
The loop here is supposed to run at least once, and to continue looping as
long as the loop body changes the current state, but this bug caused it to
continue looping until the connection completed in success or failure.  It
probably didn't cause many problems in practice because only Unix domain
socket connections are currently supported, and those connections normally
complete immediately.

Reported-by: Reid Price <reid at nicira.com>


-----------------------------------------------------------------------

Summary of changes:
 lib/ovsdb-data.c           |   18 +++---
 lib/ovsdb-types.c          |    3 +-
 python/ovs/daemon.py       |   14 ++---
 python/ovs/db/data.py      |  119 +++++++++++++++++++++-----------------------
 python/ovs/db/error.py     |    4 +-
 python/ovs/db/idl.py       |   68 ++++++++++++++-----------
 python/ovs/db/parser.py    |   32 ++++++------
 python/ovs/db/schema.py    |   24 ++++-----
 python/ovs/db/types.py     |   43 ++++++++--------
 python/ovs/fatal_signal.py |   28 +++++------
 python/ovs/json.py         |   18 +------
 python/ovs/jsonrpc.py      |   24 ++++-----
 python/ovs/process.py      |    8 ++--
 python/ovs/reconnect.py    |   16 +++---
 python/ovs/stream.py       |   23 ++++-----
 15 files changed, 207 insertions(+), 235 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list