Clean imports in code

1. What is the problem
Some source files are still importing objects instead of modules

2. What is the solution to the problem
This patch set modifies lines which are importing objects
instead of modules. As per openstack import guide lines, user should
import modules in a file not objects.

http://docs.openstack.org/developer/hacking/#imports

3. What the features need to be implemented to the Tricircle
N/A.

Change-Id: Ib84188a761ad7403ee72f5336b631235ea5dda90
This commit is contained in:
Cao Xuan Hoang 2017-02-06 13:12:57 +07:00
parent 7b1558e854
commit 9bf89d124b
3 changed files with 11 additions and 12 deletions

View File

@ -15,8 +15,7 @@
from six.moves.urllib import parse as urlparse
from requests import Request
from requests import Session
import requests
from oslo_log import log as logging
@ -141,10 +140,10 @@ def get_pod_service_ctx(context, t_url, region_name, s_type=cons.ST_NEUTRON):
def forward_req(context, action, b_headers, b_url, b_body):
s = Session()
req = Request(action, b_url,
data=b_body,
headers=b_headers)
s = requests.Session()
req = requests.Request(action, b_url,
data=b_body,
headers=b_headers)
prepped = req.prepare()
# do something with prepped.body

View File

@ -14,7 +14,7 @@
# limitations under the License.
import six
from oslo_messaging import Serializer
from oslo_messaging import serializer
ATTR_NOT_SPECIFIED = object()
@ -31,7 +31,7 @@ _SINGLETON_MAPPING = Mapping({
})
class TricircleSerializer(Serializer):
class TricircleSerializer(serializer.Serializer):
def __init__(self, base=None):
super(TricircleSerializer, self).__init__()
self._base = base

View File

@ -32,10 +32,10 @@ from tricircle.common import rpc
from tricircle.common import version
from tricircle.common.serializer import TricircleSerializer as Serializer
from tricircle.common import serializer as t_serializer
from tricircle.common import topics
from tricircle.xjob.xmanager import XManager
from tricircle.xjob import xmanager as t_xmanager
_TIMER_INTERVAL = 30
@ -231,7 +231,7 @@ def create_service():
LOG.debug(_('create xjob server'))
xmanager = XManager()
xmanager = t_xmanager.XManager()
xservice = XService(
host=CONF.host,
binary="xjob",
@ -240,7 +240,7 @@ def create_service():
periodic_enable=True,
report_interval=_TIMER_INTERVAL,
periodic_interval_max=_TIMER_INTERVAL_MAX,
serializer=Serializer()
serializer=t_serializer.TricircleSerializer()
)
xservice.start()