syntax checks applyed

This commit is contained in:
Petr Klima committed 2021-03-08 15:19:04 +01:00
1 parent 484d55867b
commit 4cee65a279
2 files changed
+8 -35

No files matched your search

+7 -24
View File
@@ -99,7 +99,7 @@ class S350Driver(NetworkDriver):
host=self.hostname, host=self.hostname,
username=self.username, username=self.username,
password=self.password, password=self.password,
**self.netmiko_optional_args **self.netmiko_optional_args,
) )
if not self.force_no_enable: if not self.force_no_enable:
self.device.enable() self.device.enable()
@@ -152,12 +152,7 @@ class S350Driver(NetworkDriver):
hours, minutes, seconds = timespec.split(":") hours, minutes, seconds = timespec.split(":")
uptime_sec = ( uptime_sec = (int(days) * 86400) + (int(hours) * 3600) + (int(minutes) * 60) + int(seconds)
(int(days) * 86400)
+ (int(hours) * 3600)
+ (int(minutes) * 60)
+ int(seconds)
)
return uptime_sec return uptime_sec
def get_arp_table(self, vrf=""): def get_arp_table(self, vrf=""):
@@ -242,9 +237,7 @@ class S350Driver(NetworkDriver):
# Do not output sensitive information # Do not output sensitive information
# use Cisco IOS filters # use Cisco IOS filters
configs = napalm.base.helpers.sanitize_configs( configs = napalm.base.helpers.sanitize_configs(configs, C.CISCO_SANITIZE_FILTERS)
configs, C.CISCO_SANITIZE_FILTERS
)
# defina my own filters # defina my own filters
s350_filters = { s350_filters = {
@@ -456,14 +449,8 @@ class S350Driver(NetworkDriver):
# Since the MAC address for all the local ports are equal, get the address # Since the MAC address for all the local ports are equal, get the address
# from the first port and use it everywhere. # from the first port and use it everywhere.
if mac == "0": if mac == "0":
show_system_output = self._send_command( show_system_output = self._send_command("show lldp local " + interface)
"show lldp local " + interface mac = show_system_output.splitlines()[0].split(":", maxsplit=1)[1].strip()
)
mac = (
show_system_output.splitlines()[0]
.split(":", maxsplit=1)[1]
.strip()
)
if speed == "--": if speed == "--":
is_enabled = False is_enabled = False
@@ -531,9 +518,7 @@ class S350Driver(NetworkDriver):
interface = canonical_interface_name(interface, s350_base_interfaces) interface = canonical_interface_name(interface, s350_base_interfaces)
interfaces[interface] = { interfaces[interface] = {family: {str(ip.ip): {"prefix_length": ip.prefixlen}}}
family: {str(ip.ip): {"prefix_length": ip.prefixlen}}
}
return interfaces return interfaces
@@ -643,9 +628,7 @@ class S350Driver(NetworkDriver):
if interface: if interface:
if interface == local_port: if interface == local_port:
entry = self._get_lldp_neighbors_detail_parse(local_port) entry = self._get_lldp_neighbors_detail_parse(local_port)
local_port = canonical_interface_name( local_port = canonical_interface_name(local_port, s350_base_interfaces)
local_port, s350_base_interfaces
)
details[local_port] = [ details[local_port] = [
entry, entry,
] ]
+1 -11
View File
@@ -1,6 +1,6 @@
[tox] [tox]
#envlist = py3{6,7,8},black,pylama,sphinx #envlist = py3{6,7,8},black,pylama,sphinx
envlist = py3{6,7,8},pylama envlist = py3{6,7,8},pylama,black
skip_missing_interpreters = true skip_missing_interpreters = true
[testenv] [testenv]
@@ -13,24 +13,14 @@ commands =
py.test --cov=napalm_s350 --cov-report term-missing -vs {posargs} py.test --cov=napalm_s350 --cov-report term-missing -vs {posargs}
[testenv:black] [testenv:black]
deps =
-rrequirements-dev.txt
commands = commands =
black --check --target-version py36 --line-length 100 --color --diff . black --check --target-version py36 --line-length 100 --color --diff .
[testenv:pylama] [testenv:pylama]
deps =
-rrequirements-dev.txt
commands = commands =
pylama . pylama .
[testenv:sphinx] [testenv:sphinx]
deps =
-rdocs/requirements.txt
commands = commands =
make doctest make doctest