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

Fix code #2670

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion ax/utils/common/kwargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
from ax.utils.common.logger import get_logger
from ax.utils.common.typeutils_nonnative import version_safe_check_type

try:
# pyre-fixme[21]: Could not find name `TypeCheckError` in `typeguard`.
from typeguard import TypeCheckError
except ImportError:
TypeCheckError = TypeError

logger: Logger = get_logger(__name__)

TKwargs = dict[str, Any]
Expand Down Expand Up @@ -86,7 +92,9 @@ def validate_kwarg_typing(typed_callables: list[Callable], **kwargs: Any) -> Non
if not (callable(kw_val) and callable(param.annotation)):
try:
version_safe_check_type(kw, kw_val, param.annotation)
except TypeError:
# pyre-fixme[16]: Module `typeguard` has no attribute
# `TypeCheckError`.
except TypeCheckError:
message = (
f"`{typed_callable}` expected argument `{kw}` to be of"
f" type {param.annotation}. Got {kw_val}"
Expand Down
Loading