Skip to content

Commit

Permalink
Appease the Python3 gods by changing logger.warn->warning
Browse files Browse the repository at this point in the history
  • Loading branch information
talister committed Jun 5, 2018
1 parent 2876ba0 commit 6517784
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions neoexchange/astrometrics/albedo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ def asteroid_diameter(a=asteroid_albedo(), h=7):
try:
h = float(h)
except (TypeError, ValueError):
logger.warn("Could not convert H magnitude to a float")
logger.warning("Could not convert H magnitude to a float")
return None

if a <= 0.00:
logger.debug("You cannot have a negative albedo")
return False
elif h < -90:
logger.warn('Nothing brighter than -90, must be a flag.')
logger.warning('Nothing brighter than -90, must be a flag.')
return None
else:
try:
Expand Down
2 changes: 1 addition & 1 deletion neoexchange/astrometrics/ephem_subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def compute_ephem(d, orbelems, sitecode, dbg=False, perturb=True, display=False)

if site_name == '?' or sitecode == '500':
if site_name == '?':
logger.warn("WARN: No site co-ordinates found, computing for geocenter")
logger.warning("WARN: No site co-ordinates found, computing for geocenter")
pvobs = zeros(6)
else:
# Compute local apparent sidereal time
Expand Down
4 changes: 2 additions & 2 deletions neoexchange/astrometrics/sources_subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def fetchpage_and_make_soup(url, fakeagent=False, dbg=False, parser="html.parser
response = opener.open(req_page)
except (urllib.error.HTTPError, urllib.error.URLError) as e:
if hasattr(e, 'code'):
logger.warn("Page retrieval failed with HTTP Error %d: %s, retrying" % (e.code, e.reason))
logger.warning("Page retrieval failed with HTTP Error %d: %s, retrying" % (e.code, e.reason))
else:
logger.warn("Page retrieval failed with HTTP Error: %s" % (e.reason,))
logger.warning("Page retrieval failed with HTTP Error: %s" % (e.reason,))
return None

# Suck the HTML down
Expand Down
6 changes: 3 additions & 3 deletions neoexchange/core/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def frame_params_from_header(params, block):
wcs = WCS(params)
frame_params['wcs'] = wcs
except ValueError:
logger.warn("Error creating WCS entry from frameid=%s" % frameid)
logger.warning("Error creating WCS entry from frameid=%s" % frameid)


# Correct filename for missing trailing .fits extension
Expand Down Expand Up @@ -241,11 +241,11 @@ def block_status(block_id):
data = check_request_status(tracking_num)
# data is a full LCO request dict for this tracking number (now called 'id').
if not data:
logger.warn("Got no data for block/track# %s / %s" % (block_id, tracking_num))
logger.warning("Got no data for block/track# %s / %s" % (block_id, tracking_num))
return False
# Check if the request was not found
if data.get('detail', 'None') == u'Not found.':
logger.warn("Request not found for block/track# %s / %s" % (block_id, tracking_num))
logger.warning("Request not found for block/track# %s / %s" % (block_id, tracking_num))
return False
# Check if credentials provided
if data.get('detail', 'None') == u'Invalid token header. No credentials provided.':
Expand Down
2 changes: 1 addition & 1 deletion neoexchange/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ def format_mpc_line(self):
else:
flags = ' ' + self.flags
elif len(self.flags) > 2:
logger.warn("Flags longer than will fit into field - needs mapper")
logger.warning("Flags longer than will fit into field - needs mapper")
flags = self.flags[0:2]

mpc_line = "%12s%2s%1s%16s%11s %11s %4s %1s%1s %3s" % (name,
Expand Down
2 changes: 1 addition & 1 deletion neoexchange/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ def update_crossids(astobj, dbg=False):
try:
body, created = Body.objects.get_or_create(provisional_name=obj_id)
except:
logger.warn("Multiple objects found called %s" % obj_id)
logger.warning("Multiple objects found called %s" % obj_id)
return False
# Determine what type of new object it is and whether to keep it active
kwargs = clean_crossid(astobj, dbg)
Expand Down
8 changes: 4 additions & 4 deletions neoexchange/photometrics/external_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def setup_working_dir(source_dir, dest_dir, config_files):
try:
os.unlink(config_dest_filepath)
except OSError:
logger.warn("Could not unlink %s" % ( config_dest_filepath))
logger.warning("Could not unlink %s" % ( config_dest_filepath))
try:
os.symlink(config_src_filepath, config_dest_filepath)
except OSError:
Expand Down Expand Up @@ -534,7 +534,7 @@ def read_mtds_file(mtdsfile, dbg=False):
# basic check that the JD is within the expected range
# values are 2014-01-01 to 2036-12-31 converted to Julian Dates
if frame_jd < 2456658.5 or frame_jd > 2465058.5:
logger.warn("Frame %s has suspicious JD value %f outside expected range" % (frame_filename, frame_jd))
logger.warning("Frame %s has suspicious JD value %f outside expected range" % (frame_filename, frame_jd))
frames.append((frame_filename, frame_jd))
frame += 1

Expand All @@ -552,14 +552,14 @@ def read_mtds_file(mtdsfile, dbg=False):
try:
dets_array = loadtxt(mtds_fh, dtype=dtypes)
except Exception as e:
logger.warn("Didn't find any detections in file %s (Reason %s)" % (mtdsfile, e))
logger.warning("Didn't find any detections in file %s (Reason %s)" % (mtdsfile, e))
dets_array = empty( shape=(0, 0) )

# Check for correct number of entries
if dbg: print(dets_array.shape)
num_detections = dets_array.shape[0] / num_frames
if num_detections == 0:
logger.warn("Found 0 detection entries")
logger.warning("Found 0 detection entries")
num_detections = 0
detections = []
elif dets_array.shape[0] / float(num_frames) != num_detections:
Expand Down
2 changes: 1 addition & 1 deletion neoexchange/photometrics/photometry_subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def sky_brightness_model(params, dbg=False):
galactic_lat = target.galactic.b
if dbg: print(target, ecliptic_lat, galactic_lat)
except ValueError:
logger.warn("Could not find/convert co-ordinates")
logger.warning("Could not find/convert co-ordinates")
# Assume a value of 60.0 in S10 units for the zodiacal light if the
# latitude wasn't given or calculatable
q_zodi = 60.0
Expand Down

0 comments on commit 6517784

Please sign in to comment.