Skip to content

Commit 7d42699

Browse files
DimitriPapadopoulosFrancescAlted
authored andcommitted
Simplify super() calls
https://docs.python.org/3/library/functions.html#super Suggested by pyupgrade.
1 parent 0830349 commit 7d42699

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

blosc2/ndarray.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_ndarray_start_stop(ndim, key, shape):
3838
class NDArray(blosc2_ext.NDArray):
3939
def __init__(self, **kwargs):
4040
self._schunk = SChunk(_schunk=kwargs["_schunk"], _is_view=True) # SChunk Python instance
41-
super(NDArray, self).__init__(kwargs["_array"])
41+
super().__init__(kwargs["_array"])
4242

4343
@property
4444
def info(self):
@@ -125,7 +125,7 @@ def __getitem__(self, key: int | slice | Sequence[slice]) -> np.ndarray:
125125
# (besides we don't need to fill padding with zeros)
126126
arr = np.empty(shape, dtype=self.dtype)
127127

128-
return super(NDArray, self).get_slice_numpy(arr, key)
128+
return super().get_slice_numpy(arr, key)
129129

130130
def __setitem__(self, key, value):
131131
"""Set a slice.
@@ -168,7 +168,7 @@ def __setitem__(self, key, value):
168168
elif isinstance(value, NDArray):
169169
value = value[...]
170170

171-
return super(NDArray, self).set_slice(key, value)
171+
return super().set_slice(key, value)
172172

173173
def iterchunks_info(self):
174174
"""
@@ -216,7 +216,7 @@ def tobytes(self):
216216
>>> b.tobytes() == bytes(a[...])
217217
True
218218
"""
219-
return super(NDArray, self).tobytes()
219+
return super().tobytes()
220220

221221
def copy(self, dtype=None, **kwargs):
222222
"""Create a copy of an array with same parameters.
@@ -268,7 +268,7 @@ def copy(self, dtype=None, **kwargs):
268268
kwargs["meta"] = meta_dict
269269
_check_ndarray_kwargs(**kwargs)
270270

271-
return super(NDArray, self).copy(dtype, **kwargs)
271+
return super().copy(dtype, **kwargs)
272272

273273
def resize(self, newshape):
274274
"""Change the shape of the array by growing or shrinking one or more dimensions.
@@ -300,7 +300,7 @@ def resize(self, newshape):
300300
(50, 10)
301301
"""
302302
blosc2_ext.check_access_mode(self.schunk.urlpath, self.schunk.mode)
303-
return super(NDArray, self).resize(newshape)
303+
return super().resize(newshape)
304304

305305
def slice(self, key, **kwargs):
306306
"""Get a (multidimensional) slice as a new :ref:`NDArray <NDArray>`.
@@ -339,7 +339,7 @@ def slice(self, key, **kwargs):
339339
key, mask = process_key(key, self.shape)
340340
start, stop, _ = get_ndarray_start_stop(self.ndim, key, self.shape)
341341
key = (start, stop)
342-
return super(NDArray, self).get_slice(key, mask, **kwargs)
342+
return super().get_slice(key, mask, **kwargs)
343343

344344
def squeeze(self):
345345
"""Remove the 1's in array's shape.
@@ -357,7 +357,7 @@ def squeeze(self):
357357
>>> a.shape
358358
(23, 11)
359359
"""
360-
super(NDArray, self).squeeze()
360+
super().squeeze()
361361

362362

363363
def _check_shape(shape):

blosc2/schunk.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class vlmeta(MutableMapping, blosc2_ext.vlmeta):
2020
def __init__(self, schunk, urlpath, mode):
2121
self.urlpath = urlpath
2222
self.mode = mode
23-
super(vlmeta, self).__init__(schunk)
23+
super().__init__(schunk)
2424

2525
def __setitem__(self, name, content):
2626
blosc2_ext.check_access_mode(self.urlpath, self.mode)
@@ -31,28 +31,28 @@ def __setitem__(self, name, content):
3131
strict_types=True,
3232
use_bin_type=True,
3333
)
34-
super(vlmeta, self).set_vlmeta(name, content, **cparams)
34+
super().set_vlmeta(name, content, **cparams)
3535

3636
def __getitem__(self, name):
37-
return unpackb(super(vlmeta, self).get_vlmeta(name), list_hook=blosc2_ext.decode_tuple)
37+
return unpackb(super().get_vlmeta(name), list_hook=blosc2_ext.decode_tuple)
3838

3939
def __delitem__(self, name):
4040
blosc2_ext.check_access_mode(self.urlpath, self.mode)
41-
super(vlmeta, self).del_vlmeta(name)
41+
super().del_vlmeta(name)
4242

4343
def __len__(self):
44-
return super(vlmeta, self).nvlmetalayers()
44+
return super().nvlmetalayers()
4545

4646
def __iter__(self):
47-
keys = super(vlmeta, self).get_names()
47+
keys = super().get_names()
4848
yield from keys
4949

5050
def getall(self):
5151
"""
5252
Return all the variable length metalayers as a dictionary
5353
5454
"""
55-
return super(vlmeta, self).to_dict()
55+
return super().to_dict()
5656

5757

5858
class Meta(Mapping):

0 commit comments

Comments
 (0)