Skip to content

Commit

Permalink
chore(anta): Make ANTA PEP 561 compatible (#970)
Browse files Browse the repository at this point in the history
* chore(anta): make ANTA PEP 561 compatible

* refactor(anta.tests): use list comprehension

---------

Co-authored-by: Guillaume Mulocher <[email protected]>
  • Loading branch information
mtache and gmuloc authored Dec 18, 2024
1 parent c6bfe69 commit 26bf5fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Empty file added anta/py.typed
Empty file.
13 changes: 6 additions & 7 deletions anta/tests/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ class Input(AntaTest.Input):

def render(self, template: AntaTemplate) -> list[AntaCommand]:
"""Render the template for each host in the input list."""
commands = []
for host in self.inputs.hosts:
# df_bit includes leading space when enabled, empty string when disabled
df_bit = " df-bit" if host.df_bit else ""
command = template.render(destination=host.destination, source=host.source, vrf=host.vrf, repeat=host.repeat, size=host.size, df_bit=df_bit)
commands.append(command)
return commands
return [
template.render(
destination=host.destination, source=host.source, vrf=host.vrf, repeat=host.repeat, size=host.size, df_bit=" df-bit" if host.df_bit else ""
)
for host in self.inputs.hosts
]

@AntaTest.anta_test
def test(self) -> None:
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ Contributing = "https://anta.arista.com/main/contribution/"
[project.scripts]
anta = "anta.cli:cli"

################################
# Tools
################################
[tool.setuptools.packages.find]
include = ["anta*", "asynceapi*"]
namespaces = false

[tool.setuptools.package-data]
"anta" = ["py.typed"]

################################
# Version
################################
Expand Down

0 comments on commit 26bf5fa

Please sign in to comment.