Using partial instead of defining a new func

This commit is contained in:
Andrew Melton 2014-03-05 14:34:34 -05:00
parent 8bae0d4cfc
commit f0e5b243c6
2 changed files with 5 additions and 4 deletions

View File

@ -20,6 +20,7 @@
import argparse
import datetime
import functools
import json
import sys
import os
@ -197,9 +198,9 @@ def audit_for_period(beginning, ending, ums=False, ums_offset=0):
ending_decimal = dt.dt_to_decimal(ending)
if ums:
def verifier_audit_func(start, end, model):
return usage_audit._verifier_audit_for_day_ums(start, end, model,
ums_offset)
verifier_audit_func = functools.partial(
usage_audit._verifier_audit_for_day_ums, ums_offset=ums_offset
)
else:
verifier_audit_func = usage_audit._verifier_audit_for_day

View File

@ -94,7 +94,7 @@ def _verifier_audit_for_day(beginning, ending, exists_model):
return _verified_audit_base(base_query, exists_model)
def _verifier_audit_for_day_ums(beginning, ending, exists_model, ums_offset):
def _verifier_audit_for_day_ums(beginning, ending, exists_model, ums_offset=0):
# NOTE(apmelton):
# This is the UMS query we're trying to match.
# where (