Skip to content

Commit 9cb3e1f

Browse files
committed
make simple Dict, only works in Py≥3.9 before
1 parent e69ab2d commit 9cb3e1f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

adaptive/learner/average_learner1D.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ def __init__(
108108
self._undersampled_points: Set[Real] = set()
109109
# Contains the error in the estimate of the
110110
# mean at each point x in the form {x0: error(x0), ...}
111-
self.error: ItemSortedDict[Real, float] = decreasing_dict()
111+
self.error: Dict[Real, float] = decreasing_dict()
112112
#  Distance between two neighboring points in the
113113
# form {xi: ((xii-xi)^2 + (yii-yi)^2)^0.5, ...}
114-
self._distances: ItemSortedDict[Real, float] = decreasing_dict()
114+
self._distances: Dict[Real, float] = decreasing_dict()
115115
# {xii: error[xii]/min(_distances[xi], _distances[xii], ...}
116-
self.rescaled_error: ItemSortedDict[Real, float] = decreasing_dict()
116+
self.rescaled_error: Dict[Real, float] = decreasing_dict()
117117

118118
@property
119119
def nsamples(self) -> int:
@@ -444,10 +444,10 @@ def tell_many_at_point(self, x: Real, seed_y_mapping: Dict[int, Real]) -> None:
444444
self._update_interpolated_loss_in_interval(*interval)
445445
self._oldscale = deepcopy(self._scale)
446446

447-
def _get_data(self) -> SortedDict[Real, Real]:
447+
def _get_data(self) -> Dict[Real, Real]:
448448
return self._data_samples
449449

450-
def _set_data(self, data: SortedDict[Real, Real]) -> None:
450+
def _set_data(self, data: Dict[Real, Real]) -> None:
451451
if data:
452452
for x, samples in data.items():
453453
self.tell_many_at_point(x, samples)
@@ -481,7 +481,7 @@ def plot(self):
481481
return p.redim(x=dict(range=plot_bounds))
482482

483483

484-
def decreasing_dict() -> ItemSortedDict:
484+
def decreasing_dict() -> Dict:
485485
"""This initialization orders the dictionary from large to small values"""
486486

487487
def sorting_rule(key, value):

0 commit comments

Comments
 (0)