Skip to content
Open
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: 3 additions & 1 deletion xarray/core/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def __get__(self, obj, cls):

def _register_accessor(name, cls):
def decorator(accessor):
if hasattr(cls, name):
# Only check for existing attribute if Warn will actually be issued
existing = getattr(cls, name, None)
if existing is not None:
warnings.warn(
f"registration of accessor {accessor!r} under name {name!r} for type {cls!r} is "
"overriding a preexisting attribute with the same name.",
Expand Down