diff --git a/ax/adapter/transforms/log.py b/ax/adapter/transforms/log.py index bdf5b924ee0..6bd92d21321 100644 --- a/ax/adapter/transforms/log.py +++ b/ax/adapter/transforms/log.py @@ -157,7 +157,6 @@ def untransform_observation_features( if p_name in self.original_values: val = assert_is_instance_of_tuple( min( - # pyrefly: ignore [unsupported-operation] self.original_values[p_name], # pyrefly: ignore [unsupported-operation] key=lambda x: abs(x - val), diff --git a/ax/adapter/transforms/tests/test_cast_transform.py b/ax/adapter/transforms/tests/test_cast_transform.py index 695712a59ef..d41de7085ee 100644 --- a/ax/adapter/transforms/tests/test_cast_transform.py +++ b/ax/adapter/transforms/tests/test_cast_transform.py @@ -490,7 +490,6 @@ def test_transform_experiment_data_cast(self) -> None: .astype({"x": float, "y": float}) ) expected_arm_data["z"] = None - # pyrefly: ignore [missing-attribute] expected_arm_data["z"] = expected_arm_data["z"].astype("Int64") expected_arm_data = expected_arm_data[["x", "y", "z", "metadata"]] assert_frame_equal(transformed.arm_data, expected_arm_data) diff --git a/ax/analysis/utils.py b/ax/analysis/utils.py index 86b8a29b3e9..79353958684 100644 --- a/ax/analysis/utils.py +++ b/ax/analysis/utils.py @@ -1051,7 +1051,6 @@ def _get_status_quo_df( col for col in df.columns if col.endswith("_mean") or col.endswith("_sem") ] status_quo_df = pd.DataFrame(status_quo_rows)[["trial_index", *all_metric_cols]] - # pyrefly: ignore [bad-return] return status_quo_df diff --git a/ax/core/data.py b/ax/core/data.py index b17dfa1f818..b522ec57481 100644 --- a/ax/core/data.py +++ b/ax/core/data.py @@ -871,7 +871,6 @@ def _subsample_one_metric( else: filtered_df = df_g.iloc[:: int(derived_keep_every)] filtered_dfs.append(filtered_df) - # pyrefly: ignore [bad-return] return pd.concat(filtered_dfs) diff --git a/ax/core/utils.py b/ax/core/utils.py index f65c30ae0cc..d04b6e5cf0c 100644 --- a/ax/core/utils.py +++ b/ax/core/utils.py @@ -735,13 +735,12 @@ def _sort_trials( ( _time_trial_completed_safe( trial=t # pyrefly: ignore [bad-argument-type] - ).timestamp() # pyrefly: ignore [bad-argument-type] + ).timestamp() if not trials_are_running else default_time_run_started.timestamp() ) - _time_trial_started_safe( trial=t, # pyrefly: ignore [bad-argument-type] - # pyrefly: ignore [bad-argument-type] default_time_run_started=default_time_run_started, ).timestamp() ) diff --git a/ax/generators/discrete/ashr_utils.py b/ax/generators/discrete/ashr_utils.py index da2134c1058..a0d2c348699 100644 --- a/ax/generators/discrete/ashr_utils.py +++ b/ax/generators/discrete/ashr_utils.py @@ -127,7 +127,6 @@ def fit( lambdas = lambdas.astype(np.float64) results = fit_ashr_em( - # pyrefly: ignore [bad-argument-type] ll=self.ll, # pyrefly: ignore [bad-argument-type] lambdas=lambdas, diff --git a/ax/generators/tests/test_botorch_moo_utils.py b/ax/generators/tests/test_botorch_moo_utils.py index 639514483ed..b5f0273bb3d 100644 --- a/ax/generators/tests/test_botorch_moo_utils.py +++ b/ax/generators/tests/test_botorch_moo_utils.py @@ -219,9 +219,7 @@ def test_get_weighted_mc_objective(self) -> None: weighted_obj = get_weighted_mc_objective( objective_weights=objective_weights, ) - # pyrefly: ignore [bad-argument-type] self.assertTrue(torch.equal(weighted_obj.weights, torch.tensor([1.0, 1.0]))) - # pyrefly: ignore [not-callable] self.assertEqual(weighted_obj.outcomes.tolist(), [1, 3]) # test infer objective thresholds alone diff --git a/ax/generators/torch/tests/test_generator.py b/ax/generators/torch/tests/test_generator.py index 12265fff05d..1bab744a4a0 100644 --- a/ax/generators/torch/tests/test_generator.py +++ b/ax/generators/torch/tests/test_generator.py @@ -195,7 +195,6 @@ def setUp(self) -> None: # pyrefly: ignore [bad-assignment] Keys.OPTIMIZER_KWARGS: self.optimizer_options, Keys.ACQF_KWARGS: {"eta": 3.0}, - # pyrefly: ignore [bad-assignment] Keys.AX_ACQUISITION_KWARGS: {Keys.SUBSET_MODEL: True}, }, ) @@ -1128,7 +1127,6 @@ def test_MOO(self) -> None: self.assertIsInstance(ckwargs["objective"], WeightedMCMultiOutputObjective) self.assertTrue( torch.equal( - # pyrefly: ignore [bad-argument-type] ckwargs["objective"].weights, extract_objectives(self.moo_objective_weights)[1], ) diff --git a/ax/generators/torch/tests/test_kernels.py b/ax/generators/torch/tests/test_kernels.py index 9bc6d466668..9fa0fa85091 100644 --- a/ax/generators/torch/tests/test_kernels.py +++ b/ax/generators/torch/tests/test_kernels.py @@ -63,9 +63,9 @@ def test_scalematern_kernel_active_dims(self) -> None: base_kernel = assert_is_instance(covar.base_kernel, MaternKernel) # active_dims lands on the inner MaternKernel, and the ScaleKernel # inherits it (so subsetting happens exactly once at the wrapper level). - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] self.assertEqual(covar.active_dims.tolist(), active_dims) - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] self.assertEqual(base_kernel.active_dims.tolist(), active_dims) self.assertEqual(base_kernel.ard_num_dims, len(active_dims)) # The kernel only consumes the active columns: perturbing an inactive @@ -121,11 +121,11 @@ def test_scale_rbf_linear_kernel_active_dims(self) -> None: rbf = assert_is_instance(scale_rbf.base_kernel, RBFKernel) # active_dims lands on both leaves, and the ScaleKernel inherits it # from the wrapped RBF kernel (so subsetting happens exactly once). - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] self.assertEqual(scale_rbf.active_dims.tolist(), active_dims) - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] self.assertEqual(rbf.active_dims.tolist(), active_dims) - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] self.assertEqual(linear.active_dims.tolist(), active_dims) # ard_num_dims matches the number of active dims. self.assertEqual(rbf.ard_num_dims, len(active_dims)) @@ -283,9 +283,9 @@ def test_default_kernel(self) -> None: self.assertIsNone(botorch_kernel.active_dims) else: self.assertEqual( - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] ax_kernel.active_dims.tolist(), - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] botorch_kernel.active_dims.tolist(), ) @@ -301,5 +301,5 @@ def test_default_mle(self) -> None: self.assertTrue((kernel.lengthscale == sqrt(2) / 10).all()) self.assertEqual(kernel.lengthscale.shape, torch.Size([3, 1, 2])) self.assertFalse(hasattr(kernel, "lengthscale_prior")) - # pyrefly: ignore [missing-attribute, not-callable] + # pyrefly: ignore [missing-attribute] self.assertEqual(kernel.active_dims.tolist(), active_dims) diff --git a/ax/generators/torch/tests/test_surrogate.py b/ax/generators/torch/tests/test_surrogate.py index 3858dc7f45a..7c2e793dc9a 100644 --- a/ax/generators/torch/tests/test_surrogate.py +++ b/ax/generators/torch/tests/test_surrogate.py @@ -280,7 +280,6 @@ def test__make_botorch_input_transform(self) -> None: dataset=dataset, ) transform = assert_is_instance(transform, Normalize) - # pyrefly: ignore [not-callable] self.assertEqual(transform.indices.tolist(), [0]) self.assertEqual(transform.bounds.tolist(), [[1.0], [5.0]]) diff --git a/ax/generators/types.py b/ax/generators/types.py index f127630d652..464b3bbebd0 100644 --- a/ax/generators/types.py +++ b/ax/generators/types.py @@ -12,7 +12,6 @@ from ax.generators.winsorization_config import WinsorizationConfig from botorch.acquisition import AcquisitionFunction -# pyre-ignore[33]: `TConfig` cannot alias to a type containing `Any`. TConfig = dict[ str, int diff --git a/ax/generators/utils.py b/ax/generators/utils.py index 3a7763f4bbb..aa128f5345a 100644 --- a/ax/generators/utils.py +++ b/ax/generators/utils.py @@ -385,7 +385,6 @@ def best_observed_point( fixed_features=fixed_features, options=options, ) - # pyrefly: ignore [bad-return] return None if best_point_and_value is None else best_point_and_value[0] diff --git a/ax/metrics/tests/test_tensorboard.py b/ax/metrics/tests/test_tensorboard.py index a727a9cfb21..d68bbac5db3 100644 --- a/ax/metrics/tests/test_tensorboard.py +++ b/ax/metrics/tests/test_tensorboard.py @@ -51,7 +51,6 @@ def _get_fake_multiplexer( # pyre-ignore[8] Return fake tags when content is requested mul.PluginRunToTagToContent = lambda plugin: {".": {"loss": ""}} - # pyre-ignore[8] Return fake data when tensors requested mul.Tensors = lambda run, tag: [ _TensorEvent(step=i, tensor_proto=_TensorProto(double_val=[dat])) for i, dat in enumerate(fake_data) diff --git a/ax/plot/helper.py b/ax/plot/helper.py index c7307b6dd5b..a50e5c6340c 100644 --- a/ax/plot/helper.py +++ b/ax/plot/helper.py @@ -252,9 +252,7 @@ def _get_in_sample_arms( cov_dict=obs.data.covariance_matrix, agg_metric_weight_dict=agg_metric["weight"], ) - # pyrefly: ignore [unsupported-operation] obs_y[agg_metric_name] = agg_mean - # pyrefly: ignore [unsupported-operation] obs_se[agg_metric_name] = np.sqrt(agg_var) if training_in_design[i]: # Update with the input fixed features diff --git a/ax/service/tests/test_ax_client.py b/ax/service/tests/test_ax_client.py index e73eed05c72..089e23d4f23 100644 --- a/ax/service/tests/test_ax_client.py +++ b/ax/service/tests/test_ax_client.py @@ -156,7 +156,6 @@ def get_branin_currin_optimization_with_N_sobol_trials( "branin": ObjectiveProperties( minimize=minimize, threshold=( - # pyrefly: ignore [bad-index] float(branin_currin.ref_point[0]) if include_objective_thresholds else None @@ -165,7 +164,6 @@ def get_branin_currin_optimization_with_N_sobol_trials( "currin": ObjectiveProperties( minimize=minimize, threshold=( - # pyrefly: ignore [bad-index] float(branin_currin.ref_point[1]) if include_objective_thresholds else None @@ -3068,9 +3066,7 @@ def helper_test_get_pareto_optimal_points( for obs in observed_pareto.values(): branin: float = obs[1][0]["branin"] currin: float = obs[1][0]["currin"] - # pyrefly: ignore [bad-index] self.assertGreater(branin, branin_currin.ref_point[0].item()) - # pyrefly: ignore [bad-index] self.assertGreater(currin, branin_currin.ref_point[1].item()) if outcome_constraints is not None: self.assertEqual(branin + currin, obs[1][0]["c"]) diff --git a/ax/utils/stats/no_effects.py b/ax/utils/stats/no_effects.py index e2ce5681ad5..6414d5c80da 100644 --- a/ax/utils/stats/no_effects.py +++ b/ax/utils/stats/no_effects.py @@ -173,7 +173,6 @@ def check_experiment_effects( effective = np.min(ps) < no_effect_alpha bounds_df = pd.DataFrame(fx_bounds, columns=["metric_name", "min", "max", "p"]) bounds_df.sort_values(by="p", inplace=True) - # pyrefly: ignore [bad-return] return effective, ineffective_on_objectives, bounds_df