Skip to content

Commit

Permalink
Clarify result testing in metadata operations decorator.
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo committed Nov 15, 2023
1 parent dca5dce commit b00b37f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/iris/common/_split_attribute_dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def _inner_function(*args, **kwargs):

result = operation(*args, **kwargs)

# Convert 'pairedkeys' dicts in the result back to split-attributes form.
# Convert known specific cases of 'pairedkeys' dicts in the result, and convert
# those back into split-attribute dictionaries.
if isinstance(result, Mapping):
# Fix a result which is a single dictionary -- for "combine"
result = _convert_pairedkeys_dict_to_splitattrs(result)
Expand All @@ -117,6 +118,7 @@ def _inner_function(*args, **kwargs):
_convert_pairedkeys_dict_to_splitattrs(right),
)
result = result.__class__([left, right])
# ELSE: leave other types of result unchanged. E.G. None, bool

return result

Expand Down

0 comments on commit b00b37f

Please sign in to comment.