Skip to content

Commit 4761470

Browse files
Balandatmeta-codesync[bot]
authored andcommitted
Phase 1: Replace typing_extensions.Self with typing.Self (#4867)
Summary: Pull Request resolved: #4867 Migrate Self type hint from typing_extensions to the standard library typing module, which is available in Python 3.11+. Files changed: - ax/fb/api/internal_client.py - ax/core/base_trial.py - ax/api/client.py - ax/utils/testing/core_stubs.py Reviewed By: mpolson64 Differential Revision: D91648884 fbshipit-source-id: 62e65746d9b8b3fe9319715148b7db3859ee6abd
1 parent cf654b1 commit 4761470

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

ax/api/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import json
99
from collections.abc import Iterable, Sequence
1010
from logging import Logger
11-
from typing import Any, Literal
11+
from typing import Any, Literal, Self
1212

1313
import numpy as np
1414
import pandas as pd
@@ -62,7 +62,6 @@
6262
from ax.utils.common.logger import _round_floats_for_logging, get_logger
6363
from ax.utils.common.random import with_rng_seed
6464
from pyre_extensions import assert_is_instance, none_throws
65-
from typing_extensions import Self
6665

6766
logger: Logger = get_logger(__name__)
6867
ROUND_FLOATS_IN_LOGS_TO_DECIMAL_PLACES: int = 6

ax/core/base_trial.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from collections.abc import Callable
1313
from copy import deepcopy
1414
from datetime import datetime, timedelta
15-
from typing import Any, TYPE_CHECKING
15+
from typing import Any, Self, TYPE_CHECKING
1616

1717
from ax.core.arm import Arm
1818
from ax.core.data import Data
@@ -26,7 +26,6 @@
2626
from ax.utils.common.base import SortableBase
2727
from ax.utils.common.constants import Keys
2828
from pyre_extensions import none_throws
29-
from typing_extensions import Self
3029

3130

3231
if TYPE_CHECKING:

ax/utils/testing/core_stubs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from logging import Logger
1818
from math import prod
1919
from pathlib import Path
20-
from typing import Any, cast, Sequence
20+
from typing import Any, cast, Self, Sequence
2121

2222
import numpy as np
2323
import pandas as pd
@@ -130,7 +130,6 @@
130130
from gpytorch.mlls.marginal_log_likelihood import MarginalLogLikelihood
131131
from gpytorch.priors.torch_priors import GammaPrior, LogNormalPrior
132132
from pyre_extensions import assert_is_instance, none_throws
133-
from typing_extensions import Self
134133

135134
logger: Logger = get_logger(__name__)
136135

0 commit comments

Comments
 (0)