Skip to content

Commit

Permalink
- fix minor pycharm complaints
Browse files Browse the repository at this point in the history
- minor comment editing
  • Loading branch information
gjr80 committed Jun 16, 2018
1 parent 38afb85 commit c1baa48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bin/user/rtgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# A weeWX service to generate a loop based gauge-data.txt.
#
# Copyright (C) 2017 Gary Roderick gjroderick<at>gmail.com
# Copyright (C) 2017-2018 Gary Roderick gjroderick<at>gmail.com
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
Expand Down Expand Up @@ -701,13 +701,13 @@ def get_minmax_obs(self, obs_type):
def get_rain(self, tspan):
"""Calculate rainfall over a given timespan."""

_result = {}
_rain_vt = self.db_manager.getAggregate(tspan, 'rain', 'sum')
if _rain_vt:
return _rain_vt
else:
return None


# ============================================================================
# class RealtimeGaugeDataThread
# ============================================================================
Expand Down Expand Up @@ -2479,7 +2479,7 @@ def __init__(self, control_queue, result_queue, config_dict,
api_key = config_dict['Forecast']['WU'].get('api_key')
else:
raise MissingApiKey("Cannot find valid Weather Underground API key")
except:
except AttributeError:
raise MissingApiKey("Cannot find Weather Underground API key")
# Get 'query' (ie the location) to be used for use in WU API calls.
# Refer weewx.conf for details.
Expand All @@ -2499,13 +2499,13 @@ def run(self):
Run a continuous loop querying the API, queuing the resulting forecast
data and checking for the shutdown signal. Since subsequent API queries
are triggered by an elapsed period of time rather than an external
event (eg recipt of archive record) it makes sense to sleep for a
event (eg receipt of archive record) it makes sense to sleep for a
period before checking if it is time to query. However, this limits the
responsiveness of the thread to the shutdown singal unless the sleep
period is very short (seconds). An alternative is to use the blocking
feature of Queue.get() to spend time blocking rather than sleeping. If
the blocking period is greater than the API lockout period then we can
avoid activating the API blockout period.
avoid activating the API lockout period.
"""

# since we are in a thread some additional try..except clauses will
Expand Down Expand Up @@ -2542,7 +2542,7 @@ def run(self):
# nothing in the queue so continue
pass
else:
# somethign was in the queue, if it is the shutdown signal
# something was in the queue, if it is the shutdown signal
# then return otherwise continue
if _package is None:
# we have a shutdown signal so return to exit
Expand Down Expand Up @@ -2588,7 +2588,9 @@ def query_wu(self):
logdbg("WUThread",
"Downloaded updated Weather Underground %s information" % self.feature)
except Exception, e:
# Some unknown exception occurred. Log it and continue.
# Some unknown exception occurred. Set _response to None,
# log it and continue.
_response = None
loginf("WUThread",
"Unexpected exception of type %s" % (type(e), ))
weeutil.weeutil.log_traceback('WUThread: **** ')
Expand Down

0 comments on commit c1baa48

Please sign in to comment.