Fix H302 violations in db package and services

Change-Id: If5e07fa4529430ba90d9c7dd81d28ceeee00ebe0
Partial-Bug: #1291032
This commit is contained in:
Jakub Libosvar 2014-04-18 15:22:45 +02:00
parent f3b8b4b9db
commit 4fc6c74858
12 changed files with 23 additions and 23 deletions

View File

@ -22,7 +22,7 @@ from sqlalchemy.orm import joinedload
from neutron.common import constants
from neutron.db import agents_db
from neutron.db.agentschedulers_db import AgentSchedulerDbMixin
from neutron.db import agentschedulers_db
from neutron.db import model_base
from neutron.db import models_v2
from neutron.extensions import l3agentscheduler
@ -52,7 +52,7 @@ class RouterL3AgentBinding(model_base.BASEV2, models_v2.HasId):
class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
AgentSchedulerDbMixin):
agentschedulers_db.AgentSchedulerDbMixin):
"""Mixin class to add l3 agent scheduler extension to plugins
using the l3 agent for routing.
"""
@ -237,7 +237,8 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
return [l3_agent
for l3_agent in query
if AgentSchedulerDbMixin.is_eligible_agent(active, l3_agent)]
if agentschedulers_db.AgentSchedulerDbMixin.is_eligible_agent(
active, l3_agent)]
def get_l3_agent_candidates(self, sync_router, l3_agents):
"""Get the valid l3 agents for the router from a list of l3_agents."""

View File

@ -27,7 +27,6 @@ from neutron.db import model_base
from neutron.db import models_v2
from neutron.db import servicetype_db as st_db
from neutron.extensions import loadbalancer
from neutron.extensions.loadbalancer import LoadBalancerPluginBase
from neutron import manager
from neutron.openstack.common.db import exception
from neutron.openstack.common import excutils
@ -177,7 +176,7 @@ class PoolMonitorAssociation(model_base.BASEV2,
primary_key=True)
class LoadBalancerPluginDb(LoadBalancerPluginBase,
class LoadBalancerPluginDb(loadbalancer.LoadBalancerPluginBase,
base_db.CommonDbMixin):
"""Wraps loadbalancer with SQLAlchemy models.

View File

@ -14,7 +14,7 @@
#
# @author: Mark McClain, DreamHost
from logging.config import fileConfig
from logging import config as logging_config
from alembic import context
from sqlalchemy import create_engine, pool
@ -32,7 +32,7 @@ neutron_config = config.neutron_config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
logging_config.fileConfig(config.config_file_name)
plugin_class_path = neutron_config.core_plugin
active_plugins = [plugin_class_path]

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from six.moves import xrange
from six import moves
import sqlalchemy
from sqlalchemy.orm.properties import RelationshipProperty
@ -88,7 +88,7 @@ def paginate_query(query, model, limit, sorts, marker_obj=None):
criteria_list = []
for i, sort in enumerate(sorts):
crit_attrs = [(getattr(model, sorts[j][0]) == marker_values[j])
for j in xrange(i)]
for j in moves.xrange(i)]
model_attr = getattr(model, sort[0])
if sort[1]:
crit_attrs.append((model_attr > marker_values[i]))

View File

@ -30,7 +30,6 @@ from neutron.db import l3_db
from neutron.db import model_base
from neutron.db import models_v2
from neutron.extensions import vpnaas
from neutron.extensions.vpnaas import VPNPluginBase
from neutron import manager
from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging
@ -163,7 +162,7 @@ class VPNService(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
cascade="all, delete-orphan")
class VPNPluginDb(VPNPluginBase, base_db.CommonDbMixin):
class VPNPluginDb(vpnaas.VPNPluginBase, base_db.CommonDbMixin):
"""VPN plugin database class using SQLAlchemy models."""
def __init__(self):

View File

@ -30,7 +30,7 @@ from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging
from neutron.openstack.common import loopingcall
from neutron.openstack.common.rpc import service
from neutron.openstack.common.service import ProcessLauncher
from neutron.openstack.common import service as common_service
from neutron import wsgi
@ -153,7 +153,7 @@ def serve_rpc():
rpc.start()
return rpc
else:
launcher = ProcessLauncher(wait_interval=1.0)
launcher = common_service.ProcessLauncher(wait_interval=1.0)
launcher.launch_service(rpc, workers=cfg.CONF.rpc_workers)
return launcher
except Exception:

View File

@ -15,7 +15,7 @@
#
# @author: Ivar Lazzaro, Embrane, Inc. ivar@embrane.com
from functools import wraps
import functools
from heleosapi import exceptions as h_exc
@ -34,7 +34,7 @@ def handler(event, handler):
else:
handler[event].append(f)
@wraps(f)
@functools.wraps(f)
def wrapped_f(*args, **kwargs):
return f(*args, **kwargs)

View File

@ -17,7 +17,7 @@
import sqlalchemy as sql
from neutron.db.models_v2 import model_base
from neutron.db import model_base
class PoolPort(model_base.BASEV2):

View File

@ -17,7 +17,7 @@
# @author: Mark McClain, DreamHost
import itertools
from six.moves import xrange
from six import moves
from neutron.agent.linux import utils
from neutron.plugins.common import constants as qconstants
@ -231,7 +231,7 @@ def _expand_expected_codes(codes):
continue
elif '-' in code:
low, hi = code.split('-')[:2]
retval.update(str(i) for i in xrange(int(low), int(hi) + 1))
retval.update(str(i) for i in moves.xrange(int(low), int(hi) + 1))
else:
retval.add(code)
return retval

View File

@ -15,7 +15,7 @@
# @author: Paul Michali, Cisco Systems, Inc.
import abc
from collections import namedtuple
import collections
import requests
import netaddr
@ -46,7 +46,8 @@ cfg.CONF.register_opts(ipsec_opts, 'cisco_csr_ipsec')
LOG = logging.getLogger(__name__)
RollbackStep = namedtuple('RollbackStep', ['action', 'resource_id', 'title'])
RollbackStep = collections.namedtuple('RollbackStep',
['action', 'resource_id', 'title'])
class CsrResourceCreateFailure(exceptions.NeutronException):

View File

@ -47,7 +47,7 @@ class TestWSGIServer(base.BaseTestCase):
server.stop()
server.wait()
@mock.patch('neutron.wsgi.ProcessLauncher')
@mock.patch('neutron.openstack.common.service.ProcessLauncher')
def test_start_multiple_workers(self, ProcessLauncher):
launcher = ProcessLauncher.return_value

View File

@ -44,7 +44,7 @@ from neutron.openstack.common import excutils
from neutron.openstack.common import gettextutils
from neutron.openstack.common import jsonutils
from neutron.openstack.common import log as logging
from neutron.openstack.common.service import ProcessLauncher
from neutron.openstack.common import service as common_service
socket_opts = [
cfg.IntOpt('backlog',
@ -216,7 +216,7 @@ class Server(object):
else:
# Minimize the cost of checking for child exit by extending the
# wait interval past the default of 0.01s.
self._launcher = ProcessLauncher(wait_interval=1.0)
self._launcher = common_service.ProcessLauncher(wait_interval=1.0)
self._server = WorkerService(self, application)
self._launcher.launch_service(self._server, workers=workers)