Fix unnecessary-pass pylint warnings

Noticed one of these in an unrelated change, let's
fix them and enable the pylint check.

Also start enforcing singleton-comparison as there
are no warnings for it.

TrivialFix

Change-Id: I61cf99dab06642287a1f8c67f5f81b0b1bd8dede
Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
This commit is contained in:
Brian Haley committed 2026-06-17 09:12:06 -04:00
1 parent 319761f069
commit 718434b3ee
27 files changed
-74

No files matched your search

-2
View File
@@ -71,7 +71,6 @@ disable=
unused-argument,
unused-import,
unused-variable,
unnecessary-pass,
raise-missing-from,
arguments-renamed,
broad-exception-raised,
@@ -82,7 +81,6 @@ disable=
consider-using-enumerate,
invalid-name,
missing-docstring,
singleton-comparison,
ungrouped-imports,
wrong-import-order,
consider-using-f-string,
-4
View File
@@ -119,16 +119,13 @@ class FirewallDriver(metaclass=abc.ABCMeta):
def filter_defer_apply_on(self):
"""Defer application of filtering rule."""
pass
def filter_defer_apply_off(self):
"""Turn off deferral of rules and apply the rules now."""
pass
@property
def ports(self):
"""Returns filtered ports."""
pass
@contextlib.contextmanager
def defer_apply(self):
@@ -158,7 +155,6 @@ class FirewallDriver(metaclass=abc.ABCMeta):
def process_trusted_ports(self, port_ids):
"""Process ports that are trusted and shouldn't be filtered."""
pass
def remove_trusted_ports(self, port_ids):
pass
@@ -244,8 +244,6 @@ class DNSForwarderAgentExtension(l2_agent_extension.L2AgentExtension):
def handle_port(self, context, data):
"""DNSForwarder do nothing when port is updated/created"""
pass
def delete_port(self, context, data):
"""DNSForwarder do nothing when port is deleted"""
pass
-1
View File
@@ -103,7 +103,6 @@ class BaseRouterInfo(metaclass=abc.ABCMeta):
:param agent: Passes the agent in order to send RPC messages.
"""
pass
def get_ex_gw_port(self):
return self.router.get('gw_port')
@@ -44,9 +44,7 @@ class EVPNRouterDriver(abc.ABC):
@abc.abstractmethod
def create_evpn_router(self, config: EVPNRouterConfig) -> None:
"""Creates the EVPN VRF in the routing fabric."""
pass
@abc.abstractmethod
def delete_evpn_router(self, config: EVPNRouterConfig) -> None:
"""Deletes the EVPN VRF from the routing fabric."""
pass
-1
View File
@@ -205,7 +205,6 @@ class MetadataDriverBase(metaclass=abc.ABCMeta):
@abc.abstractmethod
def haproxy_configurator():
"""Returns the HaproxyConfigurator for the class."""
pass
@classmethod
def _get_metadata_proxy_user_group(cls, conf):
-1
View File
@@ -109,7 +109,6 @@ class MetadataProxyHandlerBase(metaclass=abc.ABCMeta):
:param skip_cache: When to skip getting entry from cache
"""
pass
@webob.dec.wsgify(RequestClass=webob.Request)
def __call__(self, req):
@@ -108,7 +108,6 @@ class OVNAgentExtension(extension.AgentExtension, metaclass=abc.ABCMeta):
def initialize(self, *args):
"""Initialize agent extension."""
pass
def consume_api(self, agent_api):
"""Configure the Agent API.
@@ -135,7 +134,6 @@ class OVNAgentExtension(extension.AgentExtension, metaclass=abc.ABCMeta):
@abc.abstractmethod
def ovs_idl_events(self) -> RowEventOrClassList:
"""Open_vSwtich schema events to watch"""
pass
@property
@abc.abstractmethod
@@ -146,7 +144,6 @@ class OVNAgentExtension(extension.AgentExtension, metaclass=abc.ABCMeta):
@abc.abstractmethod
def nb_idl_events(self) -> RowEventOrClassList:
"""OVN_Northbound schema events to watch"""
pass
@property
@abc.abstractmethod
@@ -157,7 +154,6 @@ class OVNAgentExtension(extension.AgentExtension, metaclass=abc.ABCMeta):
@abc.abstractmethod
def sb_idl_events(self) -> RowEventOrClassList:
"""OVN_Southbound schema events to watch"""
pass
class OVNAgentExtensionAPI:
-1
View File
@@ -247,4 +247,3 @@ class ExtraRoute_dbonly_mixin(l3_db.L3_NAT_dbonly_mixin):
class ExtraRoute_db_mixin(ExtraRoute_dbonly_mixin, l3_db.L3_NAT_db_mixin):
"""Mixin class to support extra route configuration on router with rpc."""
pass
-1
View File
@@ -73,7 +73,6 @@ class FlavorsDbMixin:
# objects function we can use to quickly query all tables
# that have a foreign key ref to flavors. Or we could replace
# the call to this with callback events.
pass
def _ensure_service_profile_not_in_use(self, context, sp_id):
"""Ensures no current bindings to flavors exist."""
-2
View File
@@ -75,7 +75,6 @@ class AgentPluginBase(metaclass=abc.ABCMeta):
admin can remove it. Agents must be disabled before
being removed.
"""
pass
@abc.abstractmethod
def update_agent(self, context, agent):
@@ -85,7 +84,6 @@ class AgentPluginBase(metaclass=abc.ABCMeta):
as plugins, services. An error code should be reported in this case.
@raise exceptions.BadRequest:
"""
pass
@abc.abstractmethod
def get_agents(self, context, filters=None, fields=None):
-1
View File
@@ -48,4 +48,3 @@ class FloatingIPPoolPluginBase(metaclass=abc.ABCMeta):
sorts=None, limit=None, marker=None,
page_reverse=False):
"""List all floating ip pools."""
pass
-8
View File
@@ -54,7 +54,6 @@ class MeteringPluginBase(service_base.ServicePluginBase,
@abc.abstractmethod
def create_metering_label(self, context, metering_label):
"""Create a metering label."""
pass
def update_metering_label(self, context, id, metering_label):
"""Update a metering label."""
@@ -63,24 +62,20 @@ class MeteringPluginBase(service_base.ServicePluginBase,
@abc.abstractmethod
def delete_metering_label(self, context, label_id):
"""Delete a metering label."""
pass
@abc.abstractmethod
def get_metering_label(self, context, label_id, fields=None):
"""Get a metering label."""
pass
@abc.abstractmethod
def get_metering_labels(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None,
page_reverse=False):
"""List all metering labels."""
pass
@abc.abstractmethod
def create_metering_label_rule(self, context, metering_label_rule):
"""Create a metering label rule."""
pass
def update_metering_label_rule(self, context, id, metering_label_rule):
"""Update a metering label rule."""
@@ -89,16 +84,13 @@ class MeteringPluginBase(service_base.ServicePluginBase,
@abc.abstractmethod
def get_metering_label_rule(self, context, rule_id, fields=None):
"""Get a metering label rule."""
pass
@abc.abstractmethod
def delete_metering_label_rule(self, context, rule_id):
"""Delete a metering label rule."""
pass
@abc.abstractmethod
def get_metering_label_rules(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None,
page_reverse=False):
"""List all metering label rules."""
pass
@@ -89,7 +89,6 @@ class NetworkSegmentRangePluginBase(service_base.ServicePluginBase,
object in
:file:`neutron_lib/api/definitions/network_segment_range.py`.
"""
pass
@abc.abstractmethod
def delete_network_segment_range(self, context, id):
@@ -98,7 +97,6 @@ class NetworkSegmentRangePluginBase(service_base.ServicePluginBase,
:param context: neutron api request context
:param id: UUID representing the network segment range to delete.
"""
pass
@abc.abstractmethod
def update_network_segment_range(self, context, id, network_segment_range):
@@ -112,7 +110,6 @@ class NetworkSegmentRangePluginBase(service_base.ServicePluginBase,
object in
:file:`neutron_lib/api/definitions/network_segment_range.py`.
"""
pass
@abc.abstractmethod
def get_network_segment_ranges(self, context, filters=None, fields=None,
@@ -146,7 +143,6 @@ class NetworkSegmentRangePluginBase(service_base.ServicePluginBase,
next results after the marker resource.
:param page_reverse: True if sort direction is reversed.
"""
pass
@abc.abstractmethod
def get_network_segment_range(self, context, id, fields=None):
@@ -161,4 +157,3 @@ class NetworkSegmentRangePluginBase(service_base.ServicePluginBase,
network_segment_range.py`.
Only these fields will be returned.
"""
pass
-3
View File
@@ -64,21 +64,18 @@ class Manager(periodic_task.PeriodicTasks, metaclass=ManagerMeta):
Child classes should override this method.
"""
pass
def after_start(self):
"""Handler post initialization stuff.
Child classes can override this method.
"""
pass
def stop(self):
"""Handle stop.
Child classes can override this method.
"""
pass
def validate_pre_plugin_load():
-15
View File
@@ -40,7 +40,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
in :file:`neutron/api/v2/attributes.py`. All keys will
be populated.
"""
pass
@abc.abstractmethod
def update_subnet(self, context, id, subnet):
@@ -54,7 +53,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
:file:`neutron/api/v2/attributes.py`.
"""
pass
@abc.abstractmethod
def get_subnet(self, context, id, fields=None):
@@ -68,7 +66,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
@abc.abstractmethod
def get_subnets(self, context, filters=None, fields=None,
@@ -94,7 +91,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
def get_subnets_count(self, context, filters=None):
"""Return the number of subnets.
@@ -125,7 +121,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:param context: neutron api request context
:param id: UUID representing the subnet to delete.
"""
pass
def create_subnetpool(self, context, subnetpool):
"""Create a subnet pool.
@@ -180,7 +175,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
be populated.
"""
pass
@abc.abstractmethod
def update_network(self, context, id, network):
@@ -194,7 +188,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
:file:`neutron/api/v2/attributes.py`.
"""
pass
@abc.abstractmethod
def get_network(self, context, id, fields=None):
@@ -208,7 +201,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
@abc.abstractmethod
def get_networks(self, context, filters=None, fields=None,
@@ -234,7 +226,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
def get_networks_count(self, context, filters=None):
"""Return the number of networks.
@@ -265,7 +256,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:param context: neutron api request context
:param id: UUID representing the network to delete.
"""
pass
@abc.abstractmethod
def create_port(self, context, port):
@@ -280,7 +270,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:file:`neutron/api/v2/attributes.py`. All keys will be
populated.
"""
pass
@abc.abstractmethod
def update_port(self, context, id, port):
@@ -293,7 +282,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
'allow_put' as listed in the :obj:`RESOURCE_ATTRIBUTE_MAP`
object in :file:`neutron/api/v2/attributes.py`.
"""
pass
@abc.abstractmethod
def get_port(self, context, id, fields=None):
@@ -307,7 +295,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
@abc.abstractmethod
def get_ports(self, context, filters=None, fields=None,
@@ -331,7 +318,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
def get_ports_count(self, context, filters=None):
"""Return the number of ports.
@@ -361,7 +347,6 @@ class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
:param context: neutron api request context
:param id: UUID representing the port to delete.
"""
pass
def start_rpc_listeners(self):
"""Start the RPC listeners.
-1
View File
@@ -163,7 +163,6 @@ class RbacNeutronDbObjectMixin(rbac_db_mixin.RbacPluginMixin,
payload=None):
"""Callback to handle RBAC_POLICY, BEFORE_CREATE callback.
"""
pass
@classmethod
def validate_rbac_policy_update(cls, resource, event, trigger,
@@ -146,7 +146,6 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin,
:param lvm: a local VLAN map of network.
:param ofport: a port to add.
'''
pass
@abc.abstractmethod
def del_fdb_flow(self, br, port_info, remote_ip, lvm, ofport):
@@ -168,7 +167,6 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin,
more explanation.
:param ofport: a port to delete.
'''
pass
@abc.abstractmethod
def setup_tunnel_port(self, br, remote_ip, network_type):
@@ -185,7 +183,6 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin,
:param network_type: a type of a network.
:returns: an ofport value. value 0 means the port is unavailable.
'''
pass
@abc.abstractmethod
def cleanup_tunnel_port(self, br, tun_ofport, tunnel_type):
@@ -201,7 +198,6 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin,
:param tun_ofport: a port value to cleanup.
:param tunnel_type: a type of a tunnel.
'''
pass
@abc.abstractmethod
def setup_entry_for_arp_reply(self, br, action, local_vid, mac_address,
@@ -219,7 +215,6 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin,
:param mac_address: MAC string value.
:param ip_address: IP string value.
'''
pass
def get_agent_ports(self, fdb_entries):
"""Generator to yield port info.
@@ -358,7 +358,6 @@ class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase,
For example: return ('flat', ...). You can also refer to the
configuration the given agent exposes.
"""
pass
@abc.abstractmethod
def get_mappings(self, agent):
@@ -366,7 +365,6 @@ class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase,
For example: agent['configurations'].get('bridge_mappings', {}).
"""
pass
def physnet_in_mappings(self, physnet, mappings):
"""Is the physical network part of the given mappings?"""
@@ -31,11 +31,9 @@ class MaintenanceWorker(worker.BaseWorker):
def stop(self):
"""Stop service."""
pass
def wait(self):
"""Wait for service to complete."""
pass
@staticmethod
def reset():
-2
View File
@@ -239,12 +239,10 @@ class L3Scheduler(metaclass=abc.ABCMeta):
@abc.abstractmethod
def _choose_router_agent(self, plugin, context, candidates):
"""Choose an agent from candidates based on a specific policy."""
pass
@abc.abstractmethod
def _choose_router_agents_for_ha(self, plugin, context, candidates):
"""Choose agents from candidates based on a specific policy."""
pass
def _get_num_of_agents_for_ha(self, candidates_count):
return (min(self.max_ha_agents, candidates_count) if self.max_ha_agents
-1
View File
@@ -454,4 +454,3 @@ class Service(n_rpc.Service):
def report_state(self):
"""Update the state of this service."""
# Todo(gongysh) report state to neutron server
pass
@@ -108,7 +108,6 @@ class Designate(driver.ExternalDNSService):
LOG.debug('Conflict when trying to create PTR zone %s,'
' assuming it exists.',
in_addr_zone_name)
pass
except d_exc.OverQuota:
raise dns_exc.ExternalDNSOverQuota(resource='zone')
designate_admin.recordsets.create(in_addr_zone_name,
@@ -62,11 +62,9 @@ class LoggingDriver(metaclass=abc.ABCMeta):
def defer_apply_on(self):
"""Defer application of logging rule."""
pass
def defer_apply_off(self):
"""Turn off deferral of rules and apply the logging rules now."""
pass
@contextlib.contextmanager
def defer_apply(self):
@@ -59,7 +59,6 @@ class ResourceCallBackBase:
def handle_event(self, resource, event, trigger, payload):
"""Handle resource callback event"""
pass
class LoggingServiceDriverManager:
@@ -754,7 +754,6 @@ class PluginAwareExtensionManagerTest(base.BaseTestCase):
Extensions will not be loaded when this plugin is used.
"""
pass
plugin_info = {lib_const.CORE: ExtensionUnawarePlugin()}
ext_mgr = extensions.PluginAwareExtensionManager('', plugin_info)
@@ -807,7 +806,6 @@ class PluginAwareExtensionManagerTest(base.BaseTestCase):
This will work with any plugin implementing NeutronPluginBase
"""
pass
stub_plugin = ext_stubs.StubPlugin(supported_extensions=["e1"])
plugin_info = {lib_const.CORE: stub_plugin}
@@ -3832,7 +3832,6 @@ class TestOVNMechanismDriverNetworksV2(test_plugin.TestMl2NetworksV2,
to allow OVS Agents and thus OVN Mechanism Driver to allow
updation of Segmentation IDs. Till then the test needs to be skipped
"""
pass
def test__update_segmentation_id_ports(self):
"""Skip the Update Segmentation ID tests
@@ -3842,7 +3841,6 @@ class TestOVNMechanismDriverNetworksV2(test_plugin.TestMl2NetworksV2,
to allow OVS Agents and thus OVN Mechanism Driver to allow
updation of Segmentation IDs. Till then the test needs to be skipped
"""
pass
class TestOVNMechanismDriverSubnetsV2(test_plugin.TestMl2SubnetsV2,