Skip to content

Commit

Permalink
isort
Browse files Browse the repository at this point in the history
  • Loading branch information
mtache committed Jul 5, 2023
1 parent 376ca41 commit 9abdaa7
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 38 deletions.
2 changes: 1 addition & 1 deletion anta/tests/aaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Any, Dict, List, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import logging

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
7 changes: 3 additions & 4 deletions anta/tests/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import logging

from anta.models import AntaTest, AntaTemplate
from anta.models import AntaTemplate, AntaTest

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -34,11 +34,10 @@ def test(self) -> None:
failures = []

for command in self.instance_commands:
if command.template and command.template.vars and \
('src' and 'dst') in command.template.vars:
if command.template and command.template.vars and ("src" and "dst") in command.template.vars:
src, dst = command.template.vars["src"], command.template.vars["dst"]
else:
self.result.is_error('The destination IP(s) or the source interface/IP(s) are not provided as template_params')
self.result.is_error("The destination IP(s) or the source interface/IP(s) are not provided as template_params")
return

if "2 received" not in command.json_output["messages"][0]:
Expand Down
2 changes: 1 addition & 1 deletion anta/tests/field_notices.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Dict, cast

from anta.decorators import skip_on_platforms
from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Any, Dict, List, Optional, cast

from anta.decorators import skip_on_platforms
from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
9 changes: 4 additions & 5 deletions anta/tests/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Dict, List, Optional, cast

from anta.decorators import skip_on_platforms
from anta.models import AntaTest, AntaCommand, AntaTemplate
from anta.models import AntaCommand, AntaTemplate, AntaTest

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -401,11 +401,10 @@ def test(self) -> None:

disabled_intf = []
for command in self.instance_commands:
if command.template and command.template.vars and \
'intf' in command.template.vars:
intf = command.template.vars['intf']
if command.template and command.template.vars and "intf" in command.template.vars:
intf = command.template.vars["intf"]
else:
self.result.is_error('A list of interface(s) is not provided as template_params')
self.result.is_error("A list of interface(s) is not provided as template_params")
return
logger.debug(command)
if not command.json_output["interfaces"][intf]["proxyArp"]:
Expand Down
2 changes: 1 addition & 1 deletion anta/tests/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import re
from typing import Any, Dict, List, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/mlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from typing import Any, Dict, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/multicast.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from typing import Any, Dict, List, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Dict, Optional, cast

from anta.decorators import skip_on_platforms
from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
9 changes: 4 additions & 5 deletions anta/tests/routing/bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Dict, Optional, cast

from anta.decorators import check_bgp_family_enable
from anta.models import AntaTest, AntaCommand, AntaTemplate
from anta.models import AntaCommand, AntaTemplate, AntaTest

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -105,11 +105,10 @@ def test(self, number: Optional[int] = None) -> None:
self.result.is_success()

for command in self.instance_commands:
if command.template and command.template.vars and \
"vrf" in command.template.vars:
vrf = command.template.vars['vrf']
if command.template and command.template.vars and "vrf" in command.template.vars:
vrf = command.template.vars["vrf"]
else:
self.result.is_error('A list of VRF(s) is not provided as template_params')
self.result.is_error("A list of VRF(s) is not provided as template_params")
return

peers = command.json_output["vrfs"][vrf]["peers"]
Expand Down
2 changes: 1 addition & 1 deletion anta/tests/routing/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from typing import Any, Dict, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/routing/ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Any, Dict, List, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Any, Dict, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/snmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Any, Dict, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/software.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from typing import Any, Dict, List, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
16 changes: 7 additions & 9 deletions anta/tests/stp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Any, Dict, List, Optional, cast

from anta.models import AntaTest, AntaCommand, AntaTemplate
from anta.models import AntaCommand, AntaTemplate, AntaTest
from anta.tools.get_value import get_value

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -58,11 +58,10 @@ def test(self, mode: str = "mstp") -> None:
self.result.is_success()

for command in self.instance_commands:
if command.template and command.template.vars and \
"vlan" in command.template.vars:
vlan_id = command.template.vars['vlan']
if command.template and command.template.vars and "vlan" in command.template.vars:
vlan_id = command.template.vars["vlan"]
else:
self.result.is_error('A list of VLAN(s) is not provided as template_params')
self.result.is_error("A list of VLAN(s) is not provided as template_params")
return
if not (stp_mode := get_value(command.json_output, f"spanningTreeVlanInstances.{vlan_id}.spanningTreeVlanInstance.protocol")):
self.result.is_failure(f"STP mode '{mode}' not configured for VLAN {vlan_id}")
Expand Down Expand Up @@ -157,11 +156,10 @@ def test(self) -> None:
self.result.is_success()

for command in self.instance_commands:
if command.template and command.template.vars and \
"vlan" in command.template.vars:
vlan_id = command.template.vars['vlan']
if command.template and command.template.vars and "vlan" in command.template.vars:
vlan_id = command.template.vars["vlan"]
else:
self.result.is_error('A list of VLAN(s) is not provided as template_params')
self.result.is_error("A list of VLAN(s) is not provided as template_params")
return

if not (topologies := get_value(command.json_output, "topologies")):
Expand Down
2 changes: 1 addition & 1 deletion anta/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Any, Dict, List, Optional, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion anta/tests/vxlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from typing import Any, Dict, cast

from anta.models import AntaTest, AntaCommand
from anta.models import AntaCommand, AntaTest

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 9abdaa7

Please sign in to comment.