Repository: scikit-learn/scikit-learn
File: sklearn/manifold/_mds.py (Python)

Code before:
                FutureWarning,
            )

        if type(self.metric) == type(True) and self.metric:
            warnings.warn(
                "Use metric_mds='True' instead of metric='True'. The support for "
                "metric='True' will be dropped in 1.10",
                FutureWarning,
            )
            self._metric = "euclidean"
            self._metric_mds = True
        elif type(self.metric) == type(True) and not self.metric:
            warnings.warn(
                "Use metric_mds='False' instead of metric='False'. The support for "
                "metric='False' will be dropped in 1.10",
                FutureWarning,
            )
            self._metric = "euclidean"
            self._metric_mds = False
        else:
            self._metric = self.metric
            self._metric_mds = self.metric_mds

        X = validate_data(self, X)
        if X.shape[0] == X.shape[1] and (
            (self.dissimilarity != "precomputed") and (self._metric != "precomputed")
        ):
            warnings.warn(
                "The MDS API has changed. ``fit`` now constructs a"
                " dissimilarity matrix from data. To use a custom "
                "dissimilarity matrix, set "
                "``metric='precomputed'``."
            )

        if self.dissimilarity == "precomputed":
            self.dissimilarity_matrix_ = X
            self.dissimilarity_matrix_ = check_symmetric(
                self.dissimilarity_matrix_, raise_exception=True
            )
        elif self._metric == "precomputed":
            self.dissimilarity_matrix_ = X
            self.dissimilarity_matrix_ = check_symmetric(
                self.dissimilarity_matrix_, raise_exception=True
            )
        else:
            self.dissimilarity_matrix_ = pairwise_distances(
                X,
                metric=self._metric,
                **(self.metric_params if self.metric_params is not None else {}),
            )


Review comment (suggestion):
we should make sure dissimilarity and metric are not both provided, and by the time we get to this part of the code, we should only use the variable which has the effective value, not both.

Code after:

        if self.dissimilarity != "deprecated":
            if not isinstance(self.metric, bool) and self.metric != "euclidean":
                raise ValueError(
                    "You provided both `dissimilarity` and `metric`. Please use "
                    "only `metric`."
                )
            else:
                warnings.warn(
                    "The `dissimilarity` parameter is deprecated and will be "
                    "removed in 1.10. Use `metric` instead.",
                    FutureWarning,
                )
                self._metric = self.dissimilarity

        if isinstance(self.metric, bool):
            warnings.warn(
                f"Use metric_mds={self.metric} instead of metric={self.metric}. The "
                "support for metric={True/False} will be dropped in 1.10.",
                FutureWarning,
            )
            if self.dissimilarity == "deprecated":
                self._metric = "euclidean"
            self._metric_mds = self.metric
        else:
            if self.dissimilarity == "deprecated":
                self._metric = self.metric
            self._metric_mds = self.metric_mds

        X = validate_data(self, X)
        if X.shape[0] == X.shape[1] and self._metric != "precomputed":
            warnings.warn(
                "The provided input is a square matrix. Note that ``fit`` constructs "
                "a dissimilarity matrix from data and will treat rows as samples "
                "and columns as features. To use a pre-computed dissimilarity matrix, "
                "set ``metric='precomputed'``."
            )

        if self._metric == "precomputed":
            self.dissimilarity_matrix_ = X
            self.dissimilarity_matrix_ = check_symmetric(
                self.dissimilarity_matrix_, raise_exception=True
            )
        else:
            self.dissimilarity_matrix_ = pairwise_distances(
                X,
                metric=self._metric,
                **(self.metric_params if self.metric_params is not None else {}),
            )

        if init is not None: