Fix H302 violations in extensions package

H302 violation is reported by flake8 when importing separated objects from
modules instead of importing the whole module.
e.g.   from package.module import function
       function()
is changed to
       from package import module
       module.function()

Change-Id: I570eeee2a7633c1590b54ac98b411a71fc9d4f4e
Partial-Bug: #1291032
This commit is contained in:
Jakub Libosvar 2014-04-18 15:31:55 +02:00
parent 4f6815b771
commit 81e03cc89e
10 changed files with 57 additions and 58 deletions

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from abc import abstractmethod
import abc
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
@ -132,7 +132,7 @@ class AgentPluginBase(object):
"""
raise exceptions.BadRequest
@abstractmethod
@abc.abstractmethod
def delete_agent(self, context, id):
"""Delete agent.
@ -144,7 +144,7 @@ class AgentPluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def update_agent(self, context, agent):
"""Disable or Enable the agent.
@ -154,10 +154,10 @@ class AgentPluginBase(object):
"""
pass
@abstractmethod
@abc.abstractmethod
def get_agents(self, context, filters=None, fields=None):
pass
@abstractmethod
@abc.abstractmethod
def get_agent(self, context, id, fields=None):
pass

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from abc import abstractmethod
import abc
from neutron.api import extensions
from neutron.api.v2 import base
@ -135,18 +135,18 @@ class DhcpAgentSchedulerPluginBase(object):
All of method must be in an admin context.
"""
@abstractmethod
@abc.abstractmethod
def add_network_to_dhcp_agent(self, context, id, network_id):
pass
@abstractmethod
@abc.abstractmethod
def remove_network_from_dhcp_agent(self, context, id, network_id):
pass
@abstractmethod
@abc.abstractmethod
def list_networks_on_dhcp_agent(self, context, id):
pass
@abstractmethod
@abc.abstractmethod
def list_dhcp_agents_hosting_network(self, context, network_id):
pass

View File

@ -26,7 +26,7 @@ from neutron.api.v2 import resource_helper
from neutron.common import exceptions as qexception
from neutron.openstack.common import log as logging
from neutron.plugins.common import constants
from neutron.services.service_base import ServicePluginBase
from neutron.services import service_base
LOG = logging.getLogger(__name__)
@ -346,7 +346,7 @@ class Firewall(extensions.ExtensionDescriptor):
@six.add_metaclass(abc.ABCMeta)
class FirewallPluginBase(ServicePluginBase):
class FirewallPluginBase(service_base.ServicePluginBase):
def get_plugin_name(self):
return constants.FIREWALL

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from abc import abstractmethod
import abc
from oslo.config import cfg
@ -196,52 +196,52 @@ class L3(extensions.ExtensionDescriptor):
class RouterPluginBase(object):
@abstractmethod
@abc.abstractmethod
def create_router(self, context, router):
pass
@abstractmethod
@abc.abstractmethod
def update_router(self, context, id, router):
pass
@abstractmethod
@abc.abstractmethod
def get_router(self, context, id, fields=None):
pass
@abstractmethod
@abc.abstractmethod
def delete_router(self, context, id):
pass
@abstractmethod
@abc.abstractmethod
def get_routers(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
pass
@abstractmethod
@abc.abstractmethod
def add_router_interface(self, context, router_id, interface_info):
pass
@abstractmethod
@abc.abstractmethod
def remove_router_interface(self, context, router_id, interface_info):
pass
@abstractmethod
@abc.abstractmethod
def create_floatingip(self, context, floatingip):
pass
@abstractmethod
@abc.abstractmethod
def update_floatingip(self, context, id, floatingip):
pass
@abstractmethod
@abc.abstractmethod
def get_floatingip(self, context, id, fields=None):
pass
@abstractmethod
@abc.abstractmethod
def delete_floatingip(self, context, id):
pass
@abstractmethod
@abc.abstractmethod
def get_floatingips(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None,
page_reverse=False):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from abc import abstractmethod
import abc
import webob.exc
@ -177,18 +177,18 @@ class L3AgentSchedulerPluginBase(object):
All of method must be in an admin context.
"""
@abstractmethod
@abc.abstractmethod
def add_router_to_l3_agent(self, context, id, router_id):
pass
@abstractmethod
@abc.abstractmethod
def remove_router_from_l3_agent(self, context, id, router_id):
pass
@abstractmethod
@abc.abstractmethod
def list_routers_on_l3_agent(self, context, id):
pass
@abstractmethod
@abc.abstractmethod
def list_l3_agents_hosting_router(self, context, router_id):
pass

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from abc import abstractmethod
import abc
from neutron.api import extensions
from neutron.api.v2 import base
@ -128,10 +128,10 @@ class LbaasAgentSchedulerPluginBase(object):
All of method must be in an admin context.
"""
@abstractmethod
@abc.abstractmethod
def list_pools_on_lbaas_agent(self, context, id):
pass
@abstractmethod
@abc.abstractmethod
def get_lbaas_agent_hosting_pool(self, context, pool_id):
pass

View File

@ -25,7 +25,7 @@ from neutron.api.v2 import resource_helper
from neutron.common import exceptions as qexception
from neutron import manager
from neutron.plugins.common import constants
from neutron.services.service_base import ServicePluginBase
from neutron.services import service_base
# Loadbalancer Exceptions
@ -393,7 +393,7 @@ class Loadbalancer(extensions.ExtensionDescriptor):
@six.add_metaclass(abc.ABCMeta)
class LoadBalancerPluginBase(ServicePluginBase):
class LoadBalancerPluginBase(service_base.ServicePluginBase):
def get_plugin_name(self):
return constants.LOADBALANCER

View File

@ -19,11 +19,11 @@ from oslo.config import cfg
import webob
from neutron.api import extensions
from neutron.api.v2.attributes import convert_to_int
from neutron.api.v2 import attributes
from neutron.api.v2 import base
from neutron.api.v2 import resource
from neutron.common import exceptions as n_exc
from neutron.manager import NeutronManager
from neutron import manager
from neutron.openstack.common import importutils
from neutron import quota
from neutron import wsgi
@ -51,12 +51,12 @@ class QuotaSetsController(wsgi.Controller):
def _update_attributes(self):
for quota_resource in QUOTAS.resources.iterkeys():
attr_dict = EXTENDED_ATTRIBUTES_2_0[RESOURCE_COLLECTION]
attr_dict[quota_resource] = {'allow_post': False,
'allow_put': True,
'convert_to': convert_to_int,
'validate': {'type:range':
[-1, sys.maxsize]},
'is_visible': True}
attr_dict[quota_resource] = {
'allow_post': False,
'allow_put': True,
'convert_to': attributes.convert_to_int,
'validate': {'type:range': [-1, sys.maxsize]},
'is_visible': True}
self._update_extended_attributes = False
def _get_quotas(self, request, tenant_id):
@ -138,7 +138,7 @@ class Quotasv2(extensions.ExtensionDescriptor):
def get_resources(cls):
"""Returns Ext Resources."""
controller = resource.Resource(
QuotaSetsController(NeutronManager.get_plugin()),
QuotaSetsController(manager.NeutronManager.get_plugin()),
faults=base.FAULT_MAP)
return [extensions.ResourceExtension(
Quotasv2.get_alias(),

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from abc import ABCMeta
from abc import abstractmethod
import abc
import netaddr
from oslo.config import cfg
@ -311,45 +310,45 @@ class Securitygroup(extensions.ExtensionDescriptor):
return {}
@six.add_metaclass(ABCMeta)
@six.add_metaclass(abc.ABCMeta)
class SecurityGroupPluginBase(object):
@abstractmethod
@abc.abstractmethod
def create_security_group(self, context, security_group):
pass
@abstractmethod
@abc.abstractmethod
def update_security_group(self, context, id, security_group):
pass
@abstractmethod
@abc.abstractmethod
def delete_security_group(self, context, id):
pass
@abstractmethod
@abc.abstractmethod
def get_security_groups(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None,
page_reverse=False):
pass
@abstractmethod
@abc.abstractmethod
def get_security_group(self, context, id, fields=None):
pass
@abstractmethod
@abc.abstractmethod
def create_security_group_rule(self, context, security_group_rule):
pass
@abstractmethod
@abc.abstractmethod
def delete_security_group_rule(self, context, id):
pass
@abstractmethod
@abc.abstractmethod
def get_security_group_rules(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None,
page_reverse=False):
pass
@abstractmethod
@abc.abstractmethod
def get_security_group_rule(self, context, id, fields=None):
pass

View File

@ -24,7 +24,7 @@ from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper
from neutron.common import exceptions as qexception
from neutron.plugins.common import constants
from neutron.services.service_base import ServicePluginBase
from neutron.services import service_base
class VPNServiceNotFound(qexception.NotFound):
@ -386,7 +386,7 @@ class Vpnaas(extensions.ExtensionDescriptor):
@six.add_metaclass(abc.ABCMeta)
class VPNPluginBase(ServicePluginBase):
class VPNPluginBase(service_base.ServicePluginBase):
def get_plugin_name(self):
return constants.VPN