Skip to content

Commit

Permalink
Address more review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton committed Aug 25, 2018
1 parent 7a93bff commit 4183a59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nrrd/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Duplicated fields are prohibited by the spec, but do occur in the wild.
# Set True to allow duplicate fields, with a warning.
_NRRD_ALLOW_DUPLICATE_FIELD = False
ALLOW_DUPLICATE_FIELD = False

_TYPEMAP_NRRD2NUMPY = {
'signed char': 'i1',
Expand Down Expand Up @@ -257,7 +257,7 @@ def read_header(file, custom_field_map=None):
if field in header.keys():
dup_message = "Duplicate header field: '%s'" % str(field)

if not _NRRD_ALLOW_DUPLICATE_FIELD:
if not ALLOW_DUPLICATE_FIELD:
raise NRRDError(dup_message)

warnings.warn(dup_message)
Expand Down
2 changes: 1 addition & 1 deletion nrrd/tests/test_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_read_dup_field_error_and_warn(self):

import warnings
with warnings.catch_warnings(record=True) as w:
nrrd.reader._NRRD_ALLOW_DUPLICATE_FIELD = True
nrrd.reader.ALLOW_DUPLICATE_FIELD = True
header = nrrd.read_header(header_txt_tuple)

self.assertTrue("Duplicate header field: 'type'" in str(w[0].message))
Expand Down
6 changes: 3 additions & 3 deletions nrrd/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def write(filename, data, header={}, detached_header=False, custom_field_map=Non
custom_field_map : :class:`dict` (:class:`str`, :class:`str`), optional
Dictionary used for parsing custom field types where the key is the custom field name and the value is a
string identifying datatype for the custom field.
compression_level : int
Int specifying compression level, when applicable.
compression_level : :class:`int`
Int specifying compression level, when using a compressed encoding (.gz, .bz2).
- For zlib (.gz): 1-9 set low to high compression; 0 disables; -1 uses zlib default.
- For bzip2 (.bz2): 1-9 set low to high compression.
Expand Down Expand Up @@ -269,7 +269,7 @@ def _write_data(data, fh, header, compression_level = 9):
if header['encoding'] in ['gzip', 'gz']:
compressobj = zlib.compressobj(compression_level, zlib.DEFLATED, zlib.MAX_WBITS | 16)
elif header['encoding'] in ['bzip2', 'bz2']:
compressobj = bz2.BZ2Compressor()
compressobj = bz2.BZ2Compressor(compression_level)
else:
raise NRRDError('Unsupported encoding: "%s"' % header['encoding'])

Expand Down

0 comments on commit 4183a59

Please sign in to comment.