Commit 49f78b47 by Sarina Canelake

Remove `logging-not-lazy` Pylint violations

parent 39d35374
......@@ -631,7 +631,7 @@ class LoncapaProblem(object):
parent = inc.getparent()
parent.insert(parent.index(inc), incxml)
parent.remove(inc)
log.debug('Included %s into %s' % (filename, self.problem_id))
log.debug('Included %s into %s', filename, self.problem_id)
def _extract_system_path(self, script):
"""
......
......@@ -255,7 +255,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
fsym = f.sympy
msg += '<p>You entered: %s</p>' % to_latex(f.sympy)
except Exception, err:
log.exception("Error evaluating expression '%s' as a valid equation" % ans)
log.exception("Error evaluating expression '%s' as a valid equation", ans)
msg += "<p>Error in evaluating your expression '%s' as a valid equation</p>" % (ans)
if "Illegal math" in str(err):
msg += "<p>Illegal math expression</p>"
......
......@@ -118,7 +118,7 @@ class Textbook(object):
pass
# Get the table of contents from S3
log.info("Retrieving textbook table of contents from %s" % toc_url)
log.info("Retrieving textbook table of contents from %s", toc_url)
try:
r = requests.get(toc_url)
except Exception as err:
......
......@@ -120,5 +120,5 @@ def check_permissions_by_view(user, course_id, content, name):
try:
p = VIEW_PERMISSIONS[name]
except KeyError:
logging.warning("Permission for view named %s does not exist in permissions.py" % name)
logging.warning("Permission for view named %s does not exist in permissions.py", name)
return _check_conditions_permissions(user, p, course_id, content)
......@@ -33,7 +33,7 @@ class MockCommentServiceRequestHandler(BaseHTTPRequestHandler):
if 'X-Edx-Api-Key' in self.headers:
response = self.server._response_str
# Log the response
logger.debug("Comment Service: sending response %s" % json.dumps(response))
logger.debug("Comment Service: sending response %s", json.dumps(response))
# Send a response back to the client
self.send_response(200)
......@@ -71,7 +71,7 @@ class MockCommentServiceRequestHandler(BaseHTTPRequestHandler):
if 'X-Edx-Api-Key' in self.headers:
response = self.server._response_str
# Log the response
logger.debug("Comment Service: sending response %s" % json.dumps(response))
logger.debug("Comment Service: sending response %s", json.dumps(response))
# Send a response back to the client
self.send_response(200)
......
......@@ -389,7 +389,7 @@ class QueryCountDebugMiddleware(object):
query_time = query.get('duration', 0) / 1000
total_time += float(query_time)
log.info('%s queries run, total %s seconds' % (len(connection.queries), total_time))
log.info(u'%s queries run, total %s seconds', len(connection.queries), total_time)
return response
......
......@@ -77,7 +77,7 @@ def manage_modulestores(request, reload_dir=None, commit_id=None):
else:
html += 'Permission denied'
html += "</body></html>"
log.debug('request denied, ALLOWED_IPS=%s' % ALLOWED_IPS)
log.debug('request denied, ALLOWED_IPS=%s', ALLOWED_IPS)
return HttpResponse(html, status=403)
#----------------------------------------
......@@ -90,8 +90,8 @@ def manage_modulestores(request, reload_dir=None, commit_id=None):
# reloading based on commit_id is needed when running mutiple worker threads,
# so that a given thread doesn't reload the same commit multiple times
current_commit_id = get_commit_id(def_ms.courses[reload_dir])
log.debug('commit_id="%s"' % commit_id)
log.debug('current_commit_id="%s"' % current_commit_id)
log.debug('commit_id="%s"', commit_id)
log.debug('current_commit_id="%s"', current_commit_id)
if (commit_id is not None) and (commit_id == current_commit_id):
html += "<h2>Already at commit id %s for %s</h2>" % (commit_id, reload_dir)
......@@ -158,9 +158,9 @@ def manage_modulestores(request, reload_dir=None, commit_id=None):
#----------------------------------------
log.debug('_MODULESTORES=%s' % ms)
log.debug('courses=%s' % courses)
log.debug('def_ms=%s' % unicode(def_ms))
log.debug('_MODULESTORES=%s', ms)
log.debug('courses=%s', courses)
log.debug('def_ms=%s', unicode(def_ms))
html += "</body></html>"
return HttpResponse(html)
......@@ -189,7 +189,7 @@ def gitreload(request, reload_dir=None):
else:
html += 'Permission denied'
html += "</body></html>"
log.debug('request denied from %s, ALLOWED_IPS=%s' % (ip, ALLOWED_IPS))
log.debug('request denied from %s, ALLOWED_IPS=%s', ip, ALLOWED_IPS)
return HttpResponse(html)
#----------------------------------------
......@@ -197,14 +197,14 @@ def gitreload(request, reload_dir=None):
if reload_dir is None and 'payload' in request.POST:
payload = request.POST['payload']
log.debug("payload=%s" % payload)
log.debug("payload=%s", payload)
gitargs = json.loads(payload)
log.debug("gitargs=%s" % gitargs)
log.debug("gitargs=%s", gitargs)
reload_dir = gitargs['repository']['name']
log.debug("github reload_dir=%s" % reload_dir)
log.debug("github reload_dir=%s", reload_dir)
gdir = settings.DATA_DIR / reload_dir
if not os.path.exists(gdir):
log.debug("====> ERROR in gitreload - no such directory %s" % reload_dir)
log.debug("====> ERROR in gitreload - no such directory %s", reload_dir)
return HttpResponse('Error')
cmd = "cd %s; git reset --hard HEAD; git clean -f -d; git pull origin; chmod g+w course.xml" % gdir
log.debug(os.popen(cmd).read())
......@@ -213,7 +213,7 @@ def gitreload(request, reload_dir=None):
if gh:
ghurl = '%s/%s' % (gh, reload_dir)
r = requests.get(ghurl)
log.debug("GITRELOAD_HOOK to %s: %s" % (ghurl, r.text))
log.debug("GITRELOAD_HOOK to %s: %s", ghurl, r.text)
#----------------------------------------
# reload course if specified
......
......@@ -266,7 +266,7 @@ def generate_plots_for_problem(problem):
yset['fitx'] = fitx
yset['fity'] = func_2pl(np.array(fitx), *cfp[0])
except Exception as err:
log.debug('Error in psychoanalyze curve fitting: %s' % err)
log.debug('Error in psychoanalyze curve fitting: %s', err)
dataset['grade_%d' % grade] = yset
......@@ -339,14 +339,14 @@ def make_psychometrics_data_update_handler(course_id, user, module_state_key):
state = json.loads(sm.state)
done = state['done']
except:
log.exception("Oops, failed to eval state for %s (state=%s)" % (sm, sm.state))
log.exception("Oops, failed to eval state for %s (state=%s)", sm, sm.state)
return
pmd.done = done
try:
pmd.attempts = state.get('attempts', 0)
except:
log.exception("no attempts for %s (state=%s)" % (sm, sm.state))
log.exception("no attempts for %s (state=%s)", sm, sm.state)
try:
checktimes = eval(pmd.checktimes) # update log of attempt timestamps
......@@ -357,6 +357,6 @@ def make_psychometrics_data_update_handler(course_id, user, module_state_key):
try:
pmd.save()
except:
log.exception("Error in updating psychometrics data for %s" % sm)
log.exception("Error in updating psychometrics data for %s", sm)
return psychometrics_data_update_handler
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment