def _ParseTimePredicate(self, after, before): """Return a predicate for filtering jobs by their creation time. Args: after: Only return true if the job was created after this time. before: Only return true if the job was created before this time. """ if after and (not before): self.preds.append( lambda x: time_util.Strptime(x.createTime) > after) elif (not after) and before: self.preds.append( lambda x: time_util.Strptime(x.createTime) <= before) elif after and before: def _Predicate(x): create_time = time_util.Strptime(x.createTime) return after < create_time and create_time <= before self.preds.append(_Predicate)
def _Predicate(x): create_time = time_util.Strptime(x.createTime) return after < create_time and create_time <= before