summaryrefslogtreecommitdiff
path: root/python
Commit message (Collapse)AuthorAgeFilesLines
* daemon.py: Silence return warning.Ethan Jackson2011-09-161-3/+5
| | | | | | | | | Pychecker complains about __read_pidfile() having too may returns. I personally think the function is fine, but it's easy enough to reduce them. python/ovs/daemon.py:395: Function (__read_pidfile) has too many returns (12)
* daemon.py: Don't shadow built-in 'file' variable.Ethan Jackson2011-09-161-12/+12
| | | | Pychecker considers it bad style.
* daemon.py: Whitespace cleanup.Ethan Jackson2011-09-161-5/+29
| | | | | The python style guide requires two newlines between top level definitions. This patch also removes some trailing whitespace.
* Mark "uninstall-local" targets phony.Ben Pfaff2011-09-151-1/+1
|
* ovs.db.types: Remove write-only variable from constraintsToEnglish().Ben Pfaff2011-08-251-2/+0
| | | | Found by pychecker.
* python: Remove unused imports.Ben Pfaff2011-08-252-6/+0
| | | | Found by pychecker.
* ovs.stream: Remove unused parameter from usage().Ben Pfaff2011-08-251-1/+1
| | | | This function has no callers. We could delete it entirely, instead.
* ovs.ovsuuid: Fix UUID.cInitUUID invocation of re.match with too few params.Ben Pfaff2011-08-251-1/+1
| | | | Found by pychecker.
* ovs.jsonrpc: Fix static method Session.open() reference to 'self'.Ben Pfaff2011-08-251-1/+1
| | | | Found by pychecker.
* ovs.jsonrpc: Fix static method Message.__validate_arg reference to 'self'.Ben Pfaff2011-08-251-7/+6
| | | | | | This method needs to be an instance method because it refers to 'self'. Found by pychecker.
* ovs.json: Use Exception, which exists, instead of Error, which doesn't.Ben Pfaff2011-08-251-1/+1
| | | | Found by pychecker.
* ovs.db.idl: Fix error message format arguments.Ben Pfaff2011-08-251-2/+2
| | | | | | There's no variable table_name. Found by pychecker.
* ovs.daemon: Add missing format string argument.Ben Pfaff2011-08-251-1/+1
| | | | Found by pychecker.
* ovs.daemon: Fix name of EALREADY error.Ben Pfaff2011-08-251-1/+1
| | | | Found by pychecker.
* ovs.daemon: Add missing 'global' when setting _pidfile_dev, _pidfile_ino.Ben Pfaff2011-08-251-0/+2
| | | | Found by pychecker.
* ovs.db.idl: Fix call to ovs.db.parser.Parser constructor.Ben Pfaff2011-08-251-1/+1
| | | | | | | | This bug was introduced by commit 4c0f62718f "ovs.db.idl: Improve error reporting for bad <row-update>s." Found by pychecker. Bug #7006.
* python: Use enumerate() builtin function to simplify counted iteration.Ben Pfaff2011-08-242-15/+5
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.stream: Simplify logic in Stream.wait().Ben Pfaff2011-08-241-3/+3
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.stream: Drop Stream.get_name() since clients can use 'name' directly.Ben Pfaff2011-08-242-4/+1
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.stream: Use %d in place of %ld since the two are equivalent in Python.Ben Pfaff2011-08-241-3/+3
| | | | Reported-by: Reid Price <reid@nicira.com>
* ovs.reconnect: Fix typo in documentation.Ben Pfaff2011-08-241-2/+2
| | | | Reported-by: Reid Price <reid@nicira.com>
* ovs.reconnect: Make Reconnect.Reconnect inherit from object.Ben Pfaff2011-08-241-1/+1
| | | | Reported-by: Reid Price <reid@nicira.com>
* ovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings.Ben Pfaff2011-08-241-3/+3
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.jsonrpc: Remove Connection.get_name()--clients can use 'name' directly.Ben Pfaff2011-08-241-4/+1
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.jsonrpc: Remove dead class variable Message.__next_id.Ben Pfaff2011-08-241-1/+0
| | | | Reported-by: Reid Price <reid@nicira.com>
* ovs.json: Optimize __dump_string().Ben Pfaff2011-08-241-9/+1
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.fatal_signal: Remove unnecessary "global" statement.Ben Pfaff2011-08-241-2/+0
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.fatal_signal: Reorder definitions to be more easily readable.Ben Pfaff2011-08-241-13/+13
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.db.types: Introduce DEFAULT_MIN, DEFAULT_MAX as Type class members.Ben Pfaff2011-08-241-5/+8
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.db.types: Use toAtomicType() instead of open-coding it.Ben Pfaff2011-08-241-2/+2
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.db.types: Simplify code to avoid try/except case.Ben Pfaff2011-08-241-4/+2
| | | | | | | 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>
* ovs.db.types: Use .append instead of += for adding to lists.Ben Pfaff2011-08-241-3/+3
| | | | | | Python does not do a good job of appending lists to lists. Suggested-by: Reid Price <reid@nicira.com>
* ovs.db.schema: Factor common checks for identifiers into new function.Ben Pfaff2011-08-241-10/+8
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.db.parser: Simplify code.Ben Pfaff2011-08-241-7/+5
| | | | Suggested-by: Reid Price <reid@nicira.com>
* ovs.db.idl: Use top-level class to represent IDL rows.Ben Pfaff2011-08-241-2/+7
| | | | | | | | | 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>
* ovs.db.idl: Actually use Idl.__modify_row()'s return value.Ben Pfaff2011-08-241-4/+9
| | | | | | | | | 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>
* ovs.db.idl: Improve error reporting for bad <row-update>s.Ben Pfaff2011-08-241-9/+5
| | | | | | | 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>
* ovsdb-data: Simplify converting an OVSDB datum to JSON by reordering logic.Ben Pfaff2011-08-241-5/+5
| | | | | | Putting the "map" case first avoids duplicate tests. Suggested-by: Reid Price <reid@nicira.com>
* daemon: Stylistic improvement for __read_pidfile in Python implementation.Ben Pfaff2011-08-241-4/+4
| | | | Suggested-by: Reid Price <reid@nicira.com>
* daemon: Correct comment in Python implementation.Ben Pfaff2011-08-241-2/+1
| | | | Reported-by: Reid Price <reid@nicira.com>
* python: Avoid using 'tuple' as a variable name.Ben Pfaff2011-08-241-4/+3
| | | | | | | '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>
* python: Avoid using 'type' as a variable name.Ben Pfaff2011-08-246-35/+35
| | | | | | | '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>
* python: Take advantage of Python "x < y < z" syntax.Ben Pfaff2011-08-243-8/+6
| | | | Suggested-by: Reid Price <reid@nicira.com>
* python: Avoid lots of \" in quoted strings by using '' as outermost quotes.Ben Pfaff2011-08-246-29/+29
| | | | Suggested-by: Reid Price <reid@nicira.com>
* python: Join a list of strings instead of concatenating a long string.Ben Pfaff2011-08-241-27/+29
| | | | | | | 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>
* python: Use getattr() and setattr() instead of __dict__.Ben Pfaff2011-08-243-6/+5
| | | | | | | | | | | | | | | 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>
* ovs.db.data: Fix bugs in Atom.is_default() and Datum.is_default().Ben Pfaff2011-08-241-4/+3
| | | | Reported-by: Reid Price <reid@nicira.com>
* ovs.stream: Fix logic bug in Stream.connect().Ben Pfaff2011-08-241-0/+1
| | | | | | | | | | | 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>
* python: Make invalid UTF-8 sequence messages consistent across Python versions.Ben Pfaff2011-07-061-1/+2
| | | | | | | | | | | | | | 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.
* python: Fix "make install" on systems without Python.Ben Pfaff2011-06-141-0/+3
| | | | Reported-by: 冯全树(Crab) <fqs888@126.com>