Skip to content
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

BUG: hotfix for a functional breakage introduced in #3546 #3692

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions yt/visualization/plot_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import warnings
from functools import wraps
from numbers import Number
from typing import Tuple
from typing import Optional, Tuple

import matplotlib
import numpy as np
Expand Down Expand Up @@ -55,7 +55,7 @@ class PlotCallback:
# "figure" this is disregarded. If "force" is included in the tuple, it
# will *not* check whether or not the coord_system is in axis or figure,
# and will only look at the geometries.
_supported_geometries: Tuple[str, ...]
_supported_geometries: Optional[Tuple[str, ...]] = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the Optional is so that it's not required to be defined in subclasses, right? Not that it isn't required to be defined as an attribute? This is rather frustrating if this is the case, because if that is correct, it seems like it may be pointless to have anything in a base class that is typed as anything other than Optional. Is that the case?

Copy link
Member Author

@neutrinoceros neutrinoceros Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not. Optional[Tuple] is short for Union[None, Tuple], but the name is indeed confusing. It's going away in Python 3.10 where we can replace it with None | Tuple, so we don't have to live with it for ever.


def __init_subclass__(cls, *args, **kwargs):
super().__init_subclass__(*args, **kwargs)
Expand Down