-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixes currently release version of cartopy #12131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,18 @@ def _make_twin_axes(self, *kl, **kwargs): | |
return ax2 | ||
|
||
|
||
# this here to support cartopy which was using a private part of the | ||
# API to register their Axes subclasses. | ||
|
||
# In 3.1 this should be changed to a dict subclass that warns on use | ||
# In 3.3 to a dict subclass that raises a useful exception on use | ||
# In 3.4 should be removed | ||
|
||
# The slow timeline is to give cartopy enough time to get several | ||
# release out before we break them. | ||
_subplot_classes = {} | ||
|
||
|
||
@functools.lru_cache(None) | ||
def subplot_class_factory(axes_class=None): | ||
""" | ||
|
@@ -198,9 +210,16 @@ def subplot_class_factory(axes_class=None): | |
""" | ||
if axes_class is None: | ||
axes_class = Axes | ||
return type("%sSubplot" % axes_class.__name__, | ||
(SubplotBase, axes_class), | ||
{'_axes_class': axes_class}) | ||
try: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this might be clearer if you use a for / else loop. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm indifferent either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, for/else would be clearer, but since this is a temporary workaround I don‘t care too much. |
||
# Avoid creating two different instances of GeoAxesSubplot... | ||
# Only a temporary backcompat fix. This should be removed in | ||
# 3.4 | ||
return next(cls for cls in SubplotBase.__subclasses__() | ||
if cls.__bases__ == (SubplotBase, axes_class)) | ||
except StopIteration: | ||
return type("%sSubplot" % axes_class.__name__, | ||
(SubplotBase, axes_class), | ||
{'_axes_class': axes_class}) | ||
|
||
|
||
# This is provided for backward compatibility | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not start warning on use in this version? Warning is basically free after all and it gives more notice.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there is not a released version of cartopy with the fix on their side yet. I don't want to warn at their users and give them no way to fix it.
[corrected typo]