diff options
author | Russell Bryant <russell@ovn.org> | 2015-12-15 08:51:45 -0500 |
---|---|---|
committer | Russell Bryant <russell@ovn.org> | 2016-02-02 16:41:11 -0500 |
commit | 58de9fc30e45118a7a3b2018ced44adaefb6c3b9 (patch) | |
tree | ac1744ecab09c0e1c68c3b6d015bedb0ca24cca8 /python | |
parent | 1ccbf95c6eaccb371227dd58455163840d6cc2d0 (diff) | |
download | openvswitch-58de9fc30e45118a7a3b2018ced44adaefb6c3b9.tar.gz |
python: Drop use of types.FunctionType.
This code asserted that the callback argument was of type
types.FunctionType. It's more pythonic to just check that the argument
is callable, and not specifically that it's a function. There are other
ways to implement a callback than types.FunctionType.
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/ovs/unixctl/__init__.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/python/ovs/unixctl/__init__.py b/python/ovs/unixctl/__init__.py index 26e126a97..d3d35562b 100644 --- a/python/ovs/unixctl/__init__.py +++ b/python/ovs/unixctl/__init__.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import types - import six import ovs.util @@ -63,7 +61,7 @@ def command_register(name, usage, min_args, max_args, callback, aux): assert isinstance(usage, strtypes) assert isinstance(min_args, int) assert isinstance(max_args, int) - assert isinstance(callback, types.FunctionType) + assert callable(callback) if name not in commands: commands[name] = _UnixctlCommand(usage, min_args, max_args, callback, |