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" ),
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
213214def _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
266275def __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
0 commit comments