Clean imports in code
In some part in the code we import objects. In the Openstack style guidelines they recommend to import only modules. [1]: "Do not import objects, only modules". [1] https://docs.openstack.org/hacking/0.10.3/ Change-Id: Id4b47eeae1d3e86a3cb259c32fcb376ffbd3f8c7
This commit is contained in:
parent
1bdf8c65d9
commit
bc4f9195ad
novaclient
@ -28,7 +28,7 @@ import threading
|
||||
|
||||
from oslo_utils import reflection
|
||||
from oslo_utils import strutils
|
||||
from requests import Response
|
||||
import requests
|
||||
import six
|
||||
|
||||
from novaclient import exceptions
|
||||
@ -103,7 +103,7 @@ class RequestIdMixin(object):
|
||||
self._append_request_id(resp)
|
||||
|
||||
def _append_request_id(self, resp):
|
||||
if isinstance(resp, Response):
|
||||
if isinstance(resp, requests.Response):
|
||||
# Extract 'x-openstack-request-id' from headers if
|
||||
# response is a Response object.
|
||||
request_id = (resp.headers.get('x-openstack-request-id') or
|
||||
|
@ -11,7 +11,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from requests import Response
|
||||
import requests
|
||||
import six
|
||||
|
||||
from novaclient import api_versions
|
||||
@ -23,13 +23,13 @@ from novaclient.v2 import flavors
|
||||
|
||||
|
||||
def create_response_obj_with_header():
|
||||
resp = Response()
|
||||
resp = requests.Response()
|
||||
resp.headers['x-openstack-request-id'] = fakes.FAKE_REQUEST_ID
|
||||
return resp
|
||||
|
||||
|
||||
def create_response_obj_with_compute_header():
|
||||
resp = Response()
|
||||
resp = requests.Response()
|
||||
resp.headers['x-compute-request-id'] = fakes.FAKE_REQUEST_ID
|
||||
return resp
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user