Skip to content

Commit 05cf17a

Browse files
committed
fix issues
1 parent b1a2155 commit 05cf17a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

ultraplot/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
# Exceptions to the automated lazy loading
2828
_LAZY_LOADING_EXCEPTIONS = {
29+
"constructor": ("constructor", None),
2930
"crs": ("proj", None),
3031
"colormaps": ("colors", "_cmap_database"),
3132
"check_for_update": ("utils", "check_for_update"),
@@ -39,7 +40,7 @@
3940
"tests": ("tests", None),
4041
"rcsetup": ("internals", "rcsetup"),
4142
"warnings": ("internals", "warnings"),
42-
"figure": ("figure", "Figure"),
43+
"Figure": ("figure", "Figure"),
4344
}
4445

4546

@@ -212,6 +213,12 @@ def _get_registry_attr(name):
212213

213214
def _load_all():
214215
global _EAGER_DONE
216+
if _EAGER_DONE:
217+
try:
218+
return sorted(globals()["__all__"])
219+
except KeyError:
220+
pass
221+
_EAGER_DONE = True
215222
_setup()
216223
from .internals.benchmarks import _benchmark
217224

@@ -229,7 +236,9 @@ def _load_all():
229236
_build_registry_map()
230237
if _REGISTRY_ATTRS:
231238
names.update(_REGISTRY_ATTRS)
232-
names.update({"__version__", "version", "name"})
239+
names.update(
240+
{"__version__", "version", "name", "setup", "pyplot", "cartopy", "basemap"}
241+
)
233242
_EAGER_DONE = True
234243
return sorted(names)
235244

@@ -264,7 +273,9 @@ def setup(*, eager=None):
264273

265274

266275
def __getattr__(name):
267-
if name in {"pytest_plugins", "__version__", "version", "name", "__all__"}:
276+
if name == "pytest_plugins":
277+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
278+
if name in {"__version__", "version", "name", "__all__"}:
268279
if name == "__all__":
269280
value = _load_all()
270281
globals()["__all__"] = value

ultraplot/tests/test_imshow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import numpy as np
12
import pytest
2-
3-
import ultraplot as plt, numpy as np
43
from matplotlib.testing import setup
54

5+
import ultraplot as plt
6+
67

78
@pytest.fixture()
89
def setup_mpl():
@@ -39,7 +40,6 @@ def test_standardized_input(rng):
3940
axs[1].pcolormesh(xedges, yedges, data)
4041
axs[2].contourf(x, y, data)
4142
axs[3].contourf(xedges, yedges, data)
42-
fig.show()
4343
return fig
4444

4545

0 commit comments

Comments
 (0)