File tree 3 files changed +27
-1
lines changed
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,11 @@ Bug fixes
55
55
due to a ``datetime `` issue in NumPy (:issue: `2334 `).
56
56
By `Graham Inggs <https://github.com/ginggs >`_.
57
57
- Fixed bug in ``combine_by_coords() `` causing a `ValueError ` if the input had
58
- an unused dimension with coordinates which were not monotonic (:issue`3150`).
58
+ an unused dimension with coordinates which were not monotonic (:issue: `3150 `).
59
59
By `Tom Nicholas <http://github.com/TomNicholas >`_.
60
+ - Fixed crash when applying ``distributed.Client.compute() `` to a DataArray
61
+ (:issue: `3171 `). By `Guido Imperiale <https://github.com/crusaderky >`_.
62
+
60
63
61
64
.. _whats-new.0.12.3 :
62
65
Original file line number Diff line number Diff line change @@ -462,12 +462,22 @@ def __repr__(self: Any) -> str:
462
462
class ReprObject :
463
463
"""Object that prints as the given value, for use with sentinel values.
464
464
"""
465
+ __slots__ = ('_value' , )
466
+
465
467
def __init__ (self , value : str ):
466
468
self ._value = value
467
469
468
470
def __repr__ (self ) -> str :
469
471
return self ._value
470
472
473
+ def __eq__ (self , other ) -> bool :
474
+ if isinstance (other , ReprObject ):
475
+ return self ._value == other ._value
476
+ return False
477
+
478
+ def __hash__ (self ) -> int :
479
+ return hash ((ReprObject , self ._value ))
480
+
471
481
472
482
@contextlib .contextmanager
473
483
def close_on_error (f ):
Original file line number Diff line number Diff line change @@ -181,6 +181,19 @@ def test_repr_object():
181
181
assert repr (obj ) == 'foo'
182
182
183
183
184
+ def test_repr_object_magic_methods ():
185
+ o1 = utils .ReprObject ('foo' )
186
+ o2 = utils .ReprObject ('foo' )
187
+ o3 = utils .ReprObject ('bar' )
188
+ o4 = 'foo'
189
+ assert o1 == o2
190
+ assert o1 != o3
191
+ assert o1 != o4
192
+ assert hash (o1 ) == hash (o2 )
193
+ assert hash (o1 ) != hash (o3 )
194
+ assert hash (o1 ) != hash (o4 )
195
+
196
+
184
197
def test_is_remote_uri ():
185
198
assert utils .is_remote_uri ('http://example.com' )
186
199
assert utils .is_remote_uri ('https://example.com' )
You can’t perform that action at this time.
0 commit comments