Skip to content

Commit

Permalink
implement validation tool to check if parameter-value-tuple passes th…
Browse files Browse the repository at this point in the history
…e bashi filters
  • Loading branch information
SimeonEhrig committed Feb 8, 2024
1 parent 4decd5a commit 5cf7e4a
Show file tree
Hide file tree
Showing 10 changed files with 564 additions and 23 deletions.
25 changes: 23 additions & 2 deletions bashi/filter_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,29 @@
which rule.
"""

from typing import Optional, IO
from bashi.types import ParameterValueTuple
from typing import Optional, IO, List
from typeguard import typechecked
from bashi.types import Parameter, ParameterValueTuple


def get_required_parameters() -> List[Parameter]:
"""Return list of parameters which will be checked in the filter.
Returns:
List[Parameter]: list of checked parameters
"""
return []


@typechecked
def backend_filter_typechecked(
row: ParameterValueTuple,
output: Optional[IO[str]] = None,
) -> bool:
"""Type-checked version of backend_filter(). Type checking has a big performance cost, which is
why the non type-checked version is used for the pairwise generator.
"""
return backend_filter(row, output)


def backend_filter(
Expand Down
23 changes: 22 additions & 1 deletion bashi/filter_compiler_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,32 @@
"""

from typing import Optional, IO
from bashi.types import ParameterValueTuple
from typeguard import typechecked
from bashi.types import Parameter, ParameterValueTuple
from bashi.globals import * # pylint: disable=wildcard-import,unused-wildcard-import
from bashi.utils import reason


def get_required_parameters() -> List[Parameter]:
"""Return list of parameters which will be checked in the filter.
Returns:
List[Parameter]: list of checked parameters
"""
return [HOST_COMPILER]


@typechecked
def compiler_name_filter_typechecked(
row: ParameterValueTuple,
output: Optional[IO[str]] = None,
) -> bool:
"""Type-checked version of compiler_name_filter(). Type checking has a big performance cost,
which is why the non type-checked version is used for the pairwise generator.
"""
return compiler_name_filter(row, output)


def compiler_name_filter(
row: ParameterValueTuple,
output: Optional[IO[str]] = None,
Expand Down
25 changes: 23 additions & 2 deletions bashi/filter_compiler_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,29 @@
which rule.
"""

from typing import Optional, IO
from bashi.types import ParameterValueTuple
from typing import Optional, IO, List
from typeguard import typechecked
from bashi.types import Parameter, ParameterValueTuple


def get_required_parameters() -> List[Parameter]:
"""Return list of parameters which will be checked in the filter.
Returns:
List[Parameter]: list of checked parameters
"""
return []


@typechecked
def compiler_version_filter_typechecked(
row: ParameterValueTuple,
output: Optional[IO[str]] = None,
) -> bool:
"""Type-checked version of compiler_version_filter(). Type checking has a big performance cost,
which is why the non type-checked version is used for the pairwise generator.
"""
return compiler_version_filter(row, output)


def compiler_version_filter(
Expand Down
25 changes: 23 additions & 2 deletions bashi/filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,29 @@
which rule.
"""

from typing import Optional, IO
from bashi.types import ParameterValueTuple
from typing import Optional, IO, List
from typeguard import typechecked
from bashi.types import Parameter, ParameterValueTuple


def get_required_parameters() -> List[Parameter]:
"""Return list of parameters which will be checked in the filter.
Returns:
List[Parameter]: list of checked parameters
"""
return []


@typechecked
def software_dependency_filter_typechecked(
row: ParameterValueTuple,
output: Optional[IO[str]] = None,
) -> bool:
"""Type-checked version of software_dependency_filter(). Type checking has a big performance
cost, which is why the non type-checked version is used for the pairwise generator.
"""
return software_dependency_filter(row, output)


def software_dependency_filter(
Expand Down
Loading

0 comments on commit 5cf7e4a

Please sign in to comment.