Skip to content

Commit

Permalink
Update black to a newer version (#1940)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers authored May 23, 2023
1 parent 057cb2c commit 50ab9f7
Show file tree
Hide file tree
Showing 22 changed files with 5 additions and 120 deletions.
10 changes: 0 additions & 10 deletions napalm/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,6 @@ def get_bgp_config(
def cli(
self, commands: List[str], encoding: str = "text"
) -> Dict[str, Union[str, Dict[str, Any]]]:

"""
Will execute a list of commands and return the output in a dictionary format.
Expand Down Expand Up @@ -772,7 +771,6 @@ def cli(
def get_bgp_neighbors_detail(
self, neighbor_address: str = ""
) -> Dict[str, models.PeerDetailsDict]:

"""
Returns a detailed view of the BGP neighbors as a dictionary of lists.
Expand Down Expand Up @@ -867,7 +865,6 @@ def get_bgp_neighbors_detail(
raise NotImplementedError

def get_arp_table(self, vrf: str = "") -> List[models.ARPTableDict]:

"""
Returns a list of dictionaries having the following set of keys:
* interface (string)
Expand Down Expand Up @@ -902,7 +899,6 @@ def get_arp_table(self, vrf: str = "") -> List[models.ARPTableDict]:
raise NotImplementedError

def get_ntp_peers(self) -> Dict[str, models.NTPPeerDict]:

"""
Returns the NTP peers configuration as dictionary.
The keys of the dictionary represent the IP Addresses of the peers.
Expand All @@ -922,7 +918,6 @@ def get_ntp_peers(self) -> Dict[str, models.NTPPeerDict]:
raise NotImplementedError

def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]:

"""
Returns the NTP servers configuration as dictionary.
The keys of the dictionary represent the IP Addresses of the servers.
Expand All @@ -942,7 +937,6 @@ def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]:
raise NotImplementedError

def get_ntp_stats(self) -> List[models.NTPStats]:

"""
Returns a list of NTP synchronization statistics.
Expand Down Expand Up @@ -979,7 +973,6 @@ def get_ntp_stats(self) -> List[models.NTPStats]:
raise NotImplementedError

def get_interfaces_ip(self) -> Dict[str, models.InterfacesIPDict]:

"""
Returns all configured IP addresses on all interfaces as a dictionary of dictionaries.
Keys of the main dictionary represent the name of the interface.
Expand Down Expand Up @@ -1033,7 +1026,6 @@ def get_interfaces_ip(self) -> Dict[str, models.InterfacesIPDict]:
raise NotImplementedError

def get_mac_address_table(self) -> List[models.MACAdressTable]:

"""
Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address
Table, having the following keys:
Expand Down Expand Up @@ -1086,7 +1078,6 @@ def get_mac_address_table(self) -> List[models.MACAdressTable]:
def get_route_to(
self, destination: str = "", protocol: str = "", longer: bool = False
) -> Dict[str, models.RouteDict]:

"""
Returns a dictionary of dictionaries containing details of all available routes to a
destination.
Expand Down Expand Up @@ -1161,7 +1152,6 @@ def get_route_to(
raise NotImplementedError

def get_snmp_information(self) -> models.SNMPDict:

"""
Returns a dict of dicts containing SNMP configuration.
Each inner dictionary contains these fields
Expand Down
1 change: 0 additions & 1 deletion napalm/base/clitools/cl_napalm_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
def run(
vendor, hostname, user, password, strategy, optional_args, config_file, dry_run
):

logger.debug('Getting driver for OS "{driver}"'.format(driver=vendor))
driver = get_network_driver(vendor)

Expand Down
4 changes: 0 additions & 4 deletions napalm/base/test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ def test_ping(self):
self.assertTrue(result)

def test_traceroute(self):

destination = "8.8.8.8"
try:
get_traceroute = self.device.traceroute(destination)
Expand All @@ -547,7 +546,6 @@ def test_traceroute(self):
self.assertTrue(result)

def test_get_users(self):

try:
get_users = self.device.get_users()
except NotImplementedError:
Expand All @@ -561,7 +559,6 @@ def test_get_users(self):
self.assertTrue(result)

def test_get_optics(self):

try:
get_optics = self.device.get_optics()
except NotImplementedError:
Expand All @@ -575,7 +572,6 @@ def test_get_optics(self):
assert len(channel) == 2
assert isinstance(channel["index"], int)
for field in ["input_power", "output_power", "laser_bias_current"]:

assert len(channel["state"][field]) == 4
assert isinstance(channel["state"][field]["instant"], float)
assert isinstance(channel["state"][field]["avg"], float)
Expand Down
4 changes: 2 additions & 2 deletions napalm/base/test/getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ def test_method_signatures(self):
"""
Test that all methods have the same signature.
The type hint annotations are ignored here because the import paths might differ."""
The type hint annotations are ignored here because the import paths might differ.
"""
errors = {}
cls = self.driver
# Create fictional driver instance (py3 needs bound methods)
Expand Down Expand Up @@ -493,7 +494,6 @@ def test_get_optics(self, test_case):
assert len(channel) == 2
assert isinstance(channel["index"], int)
for field in ["input_power", "output_power", "laser_bias_current"]:

assert len(channel["state"][field]) == 4
assert isinstance(channel["state"][field]["instant"], float)
assert isinstance(channel["state"][field]["avg"], float)
Expand Down
10 changes: 0 additions & 10 deletions napalm/eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,6 @@ def _transform_lldp_capab(self, capabilities):
return sorted([LLDP_CAPAB_TRANFORM_TABLE[c.lower()] for c in capabilities])

def get_lldp_neighbors_detail(self, interface=""):

lldp_neighbors_out = {}

filters = []
Expand Down Expand Up @@ -1085,7 +1084,6 @@ def default_neighbor_dict(local_as, group_dict):
return neighbor_dict

def parse_options(options, default_value=False):

if not options:
return {}

Expand Down Expand Up @@ -1330,7 +1328,6 @@ def get_ntp_stats(self):
return ntp_stats

def get_interfaces_ip(self):

interfaces_ip = {}

interfaces_ipv4_out = self._run_commands(["show ip interface"])[0]["interfaces"]
Expand Down Expand Up @@ -1427,7 +1424,6 @@ def get_interfaces_ip(self):
return interfaces_ip

def get_mac_address_table(self):

mac_table = []

commands = ["show mac address-table"]
Expand Down Expand Up @@ -1725,7 +1721,6 @@ def traceroute(
timeout=c.TRACEROUTE_TIMEOUT,
vrf=c.TRACEROUTE_VRF,
):

_HOP_ENTRY_PROBE = [
r"\s+",
r"(", # beginning of host_name (ip_address) RTT group
Expand Down Expand Up @@ -1882,7 +1877,6 @@ def _parse_per_peer_bgp_detail(peer_output):
)

for item in peer_info:

# Determining a few other fields in the final peer_info
item["up"] = True if item["up"] == "up" else False
item["local_address_configured"] = (
Expand Down Expand Up @@ -1942,7 +1936,6 @@ def _parse_per_peer_bgp_detail(peer_output):
return peer_details

def _append(bgp_dict, peer_info):

remote_as = peer_info["remote_as"]
vrf_name = peer_info["routing_table"]

Expand Down Expand Up @@ -1995,7 +1988,6 @@ def _append(bgp_dict, peer_info):
v6_peer_info = _parse_per_peer_bgp_detail(raw_output[1]["output"])

for peer_info in v4_peer_info:

vrf_name = peer_info["routing_table"]
peer_remote_addr = peer_info["remote_address"]
peer_info["accepted_prefix_count"] = (
Expand All @@ -2009,7 +2001,6 @@ def _append(bgp_dict, peer_info):
_append(bgp_detail_info, peer_info)

for peer_info in v6_peer_info:

vrf_name = peer_info["routing_table"]
peer_remote_addr = peer_info["remote_address"]
peer_info["accepted_prefix_count"] = (
Expand All @@ -2025,7 +2016,6 @@ def _append(bgp_dict, peer_info):
return bgp_detail_info

def get_optics(self):

command = ["show interfaces transceiver"]

output = self._run_commands(command, encoding="json")[0]["interfaces"]
Expand Down
6 changes: 1 addition & 5 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ def _xfer_file(
use_scp = False

with TransferClass(**kwargs) as transfer:

# Check if file already exists and has correct MD5
if transfer.check_file_exists() and transfer.compare_md5():
msg = "File already exists and has correct MD5: no SCP needed"
Expand Down Expand Up @@ -1220,7 +1219,6 @@ def get_interfaces(self):

interface_dict = {}
for line in output.splitlines():

interface_regex_1 = r"^(\S+?)\s+is\s+(.+?),\s+line\s+protocol\s+is\s+(\S+)"
interface_regex_2 = r"^(\S+)\s+is\s+(up|down)"
interface_regex_3 = (
Expand Down Expand Up @@ -3135,7 +3133,7 @@ def get_route_to(self, destination="", protocol="", longer=False):
for cmditem in commands:
outvrf = self._send_command(cmditem)
output.append(outvrf)
for (outitem, _vrf) in zip(output, vrfs): # for all VRFs
for outitem, _vrf in zip(output, vrfs): # for all VRFs
route_proto_regex = RE_RP_FROM.search(outitem)
if route_proto_regex:
route_match = destination
Expand Down Expand Up @@ -3550,7 +3548,6 @@ def traceroute(
return traceroute_dict

def get_network_instances(self, name=""):

instances = {}
sh_vrf_detail = self._send_command("show vrf detail")
show_ip_int_br = self._send_command("show ip interface brief")
Expand Down Expand Up @@ -3583,7 +3580,6 @@ def get_network_instances(self, name=""):
return instances

for vrf in sh_vrf_detail.split("\n\n"):

first_part = vrf.split("Address family")[0]

# retrieve the name of the VRF and the Route Distinguisher
Expand Down
Loading

0 comments on commit 50ab9f7

Please sign in to comment.