Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _group_cls(self):
return Group
for var in self.variables.values():
new_shape = list(var.shape)
for i, d in enumerate(var.dimensions):
if d == dimension:
new_shape[i] = size
new_shape = tuple(new_shape)
if new_shape != var.shape:
var._h5ds.resize(new_shape)
# Recurse as dimensions are visible to this group and all child groups.
for i in self.groups.values():
i.resize_dimension(dimension, size)
class File(Group):
def __init__(self, path, mode='a', invalid_netcdf=None, phony_dims=None,
**kwargs):
try:
if isinstance(path, str):
if path.startswith(('http://', 'https://', 'hdf5://')):
if no_h5pyd:
raise ImportError(
"No module named 'h5pyd'. h5pyd is required for "
"opening urls: {}".format(path))
try:
with h5pyd.File(path, 'r') as f: # noqa
pass
self._preexisting_file = True
except IOError:
self._preexisting_file = False