Ethan Jackson
591c20651f
daemon.py: Don't shadow built-in 'file' variable.
...
Pychecker considers it bad style.
2011-09-16 18:27:33 -07:00
Ethan Jackson
cadc9871c2
daemon.py: Whitespace cleanup.
...
The python style guide requires two newlines between top level
definitions. This patch also removes some trailing whitespace.
2011-09-16 16:03:31 -07:00
Ben Pfaff
44852fdf63
Mark "uninstall-local" targets phony.
2011-09-15 11:19:59 -07:00
Ben Pfaff
54658e6169
ovs.db.types: Remove write-only variable from constraintsToEnglish().
...
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
973d7411d6
python: Remove unused imports.
...
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
1f00acd0bc
ovs.stream: Remove unused parameter from usage().
...
This function has no callers. We could delete it entirely, instead.
2011-08-25 11:07:23 -07:00
Ben Pfaff
fecf78c237
ovs.ovsuuid: Fix UUID.cInitUUID invocation of re.match with too few params.
...
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
4071e24db4
ovs.jsonrpc: Fix static method Session.open() reference to 'self'.
...
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
b2a5856fef
ovs.jsonrpc: Fix static method Message.__validate_arg reference to 'self'.
...
This method needs to be an instance method because it refers to 'self'.
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
6732237bee
ovs.json: Use Exception, which exists, instead of Error, which doesn't.
...
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
7550c333d3
ovs.db.idl: Fix error message format arguments.
...
There's no variable table_name.
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
c6b24dd7cd
ovs.daemon: Add missing format string argument.
...
Found by pychecker.
2011-08-25 11:07:23 -07:00
Ben Pfaff
0003748f58
ovs.daemon: Fix name of EALREADY error.
...
Found by pychecker.
2011-08-25 11:07:22 -07:00
Ben Pfaff
dbad9de126
ovs.daemon: Add missing 'global' when setting _pidfile_dev, _pidfile_ino.
...
Found by pychecker.
2011-08-25 11:07:22 -07:00
Ben Pfaff
af1eba26c3
ovs.db.idl: Fix call to ovs.db.parser.Parser constructor.
...
This bug was introduced by commit 4c0f62718f "ovs.db.idl: Improve error
reporting for bad <row-update>s."
Found by pychecker.
Bug #7006 .
2011-08-25 11:06:53 -07:00
Ben Pfaff
367da73833
python: Use enumerate() builtin function to simplify counted iteration.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:53 -07:00
Ben Pfaff
8ba31bf16d
ovs.stream: Simplify logic in Stream.wait().
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:53 -07:00
Ben Pfaff
63b1a52133
ovs.stream: Drop Stream.get_name() since clients can use 'name' directly.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:53 -07:00
Ben Pfaff
1f9dd59cf1
ovs.stream: Use %d in place of %ld since the two are equivalent in Python.
...
Reported-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:53 -07:00
Ben Pfaff
90d9dcfc12
ovs.reconnect: Fix typo in documentation.
...
Reported-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:52 -07:00
Ben Pfaff
0a61b042a5
ovs.reconnect: Make Reconnect.Reconnect inherit from object.
...
Reported-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:52 -07:00
Ben Pfaff
2ad4ef8920
ovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:52 -07:00
Ben Pfaff
22bb61e9ee
ovs.jsonrpc: Remove Connection.get_name()--clients can use 'name' directly.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:52 -07:00
Ben Pfaff
17af143600
ovs.jsonrpc: Remove dead class variable Message.__next_id.
...
Reported-by: Reid Price <reid@nicira.com>
2011-08-24 12:06:52 -07:00
Ben Pfaff
e0b2332760
ovs.json: Optimize __dump_string().
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 12:05:13 -07:00
Ben Pfaff
32fcdd44c5
ovs.fatal_signal: Remove unnecessary "global" statement.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:44 -07:00
Ben Pfaff
1304578aeb
ovs.fatal_signal: Reorder definitions to be more easily readable.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:44 -07:00
Ben Pfaff
71607f575e
ovs.db.types: Introduce DEFAULT_MIN, DEFAULT_MAX as Type class members.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:44 -07:00
Ben Pfaff
ca2c5d3d32
ovs.db.types: Use toAtomicType() instead of open-coding it.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
f09aa106ee
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@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
1a98f75260
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@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
693e5dc748
ovs.db.schema: Factor common checks for identifiers into new function.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
c29e06be0e
ovs.db.parser: Simplify code.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
bf6ec045b7
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@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
7d48f8f8bd
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@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
4c0f62718f
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@nicira.com>
2011-08-24 11:57:43 -07:00
Ben Pfaff
6a6f8d1673
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@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
0233401f12
daemon: Stylistic improvement for __read_pidfile in Python implementation.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
a7675d4e56
daemon: Correct comment in Python implementation.
...
Reported-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
91c637960c
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@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
8758e8a373
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@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
d272c10ecd
python: Take advantage of Python "x < y < z" syntax.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
f2d8ad13e1
python: Avoid lots of \" in quoted strings by using '' as outermost quotes.
...
Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
b33a04c63a
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@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
523a3bc773
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@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
57d6a4c71b
ovs.db.data: Fix bugs in Atom.is_default() and Datum.is_default().
...
Reported-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:14 -07:00
Ben Pfaff
9601fa824d
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@nicira.com>
2011-08-24 11:55:49 -07:00
Ben Pfaff
070de9bd41
python: Make invalid UTF-8 sequence messages consistent across Python versions.
...
Given the invalid input <C0 22>, some versions of Python report <C0> as the
invalid sequence and other versions report <C0 22> as the invalid sequence.
Similarly, given input <ED 80 7F>, some report <ED 80> and others report
<ED 80 7F> as the invalid sequence. This caused spurious test failures for
the test "no invalid UTF-8 sequences in strings - Python", so this commit
makes the messages consistent by dropping the extra trailing byte from the
message.
I first noticed the longer sequences <C0 22> and <ED 80 7F> on Ubuntu
10.04 with python version 2.6.5-0ubuntu1, but undoubtedly it exists
elsewhere also.
2011-07-06 09:00:51 -07:00
Ben Pfaff
955400fb2f
python: Fix "make install" on systems without Python.
...
Reported-by: 冯全树(Crab) <fqs888@126.com>
2011-06-14 09:48:23 -07:00
Ben Pfaff
d26c5b7422
python ovsdb: Fix one style inconsistency.
...
Reported-by: Justin Pettit <jpettit@nicira.com>
2011-06-06 09:09:47 -07:00