From d9c7f0bc2fa696eb74be844b32b9dd9ceb257eed Mon Sep 17 00:00:00 2001 From: Sun Austin Date: Tue, 16 Oct 2018 09:26:09 +0800 Subject: [PATCH] Fix types issue for Python 2/3 compatible code. replace types.NoneType with type(None) replace types.DictType with dict Story: 2003430 Task: 27481 Change-Id: I835b1c086267b05bedb454a0d2eaaeef58254dae Signed-off-by: Sun Austin --- service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py | 3 +-- .../sm-api/sm_api/openstack/common/rpc/impl_zmq.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py b/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py index 38877a96..334e7135 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py @@ -42,7 +42,6 @@ import functools import inspect import itertools import json -import types import xmlrpclib import six @@ -56,7 +55,7 @@ _nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.iscode, inspect.isbuiltin, inspect.isroutine, inspect.isabstract] -_simple_types = (types.NoneType, int, six.string_types, bool, float, long) +_simple_types = (type(None), int, six.string_types, bool, float, long) def to_primitive(value, convert_instances=False, convert_datetime=True, diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py index 3bde39f4..9e1d7c79 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py @@ -747,7 +747,7 @@ def _call(addr, context, topic, msg, timeout=None, # One effect of this is that we're checking all # responses for Exceptions. for resp in responses: - if isinstance(resp, types.DictType) and 'exc' in resp: + if isinstance(resp, dict) and 'exc' in resp: raise rpc_common.deserialize_remote_exception(CONF, resp['exc']) return responses[-1]