Skip to content

Commit b559f5f

Browse files
committed
Merge remote-tracking branch 'origin/main' into type-hint-runner
2 parents d8d77fe + 28d4c35 commit b559f5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+823
-316
lines changed

.github/workflows/nox.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: nox
33
on:
44
pull_request:
55
push:
6-
branches: [master]
6+
branches: [main]
77

88
jobs:
99
test:

.github/workflows/pre-commit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: pre-commit
33
on:
44
pull_request:
55
push:
6-
branches: [master]
6+
branches: [main]
77

88
jobs:
99
pre-commit:

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
rev: 5.10.1
2222
hooks:
2323
- id: isort
24-
- repo: https://gitlab.com/pycqa/flake8
24+
- repo: https://github.com/pycqa/flake8
2525
rev: 3.9.2
2626
hooks:
2727
- id: flake8

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
# ![logo](https://adaptive.readthedocs.io/en/latest/_static/logo.png) adaptive
44

5-
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/python-adaptive/adaptive/master?filepath=example-notebook.ipynb)
5+
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/python-adaptive/adaptive/main?filepath=example-notebook.ipynb)
66
[![Conda](https://img.shields.io/badge/install%20with-conda-green.svg)](https://anaconda.org/conda-forge/adaptive)
77
[![Coverage](https://img.shields.io/codecov/c/github/python-adaptive/adaptive)](https://codecov.io/gh/python-adaptive/adaptive)
88
[![DOI](https://img.shields.io/badge/doi-10.5281%2Fzenodo.1182437-blue.svg)](https://doi.org/10.5281/zenodo.1182437)
99
[![Documentation](https://readthedocs.org/projects/adaptive/badge/?version=latest)](https://adaptive.readthedocs.io/en/latest/?badge=latest)
1010
[![Downloads](https://img.shields.io/conda/dn/conda-forge/adaptive.svg)](https://anaconda.org/conda-forge/adaptive)
1111
[![GitHub](https://img.shields.io/github/stars/python-adaptive/adaptive.svg?style=social)](https://github.com/python-adaptive/adaptive/stargazers)
1212
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/python-adaptive/adaptive)
13-
[![Pipeline-status](https://dev.azure.com/python-adaptive/adaptive/_apis/build/status/python-adaptive.adaptive?branchName=master)](https://dev.azure.com/python-adaptive/adaptive/_build/latest?definitionId=6?branchName=master)
13+
[![Pipeline-status](https://dev.azure.com/python-adaptive/adaptive/_apis/build/status/python-adaptive.adaptive?branchName=main)](https://dev.azure.com/python-adaptive/adaptive/_build/latest?definitionId=6?branchName=main)
1414
[![PyPI](https://img.shields.io/pypi/v/adaptive.svg)](https://pypi.python.org/pypi/adaptive)
1515

1616
> *Adaptive*: parallel active learning of mathematical functions.
@@ -24,7 +24,7 @@ With just a few lines of code you can evaluate functions on a computing cluster,
2424

2525
`adaptive` excels on computations where each function evaluation takes *at least* ≈50ms due to the overhead of picking potentially interesting points.
2626

27-
Run the `adaptive` example notebook [live on Binder](https://mybinder.org/v2/gh/python-adaptive/adaptive/master?filepath=example-notebook.ipynb) to see examples of how to use `adaptive` or visit the [tutorial on Read the Docs](https://adaptive.readthedocs.io/en/latest/tutorial/tutorial.html).
27+
Run the `adaptive` example notebook [live on Binder](https://mybinder.org/v2/gh/python-adaptive/adaptive/main?filepath=example-notebook.ipynb) to see examples of how to use `adaptive` or visit the [tutorial on Read the Docs](https://adaptive.readthedocs.io/en/latest/tutorial/tutorial.html).
2828

2929
<!-- summary-end -->
3030

@@ -75,7 +75,7 @@ def peak(x, a=0.01):
7575

7676

7777
learner = Learner1D(peak, bounds=(-1, 1))
78-
runner = Runner(learner, goal=lambda l: l.loss() < 0.01)
78+
runner = Runner(learner, loss_goal=0.01)
7979
runner.live_info()
8080
runner.live_plot()
8181
```

RELEASE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bumped.
1818

1919
#### Ensure that all tests pass
2020

21-
For major and minor releases we will be tagging the ``master`` branch.
21+
For major and minor releases we will be tagging the ``main`` branch.
2222
This should be as simple as verifying that the
2323
[latest CI pipeline](https://dev.azure.com/python-adaptive/adaptive/_build)
2424
succeeded.

adaptive/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from contextlib import suppress
22

3-
from adaptive import learner, runner, utils
43
from adaptive._version import __version__
54
from adaptive.learner import (
65
AverageLearner,
@@ -22,6 +21,8 @@
2221
)
2322
from adaptive.runner import AsyncRunner, BlockingRunner, Runner
2423

24+
from adaptive import learner, runner, utils # isort:skip
25+
2526
__all__ = [
2627
"learner",
2728
"runner",

adaptive/learner/average_learner.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from __future__ import annotations
22

33
from math import sqrt
4+
from numbers import Integral as Int
5+
from numbers import Real
46
from typing import Callable
57

68
import cloudpickle
79
import numpy as np
810

911
from adaptive.learner.base_learner import BaseLearner
1012
from adaptive.notebook_integration import ensure_holoviews
11-
from adaptive.types import Float, Int, Real
13+
from adaptive.types import Float
1214
from adaptive.utils import (
1315
assign_defaults,
1416
cache_latest,

adaptive/learner/average_learner1D.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from collections import defaultdict
66
from copy import deepcopy
77
from math import hypot
8+
from numbers import Integral as Int
9+
from numbers import Real
810
from typing import Callable, DefaultDict, Iterable, List, Sequence, Tuple
911

1012
import numpy as np
@@ -14,7 +16,6 @@
1416

1517
from adaptive.learner.learner1D import Learner1D, _get_intervals
1618
from adaptive.notebook_integration import ensure_holoviews
17-
from adaptive.types import Int, Real
1819
from adaptive.utils import assign_defaults, partial_function_from_dataframe
1920

2021
try:
@@ -576,10 +577,10 @@ def tell_many_at_point(self, x: Real, seed_y_mapping: dict[int, Real]) -> None:
576577
self._update_interpolated_loss_in_interval(*interval)
577578
self._oldscale = deepcopy(self._scale)
578579

579-
def _get_data(self) -> dict[Real, Real]:
580+
def _get_data(self) -> dict[Real, dict[Int, Real]]:
580581
return self._data_samples
581582

582-
def _set_data(self, data: dict[Real, Real]) -> None:
583+
def _set_data(self, data: dict[Real, dict[Int, Real]]) -> None:
583584
if data:
584585
for x, samples in data.items():
585586
self.tell_many_at_point(x, samples)

0 commit comments

Comments
 (0)