def _get_greatest_timeline(self, upstream, downstream): versions = VersionTree(upstream) greatest = Timeline(default="0") for date in downstream: version = downstream[date] greatest[date] = versions.max(greatest[-1],version) return greatest
def get_greatest_timeline(self): versions = VersionTree(self.timeline) greatest = Timeline(default="0") for date in self.timeline: versions.add_release(date, self.timeline[date]) greatest[date] = versions.max(greatest[-1], self.timeline[date]) return greatest
def _get_greatest_timeline(self, upstream, downstream): versions = VersionTree(upstream) greatest = Timeline(default="0") for date in downstream: version = downstream[date] greatest[date] = versions.max(greatest[-1], version) return greatest
def _compute_package_age(self, upstream, downstream): ms = timedelta(microseconds=1) versions = VersionTree() age = ConnectedTimeline(default=timedelta()) greatest_downstream = "0" u = 0 d = 0 #print #print "interleave" #interleave the dates while u + d < len(upstream) + len(downstream): version = None date = None if u < len(upstream) and ( len(downstream) == d or upstream.keys()[u] <= downstream.keys()[d]): if VERBOSE: print "upstream", upstream.keys()[u], upstream[u] date = upstream.keys()[u] version = upstream[u] versions.add_release(date, version) if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) u += 1 else: version = downstream[d] date = downstream.keys()[d] if VERBOSE: print "downstream", date, version if VERBOSE: print greatest_downstream, version if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) greatest_downstream = versions.max(greatest_downstream, version) if VERBOSE: print greatest_downstream age[date + ms] = versions.compute_lag(date, greatest_downstream) d += 1 #print #print "age" now = self._now if now == None: now = datetime.now() if greatest_downstream != None: age[now] = versions.compute_lag(now, greatest_downstream) if VERBOSE or VERBOSE_RESULT: for a in age: print a, age[a] print return age
def _compute_package_age(self, upstream, downstream): ms = timedelta(microseconds=1) versions = VersionTree() age = ConnectedTimeline(default=timedelta()) greatest_downstream = "0" u = 0 d = 0 #print #print "interleave" #interleave the dates while u+d < len(upstream)+len(downstream): version = None date = None if u<len(upstream) and (len(downstream)==d or upstream.keys()[u]<=downstream.keys()[d]): if VERBOSE: print "upstream",upstream.keys()[u],upstream[u] date = upstream.keys()[u] version = upstream[u] versions.add_release(date,version) if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) u+=1 else: version = downstream[d] date = downstream.keys()[d] if VERBOSE: print "downstream", date, version if VERBOSE: print greatest_downstream, version if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) greatest_downstream = versions.max(greatest_downstream,version) if VERBOSE: print greatest_downstream age[date+ms] = versions.compute_lag(date, greatest_downstream) d+=1 #print #print "age" now = self._now if now==None: now = datetime.now() if greatest_downstream!=None: age[now] = versions.compute_lag(now, greatest_downstream) if VERBOSE or VERBOSE_RESULT: for a in age: print a,age[a] print return age