Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bashi-validate: remove required parameter #21

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions bashi/filter_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,9 @@
which rule.
"""

from typing import Optional, IO, List
from typing import Optional, IO
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 []
from bashi.types import ParameterValueTuple


@typechecked
Expand Down
13 changes: 2 additions & 11 deletions bashi/filter_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,18 @@
which rule.
"""

from typing import Optional, IO, List
from typing import Optional, IO
import packaging.version as pkv
from typeguard import typechecked
from bashi.globals import * # pylint: disable=wildcard-import,unused-wildcard-import
from bashi.types import Parameter, ParameterValueTuple
from bashi.types import ParameterValueTuple
from bashi.versions import NVCC_GCC_MAX_VERSION, NVCC_CLANG_MAX_VERSION
from bashi.utils import reason

# uncomment me for debugging
# from bashi.utils import print_row_nice


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, DEVICE_COMPILER]


@typechecked
def compiler_filter_typechecked(
row: ParameterValueTuple,
Expand Down
13 changes: 2 additions & 11 deletions bashi/filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,9 @@
which rule.
"""

from typing import Optional, IO, List
from typing import Optional, IO
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 []
from bashi.types import ParameterValueTuple


@typechecked
Expand Down
20 changes: 0 additions & 20 deletions bashi/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def get_args() -> Namespace:
def check_single_filter(
filter_func: Callable[[ParameterValueTuple, Optional[IO[str]]], bool],
row: ParameterValueTuple,
required_parameter: List[str],
) -> bool:
"""Check if row passes a filter function.

Expand All @@ -194,8 +193,6 @@ def check_single_filter(
Returns:
bool: True if the row passes the filter.
"""
missing_parameters = ""

# get name of the filter for command line output.
filter_name: str = filter_func.__name__

Expand All @@ -204,20 +201,6 @@ def check_single_filter(
if filter_name.endswith("_typechecked"):
filter_name = filter_name[: -len("_typechecked")]

# check if all required parameter are available
for req_name in required_parameter:
if req_name not in row:
missing_parameters += " " + req_name

if missing_parameters:
print(
cs(
f"skipped {filter_name}(), missing parameters ->" + missing_parameters,
"Yellow",
)
)
return False

msg = io.StringIO()

if filter_func(row, msg):
Expand Down Expand Up @@ -245,21 +228,18 @@ def check_filter_chain(row: ParameterValueTuple) -> bool:
check_single_filter(
bashi.filter_compiler.compiler_filter,
row,
bashi.filter_compiler.get_required_parameters(),
)
)
all_true += int(
check_single_filter(
bashi.filter_backend.backend_filter_typechecked,
row,
bashi.filter_backend.get_required_parameters(),
)
)
all_true += int(
check_single_filter(
bashi.filter_software_dependency.software_dependency_filter_typechecked,
row,
bashi.filter_software_dependency.get_required_parameters(),
)
)

Expand Down
Loading