Skip to content

Commit 24d49fc

Browse files
crusaderkyshoyer
authored andcommitted
Base classes in Python 3 don't need to subclass object (#2950)
* Base classes in Python 3 don't need to subclass object * What's new
1 parent c04234d commit 24d49fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+114
-112
lines changed

asv_bench/benchmarks/dataset_io.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'
2020

2121

22-
class IOSingleNetCDF(object):
22+
class IOSingleNetCDF:
2323
"""
2424
A few examples that benchmark reading/writing a single netCDF file with
2525
xarray
@@ -214,7 +214,7 @@ def time_load_dataset_scipy_with_time_chunks(self):
214214
chunks=self.time_chunks).load()
215215

216216

217-
class IOMultipleNetCDF(object):
217+
class IOMultipleNetCDF:
218218
"""
219219
A few examples that benchmark reading/writing multiple netCDF files with
220220
xarray
@@ -419,7 +419,7 @@ def create_delayed_write():
419419
return ds.to_netcdf('file.nc', engine='netcdf4', compute=False)
420420

421421

422-
class IOWriteNetCDFDask(object):
422+
class IOWriteNetCDFDask:
423423
timeout = 60
424424
repeat = 1
425425
number = 5
@@ -432,7 +432,7 @@ def time_write(self):
432432
self.write.compute()
433433

434434

435-
class IOWriteNetCDFDaskDistributed(object):
435+
class IOWriteNetCDFDaskDistributed:
436436
def setup(self):
437437
try:
438438
import distributed

asv_bench/benchmarks/indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
}
5959

6060

61-
class Base(object):
61+
class Base:
6262
def setup(self, key):
6363
self.ds = xr.Dataset(
6464
{'var1': (('x', 'y'), randn((nx, ny), frac_nan=0.1)),

asv_bench/benchmarks/interp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
new_y_long = np.linspace(0.1, 0.9, 1000)
2525

2626

27-
class Interpolation(object):
27+
class Interpolation:
2828
def setup(self, *args, **kwargs):
2929
self.ds = xr.Dataset(
3030
{'var1': (('x', 'y'), randn_xy),

asv_bench/benchmarks/reindexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from . import requires_dask
88

99

10-
class Reindex(object):
10+
class Reindex:
1111
def setup(self):
1212
data = np.random.RandomState(0).randn(1000, 100, 100)
1313
self.ds = xr.Dataset({'temperature': (('time', 'x', 'y'), data)},

asv_bench/benchmarks/rolling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
randn_long = randn((long_nx, ), frac_nan=0.1)
2020

2121

22-
class Rolling(object):
22+
class Rolling:
2323
def setup(self, *args, **kwargs):
2424
self.ds = xr.Dataset(
2525
{'var1': (('x', 'y'), randn_xy),

asv_bench/benchmarks/unstacking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from . import requires_dask
88

99

10-
class Unstacking(object):
10+
class Unstacking:
1111
def setup(self):
1212
data = np.random.RandomState(0).randn(1, 1000, 500)
1313
self.ds = xr.DataArray(data).stack(flat_dim=['dim_1', 'dim_2'])

doc/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ typically find tests wrapped in a class.
457457

458458
.. code-block:: python
459459
460-
class TestReallyCoolFeature(object):
460+
class TestReallyCoolFeature:
461461
....
462462
463463
Going forward, we are moving to a more *functional* style using the

doc/examples/_code/accessor_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
@xr.register_dataset_accessor('geo')
5-
class GeoAccessor(object):
5+
class GeoAccessor:
66
def __init__(self, xarray_obj):
77
self._obj = xarray_obj
88
self._center = None

doc/whats-new.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ Enhancements
2727
- Character arrays' character dimension name decoding and encoding handled by
2828
``var.encoding['char_dim_name']`` (:issue:`2895`)
2929
By `James McCreight <https://github.com/jmccreight>`_.
30-
30+
- Clean up Python 2 compatibility in code (:issue:`2950`)
31+
By `Guido Imperiale <https://github.com/crusaderky>`_.
32+
3133
Bug fixes
3234
~~~~~~~~~
3335

xarray/backends/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def open_dataarray(filename_or_obj, group=None, decode_cf=True,
529529
return data_array
530530

531531

532-
class _MultiFileCloser(object):
532+
class _MultiFileCloser:
533533
def __init__(self, file_objs):
534534
self.file_objs = file_objs
535535

0 commit comments

Comments
 (0)