Skip to content

Commit

Permalink
python: Drop use of types.FunctionType.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
russellb committed Feb 2, 2016
1 parent 1ccbf95 commit 58de9fc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions python/ovs/unixctl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 58de9fc

Please sign in to comment.