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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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