From 0e78fd12fe59a626dc0b15bfbd2c7fe3bdd850db Mon Sep 17 00:00:00 2001 From: Erin Sheldon Date: Wed, 15 Dec 2021 16:08:20 -0500 Subject: [PATCH 1/2] update version and changelog for 1.1.6 --- CHANGES.md | 9 +++++++++ fitsio/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4c8510a5..abea938e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +version 1.1.6 +------------- + +Bug Fixes + + - fixed bug where Updating an existing record in an image header raises an + exception (user ussegliog) + - fix bug append not forwarding arguments to write (Nicolas Tessore) + version 1.1.5 --------------------------------- diff --git a/fitsio/__init__.py b/fitsio/__init__.py index c83a26a3..0c932635 100644 --- a/fitsio/__init__.py +++ b/fitsio/__init__.py @@ -5,7 +5,7 @@ usage. """ -__version__ = '1.1.5' +__version__ = '1.1.6' from . import fitslib diff --git a/setup.py b/setup.py index 7158ad83..35825498 100644 --- a/setup.py +++ b/setup.py @@ -271,7 +271,7 @@ def check_system_cfitsio_objects(self, obj_name): setup( name="fitsio", - version="1.1.5", + version="1.1.6", description=description, long_description=long_description, long_description_content_type='text/markdown; charset=UTF-8; variant=GFM', From 4bf11171b0499f2e2f2105004eb6e2154f00e335 Mon Sep 17 00:00:00 2001 From: Erin Sheldon Date: Wed, 15 Dec 2021 16:25:41 -0500 Subject: [PATCH 2/2] flake8 fixes --- fitsio/fitslib.py | 57 ++++++++++++++++++++++++--------------------- fitsio/hdu/base.py | 6 +++-- fitsio/hdu/table.py | 6 +++-- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/fitsio/fitslib.py b/fitsio/fitslib.py index 2211d4a1..c5a61f2d 100644 --- a/fitsio/fitslib.py +++ b/fitsio/fitslib.py @@ -260,13 +260,13 @@ def read_scamp_head(fname, header=None): with open(fname) as fobj: lines = fobj.readlines() - lines = [l.strip() for l in lines if l[0:3] != 'END'] + lines = [line.strip() for line in lines if line[0:3] != 'END'] # if header is None an empty FITSHDR is created hdr = FITSHDR(header) - for l in lines: - hdr.add_record(l) + for line in lines: + hdr.add_record(line) return hdr @@ -376,8 +376,8 @@ def write(filename, data, extname=None, extver=None, header=None, Defaults to 'SUBTRACTIVE_DITHER_1' which follows the fpack defaults hcomp_scale: float - Scale value for HCOMPRESS, 0.0 means lossless compression. Default is 0.0 - following the fpack defaults. + Scale value for HCOMPRESS, 0.0 means lossless compression. Default is + 0.0 following the fpack defaults. hcomp_smooth: bool If True, apply smoothing when decompressing. Default False """ @@ -635,11 +635,11 @@ def write(self, data, units=None, extname=None, extver=None, tile_dims: tuple of ints, optional The size of the tiles used to compress images. qlevel: float, optional - Quantization level for floating point data. Lower generally result in - more compression, we recommend one reads the FITS standard or cfitsio - manual to fully understand the effects of quantization. None or 0 - means no quantization, and for gzip also implies lossless. Default is - 4.0 which follows the fpack defaults + Quantization level for floating point data. Lower generally result + in more compression, we recommend one reads the FITS standard or + cfitsio manual to fully understand the effects of quantization. + None or 0 means no quantization, and for gzip also implies + lossless. Default is 4.0 which follows the fpack defaults qmethod: string or int The quantization method as string or integer. 'NO_DITHER' or fitsio.NO_DITHER (-1) @@ -652,8 +652,8 @@ def write(self, data, units=None, extname=None, extver=None, Defaults to 'SUBTRACTIVE_DITHER_1' which follows the fpack defaults hcomp_scale: float - Scale value for HCOMPRESS, 0.0 means lossless compression. Default is 0.0 - following the fpack defaults. + Scale value for HCOMPRESS, 0.0 means lossless compression. Default + is 0.0 following the fpack defaults. hcomp_smooth: bool If True, apply smoothing when decompressing. Default False @@ -741,11 +741,11 @@ def write_image(self, img, extname=None, extver=None, tile_dims: tuple of ints, optional The size of the tiles used to compress images. qlevel: float, optional - Quantization level for floating point data. Lower generally result in - more compression, we recommend one reads the FITS standard or cfitsio - manual to fully understand the effects of quantization. None or 0 - means no quantization, and for gzip also implies lossless. Default is - 4.0 which follows the fpack defaults + Quantization level for floating point data. Lower generally result + in more compression, we recommend one reads the FITS standard or + cfitsio manual to fully understand the effects of quantization. + None or 0 means no quantization, and for gzip also implies + lossless. Default is 4.0 which follows the fpack defaults qmethod: string or int The quantization method as string or integer. 'NO_DITHER' or fitsio.NO_DITHER (-1) @@ -758,8 +758,8 @@ def write_image(self, img, extname=None, extver=None, Defaults to 'SUBTRACTIVE_DITHER_1' which follows the fpack defaults hcomp_scale: float - Scale value for HCOMPRESS, 0.0 means lossless compression. Default is 0.0 - following the fpack defaults. + Scale value for HCOMPRESS, 0.0 means lossless compression. Default + is 0.0 following the fpack defaults. hcomp_smooth: bool If True, apply smoothing when decompressing. Default False @@ -866,11 +866,11 @@ def create_image_hdu(self, tile_dims: tuple of ints, optional The size of the tiles used to compress images. qlevel: float, optional - Quantization level for floating point data. Lower generally result in - more compression, we recommend one reads the FITS standard or cfitsio - manual to fully understand the effects of quantization. None or 0 - means no quantization, and for gzip also implies lossless. Default is - 4.0 which follows the fpack defaults. + Quantization level for floating point data. Lower generally result + in more compression, we recommend one reads the FITS standard or + cfitsio manual to fully understand the effects of quantization. + None or 0 means no quantization, and for gzip also implies + lossless. Default is 4.0 which follows the fpack defaults. qmethod: string or int The quantization method as string or integer. 'NO_DITHER' or fitsio.NO_DITHER (-1) @@ -883,8 +883,8 @@ def create_image_hdu(self, Defaults to 'SUBTRACTIVE_DITHER_1' which follows the fpack defaults hcomp_scale: float - Scale value for HCOMPRESS, 0.0 means lossless compression. Default is 0.0 - following the fpack defaults. + Scale value for HCOMPRESS, 0.0 means lossless compression. Default + is 0.0 following the fpack defaults. hcomp_smooth: bool If True, apply smoothing when decompressing. Default False @@ -1469,7 +1469,10 @@ def __repr__(self): name = '%s[%s]' % (name, ver) rep.append( - "%s%-6d %-15s %s" % (spacing, i, _hdu_type_map[t], name)) + "%s%-6d %-15s %s" % ( + spacing, i, _hdu_type_map[t], name + ) + ) rep = '\n'.join(rep) return rep diff --git a/fitsio/hdu/base.py b/fitsio/hdu/base.py index babd14f2..2419b08f 100644 --- a/fitsio/hdu/base.py +++ b/fitsio/hdu/base.py @@ -325,8 +325,10 @@ def write_keys(self, records_in, clean=True): if INVALID_HDR_CHARS_RE.search(name): raise RuntimeError( - "header key '%s' has invalid characters! Characters in " - "%s are not allowed!" % (name, INVALID_HDR_CHARS) + "header key '%s' has invalid characters! " + "Characters in %s are not allowed!" % ( + name, INVALID_HDR_CHARS + ) ) value = r['value'] diff --git a/fitsio/hdu/table.py b/fitsio/hdu/table.py index 6cf399a7..7e6b4e15 100644 --- a/fitsio/hdu/table.py +++ b/fitsio/hdu/table.py @@ -130,7 +130,8 @@ def get_colname(self, colnum): """ if colnum < 0 or colnum > (len(self._colnames)-1): raise ValueError( - "colnum out of range [0,%s-1]" % (0, len(self._colnames))) + "colnum out of range [0,%s-1]" % len(self._colnames) + ) return self._colnames[colnum] def get_vstorage(self): @@ -1730,7 +1731,8 @@ def _extract_colnum(self, col): if (colnum < 0) or (colnum > (self._ncol-1)): raise ValueError( - "column number should be in [0,%d]" % (0, self._ncol-1)) + "column number should be in [0,%d]" % (self._ncol-1) + ) else: colstr = mks(col) try: