Skip to content

Commit

Permalink
fix (some) SonarQube issues (#1800)
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed May 20, 2024
1 parent 8fc110f commit 1f64115
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion drizzlepac/ablot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from . import __version__

__all__ = ['blot', 'runBlot', 'help', 'getHelpAsString']
__all__ = ['blot', 'runBlot', 'help']

__taskname__ = 'ablot'
_blot_step_num_ = 5
Expand Down
6 changes: 3 additions & 3 deletions drizzlepac/adrizzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def run(configObj, wcsmap=None):
fillval=scale_pars['fillval'], stepsize=configObj['stepsize'],
wcsmap=None)

out_sci_handle, outextn = create_output(configObj['outdata'])
out_sci_handle, outextn = create_output(configObj['outdata'], outsci)
if not output_exists:
# Also, define default header based on input image Primary header
out_sci_handle[outextn].header = in_sci_phdr.copy()
Expand Down Expand Up @@ -309,13 +309,13 @@ def run(configObj, wcsmap=None):
out_sci_handle.close()

if not util.is_blank(configObj['outweight']):
out_wht_handle, outwhtext = create_output(configObj['outweight'])
out_wht_handle, outwhtext = create_output(configObj['outweight'], outwht)
out_wht_handle[outwhtext].header = out_sci_handle[outextn].header.copy()
out_wht_handle[outwhtext].data = outwht
out_wht_handle.close()

if keep_con:
out_con_handle, outconext = create_output(configObj['outcontext'])
out_con_handle, outconext = create_output(configObj['outcontext'], outcon)
out_con_handle[outconext].data = outcon
out_con_handle.close()

Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/devutils/comparison_tools/starmatch_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ def usage(msg=None):
source_list_dict = {}
for cooname in args:
source_list_dict[cooname] = len(open(cooname).readlines())
matched=run(source_list_dict, xref=xref, yref=yref)
matched=run(source_list_dict, log_level=20, xref=xref, yref=yref)
# print >> msgunit, 'matched keys'
# print >> msgunit, matched.keys()
# print "x1 y1 x2 y2"
Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/findobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'findstars', 'apply_nsigma_separation', 'xy_round',
'precompute_sharp_round', 'sharp_round', 'roundness', 'immoments',
'nmoment', 'centroid', 'cmoment', 'central_moments', 'covmat',
'help', 'getHelpAsString']
'help']


#def gaussian(amplitude, xcen, ycen, xsigma, ysigma):
Expand Down
5 changes: 4 additions & 1 deletion drizzlepac/hapmultisequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,10 @@ def run_align_to_gaia(total_obj_list, custom_limits=None, log_level=logutil.logg
# - migrate updated WCS solutions to exp_obj instances, if necessary (probably not?)
# - re-run tot_obj.generate_metawcs() method to recompute total object meta_wcs based on updated
# input exposure's WCSs
catalog_list = [gaia_obj.configobj_pars.pars['alignment'].pars_multidict['all']['run_align']['catalog_list'][0]] # For now, just pass in a single catalog name as list
if gaia_obj.configobj_pars is not None:
catalog_list = [gaia_obj.configobj_pars.pars['alignment'].pars_multidict['all']['run_align']['catalog_list'][0]] # For now, just pass in a single catalog name as list
else:
catalog_list = []
align_table, filt_exposures = gaia_obj.align_to_gaia(catalog_list=catalog_list,
output=diagnostic_mode,
fit_label='MVM')
Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/haputils/astrometric_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def find_gsc_offset(image, input_catalog='GSC1', output_catalog='GAIA'):
serviceUrl = "{}/{}?{}".format(SERVICELOCATION, serviceType, spec)
rawcat = requests.get(serviceUrl)
if not rawcat.ok:
log.info("Problem accessing service with:\n{{}".format(serviceUrl))
log.info(f"Problem accessing service with:\n{serviceUrl}")
raise ValueError

delta_ra = delta_dec = None
Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/haputils/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, prod_obj, hap_pipeline_name='svm', log_level=logutil.logging.
Nothing.
"""
log.setLevel(log_level)
if input_custom_pars_file and input_custom_pars_file and input_custom_pars_file == output_custom_pars_file:
if input_custom_pars_file and input_custom_pars_file == output_custom_pars_file:
log.error("ERROR: Input and output parameter files must have unique names!")
sys.exit(1)
self.label = "hap_config"
Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/haputils/starmatch_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ def usage(msg=None):
source_list_dict = {}
for cooname in args:
source_list_dict[cooname] = len(open(cooname).readlines())
matched=run(source_list_dict, xref=xref, yref=yref)
matched=run(source_list_dict, log_level=20, xref=xref, yref=yref)
# print >> msgunit, 'matched keys'
# print >> msgunit, matched.keys()
# print "x1 y1 x2 y2"
Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/imgclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ def __init__(self, wcs_list, catalog, xycatalog=None, cat_origin=None, **kwargs)
im_fmode='readonly')
fi[0].release_all_images()
if len(fi) != 1:
ValueError('Reference image file name must contain a single '
raise ValueError('Reference image file name must contain a single '
'file name specification.')
froot = fi[0].image
if len(fi[0].fext) == 0:
Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/pixreplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from . import util


__all__ = ['replace', 'help', 'getHelpAsString']
__all__ = ['replace', 'help']
__taskname__ = 'pixreplace'


Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/updatehdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def interpret_wcsname_type(wcsname):
else:
if 'FIT' not in fit_term:
wcstype += default_fit.format(fit_term)
else:
elif fit_term is not None:
wcstype += post_fit
postfit_type = fit_term.split('_')
wcstype += fit_terms[postfit_type[1]].format(postfit_type[2])
Expand Down

0 comments on commit 1f64115

Please sign in to comment.