Skip to content

Commit

Permalink
Update pyre version for ax
Browse files Browse the repository at this point in the history
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D15304005

fbshipit-source-id: f3f780852530cfb50df784309fa4e3882e0b6199
  • Loading branch information
generatedunixname89002005289445 authored and facebook-github-bot committed May 11, 2019
1 parent 9f16cca commit 2278ee9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion ax/models/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ def as_array(
elif isinstance(x, np.ndarray):
return x
elif torch.is_tensor(x):
# pyre-fixme[16]: `torch.Tensor` has no attribute `detach`
return x.detach().cpu().double().numpy()
else:
raise ValueError(
Expand Down
5 changes: 5 additions & 0 deletions ax/service/utils/instantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def _make_range_param(
return RangeParameter(
name=name,
parameter_type=_to_parameter_type(bounds, parameter_type, name, "bounds"),
# pyre-fixme[6]: Expected `float` for 3rd param but got
# `Optional[Union[bool, float, int, str]]`.
lower=bounds[0],
upper=bounds[1],
log_scale=representation.get("log_scale", False),
Expand All @@ -89,6 +91,9 @@ def _make_choice_param(
name=name,
parameter_type=_to_parameter_type(values, parameter_type, name, "values"),
values=values,
# pyre-fixme[6]: Expected `bool` for 4th param but got
# `Optional[Union[List[Optional[Union[bool, float, int, str]]], bool, float,
# int, str]]`.
is_ordered=representation.get("is_ordered", False),
)

Expand Down
2 changes: 0 additions & 2 deletions ax/storage/sqa_store/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ def search_space_to_sqa(
ParameterConstraints.
"""
if search_space is None:
# pyre-fixme[7]: Expected `Tuple[List[SQAParameter],
# List[SQAParameterConstraint]]` but got `Tuple[List[_T], List[_T]]`.
return [], []

parameters = [
Expand Down
3 changes: 2 additions & 1 deletion ax/utils/common/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def __exit__(

# Instead of showing a warning (like in the standard library) we throw an error when
# deprecated functions are called.
# pyre-fixme[3]: Return annotation cannot contain `Any`.
# pyre-fixme[2]: Parameter annotation cannot contain `Any`.
def _deprecate(original_func: Callable) -> Callable:
def _deprecated_func(*args: List[Any], **kwargs: Dict[str, Any]) -> None:
raise RuntimeError(
Expand Down Expand Up @@ -138,7 +140,6 @@ def silence_stderr() -> Generator[None, None, None]:
sys.stderr = new_err
yield
except Exception:
# pyre-fixme[6]: Expected `Optional[_Writer]` for 2nd param but got `Text...
print(new_err.getvalue(), file=old_err, flush=True)
raise
finally:
Expand Down

0 comments on commit 2278ee9

Please sign in to comment.