Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmoguy committed Sep 26, 2024
1 parent ac0bf4b commit 1cd46f4
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 52 deletions.
4 changes: 2 additions & 2 deletions adapters/vendors/rabbitmq/test_rabbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def basic_publish(
body, # pylint: disable=unused-argument
properties=None, # pylint: disable=unused-argument
mandatory=False,
): # pylint: disable=unused-argument
): # pylint: disable=unused-argument,too-many-arguments,too-many-positional-arguments
return True


Expand All @@ -39,7 +39,7 @@ def basic_publish(
body, # pylint: disable=unused-argument
properties=None, # pylint: disable=unused-argument
mandatory=False,
): # pylint: disable=unused-argument
): # pylint: disable=unused-argument,too-many-arguments,too-many-positional-arguments
raise pika.exceptions.AMQPError("failure")


Expand Down
4 changes: 2 additions & 2 deletions faucet/faucet_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ValveTableConfig: # pylint: disable=too-many-instance-attributes
def __init__(
self,
name,
table_id, # pylint: disable=too-many-arguments
table_id,
exact_match=None,
meter=None,
output=True,
Expand All @@ -39,7 +39,7 @@ def __init__(
next_tables=None,
metadata_match=0,
metadata_write=0,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
self.name = name
self.table_id = table_id
self.exact_match = exact_match
Expand Down
12 changes: 6 additions & 6 deletions faucet/valve_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def build_output_actions(acl_table, output_dict, tunnel_rules=None, source_id=No
return (output_port, output_actions, ofmsgs, output_inst)


def build_acl_entry( # pylint: disable=too-many-arguments,too-many-branches,too-many-statements
def build_acl_entry(
acl_table,
rule_conf,
meters,
Expand All @@ -200,7 +200,7 @@ def build_acl_entry( # pylint: disable=too-many-arguments,too-many-branches,too
vlan_vid=None,
tunnel_rules=None,
source_id=None,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-branches,too-many-statements
"""Build flow/groupmods for one ACL rule entry."""
acl_inst = []
acl_act = []
Expand Down Expand Up @@ -282,7 +282,7 @@ def build_tunnel_ofmsgs(
vlan_vid=None,
flowdel=False,
reverse=False,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Build a specific tunnel only ofmsgs"""
ofmsgs = []
acl_inst = []
Expand Down Expand Up @@ -329,7 +329,7 @@ def build_rule_ofmsgs(
tunnel_rules=None,
source_id=None,
flowdel=False,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Build an ACL rule and return OFMSGs"""
ofmsgs = []
acl_match, acl_inst, acl_cookie, acl_ofmsgs = build_acl_entry(
Expand Down Expand Up @@ -369,7 +369,7 @@ def build_acl_ofmsgs(
tunnel_rules=None,
source_id=None,
flowdel=False,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Build flow/groupmods for all entries in an ACL."""
ofmsgs = []
acl_rule_priority = highest_priority
Expand Down Expand Up @@ -437,7 +437,7 @@ def __init__(
pipeline,
meters,
dp_acls=None,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
self.dp_acls = dp_acls
self.port_acl_table = port_acl_table
self.vlan_acl_table = vlan_acl_table
Expand Down
4 changes: 2 additions & 2 deletions faucet/valve_coprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def __init__(
ports,
copro_table,
vlan_table,
eth_src_table, # pylint: disable=too-many-arguments
eth_src_table,
output_table,
low_priority,
high_priority,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
self.ports = ports
self.copro_table = copro_table
self.vlan_table = vlan_table
Expand Down
4 changes: 2 additions & 2 deletions faucet/valve_lldp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
set_var,
set_port_var,
stack_manager,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
self.vlan_table = vlan_table
self.highest_priority = highest_priority
self.logger = logger
Expand Down Expand Up @@ -89,7 +89,7 @@ def verify_lldp(
remote_dp_name,
remote_port_id,
remote_port_state,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""
Verify correct LLDP cabling, then update port to next state
Expand Down
34 changes: 20 additions & 14 deletions faucet/valve_packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def build_pkt_header(vid, eth_src, eth_dst, dl_type):

def lldp_beacon(
eth_src, chassis_id, port_id, ttl, org_tlvs=None, system_name=None, port_descr=None
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Return an LLDP frame suitable for a host/access port.
Args:
Expand Down Expand Up @@ -426,7 +426,7 @@ def lacp_reqreply(
partner_state_aggregation=0,
partner_state_synchronization=0,
partner_state_activity=0,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Return a LACP frame.
Args:
Expand Down Expand Up @@ -543,7 +543,9 @@ def arp_reply(vid, eth_src, eth_dst, src_ip, dst_ip):
return pkt


def echo_reply(vid, eth_src, eth_dst, src_ip, dst_ip, data):
def echo_reply(
vid, eth_src, eth_dst, src_ip, dst_ip, data
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Return an ICMP echo reply packet.
Args:
Expand All @@ -558,15 +560,15 @@ def echo_reply(vid, eth_src, eth_dst, src_ip, dst_ip, data):
pkt = build_pkt_header(vid, eth_src, eth_dst, valve_of.ether.ETH_TYPE_IP)
ipv4_pkt = ipv4.ipv4(dst=dst_ip, src=src_ip, proto=valve_of.inet.IPPROTO_ICMP)
pkt.add_protocol(ipv4_pkt)
icmp_pkt = icmp.icmp(
type_=icmp.ICMP_ECHO_REPLY, code=icmp.ICMP_ECHO_REPLY_CODE, data=data
)
icmp_pkt = icmp.icmp(type_=icmp.ICMP_ECHO_REPLY, code=icmp.ICMP_ECHO_REPLY_CODE, data=data)
pkt.add_protocol(icmp_pkt)
pkt.serialize()
return pkt


def time_exceeded(vid, eth_src, eth_dst, src_ip, dst_ip, data):
def time_exceeded(
vid, eth_src, eth_dst, src_ip, dst_ip, data
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Return an ICMP time-to-live exceeded packet.
Args:
Expand Down Expand Up @@ -681,16 +683,16 @@ def nd_advert(vid, eth_src, eth_dst, src_ip, dst_ip):
pkt.add_protocol(ipv6_icmp6)
icmpv6_nd_advert = icmpv6.icmpv6(
type_=icmpv6.ND_NEIGHBOR_ADVERT,
data=icmpv6.nd_neighbor(
dst=src_ip, option=icmpv6.nd_option_tla(hw_src=eth_src), res=7
),
data=icmpv6.nd_neighbor(dst=src_ip, option=icmpv6.nd_option_tla(hw_src=eth_src), res=7),
)
pkt.add_protocol(icmpv6_nd_advert)
pkt.serialize()
return pkt


def icmpv6_echo_reply(vid, eth_src, eth_dst, src_ip, dst_ip, hop_limit, id_, seq, data):
def icmpv6_echo_reply(
vid, eth_src, eth_dst, src_ip, dst_ip, hop_limit, id_, seq, data
): # pylint: disable=too-many-arguments,too-many-positional-arguments
r"""Return IPv6 ICMP echo reply packet.
Args:
Expand Down Expand Up @@ -719,7 +721,9 @@ def icmpv6_echo_reply(vid, eth_src, eth_dst, src_ip, dst_ip, hop_limit, id_, seq
return pkt


def icmpv6_time_exceeded(vid, eth_src, eth_dst, src_ip, dst_ip, data):
def icmpv6_time_exceeded(
vid, eth_src, eth_dst, src_ip, dst_ip, data
): # pylint: disable=too-many-arguments,too-many-positional-arguments
r"""Return IPv6 ICMP hop limit exceeded packet.
Args:
Expand All @@ -741,7 +745,9 @@ def icmpv6_time_exceeded(vid, eth_src, eth_dst, src_ip, dst_ip, data):
return pkt


def router_advert(vid, eth_src, eth_dst, src_ip, dst_ip, vips, pi_flags=0x6):
def router_advert(
vid, eth_src, eth_dst, src_ip, dst_ip, vips, pi_flags=0x6
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Return IPv6 ICMP Router Advert.
Args:
Expand Down Expand Up @@ -834,7 +840,7 @@ def __init__(
eth_src,
eth_dst,
eth_type,
):
): # pylint: disable=too-many-arguments,too-many-positional-arguments
self.reason = reason
self.data = data
self.orig_len = orig_len
Expand Down
16 changes: 8 additions & 8 deletions faucet/valve_switch_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _build_flood_acts_for_port(
port,
exclude_all_external=False,
exclude_restricted_bcast_arpnd=False,
): # pylint: disable=too-many-arguments
): # pylint: disable=too-many-arguments,too-many-positional-arguments
if self.external_root_only:
exclude_all_external = True
return super()._build_flood_acts_for_port(
Expand All @@ -124,7 +124,7 @@ def _flood_actions(
away_flood_actions,
toward_flood_actions,
local_flood_actions,
): # pylint: disable=too-many-arguments
): # pylint: disable=too-many-arguments,too-many-positional-arguments
raise NotImplementedError

def _build_flood_rule_actions(
Expand Down Expand Up @@ -173,7 +173,7 @@ def _build_flood_rule_actions(

def _build_mask_flood_rules_filters(
self, port, vlan, eth_dst, eth_dst_mask, prune
): # pylint: disable=too-many-arguments
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Builds filter for the input table to filter packets on ports that are pruned"""
ofmsgs = []

Expand Down Expand Up @@ -235,7 +235,7 @@ def _build_mask_flood_rules_flood_acts(
cold_start,
prune,
port,
): # pylint: disable=unused-argument,disable=too-many-arguments
): # pylint: disable=unused-argument,too-many-arguments,too-many-positional-arguments
"""Builds the flood rules for the flood table to forward packets along the stack topology"""
ofmsgs = []
flood_acts = []
Expand Down Expand Up @@ -288,7 +288,7 @@ def _build_mask_flood_rules(
exclude_restricted_bcast_arpnd,
command,
cold_start,
): # pylint: disable=too-many-arguments
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""Builds that flood rules for each mask for each port in the stack.
This takes into account the pruned and non-pruned ports and returns
the appropriate flood rule actions"""
Expand Down Expand Up @@ -582,7 +582,7 @@ def _flood_actions(
away_flood_actions,
toward_flood_actions,
local_flood_actions,
): # pylint: disable=too-many-arguments
): # pylint: disable=too-many-arguments,too-many-positional-arguments
if not in_port or self.stack_manager.is_stack_port(in_port):
flood_prefix = ()
else:
Expand Down Expand Up @@ -681,7 +681,7 @@ def _learn_cache_check(
cache_age,
delete_existing,
refresh_rules,
): # pylint: disable=too-many-arguments
): # pylint: disable=too-many-arguments,too-many-positional-arguments
learn_exit = False
update_cache = True
if cache_port is not None:
Expand Down Expand Up @@ -726,7 +726,7 @@ def _flood_actions(
away_flood_actions,
toward_flood_actions,
local_flood_actions,
): # pylint: disable=too-many-arguments
): # pylint: disable=too-many-arguments,too-many-positional-arguments
if self.stack_manager.stack.is_root():
if external_ports:
flood_prefix = self._set_nonext_port_flag
Expand Down
Loading

0 comments on commit 1cd46f4

Please sign in to comment.