Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _invalid_netcdf_feature(feature, allow, file, stacklevel=0):
if allow is None:
msg = ('{} are supported by h5py, but not part of the NetCDF API. '
'You are writing an HDF5 file that is not a valid NetCDF file! '
'In the future, this will be an error, unless you set '
'invalid_netcdf=True.'.format(feature))
warnings.warn(msg, FutureWarning, stacklevel=stacklevel)
file._write_ncproperties = False
elif not allow:
msg = ('{} are not a supported NetCDF feature, and are not allowed by '
'h5netcdf unless invalid_netcdf=True.'.format(feature))
raise CompatibilityError(msg)