本文整理匯總了Python中timeline.Timeline.span方法的典型用法代碼示例。如果您正苦於以下問題:Python Timeline.span方法的具體用法?Python Timeline.span怎麽用?Python Timeline.span使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類timeline.Timeline
的用法示例。
在下文中一共展示了Timeline.span方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: graph_package_deps
# 需要導入模塊: from timeline import Timeline [as 別名]
# 或者: from timeline.Timeline import span [as 別名]
def graph_package_deps(self, p, pngname):
tl = Timeline()
def epoch(t): return t.toordinal() #float(t.strftime("%s"))
def authColor(p): return hashColor(self.author(p))
#depbar = "LightSkyBlue"
#focalbar = "Yellow"
reflbar = "PaleGoldenrod"
vers_names = self.versions(p)
# extend each version until the end of hte subsequent version
for v,w in zip(vers_names[:-1], vers_names[1:]): # Lost author for author color
tl.span(p, epoch(self.dc[p][v]), epoch(self.dc[p][w]), p + ":" + v, v, authColor(p), None)
vlast = vers_names[-1]
tl.span(p, epoch(self.dc[p][vlast]), epoch(self.end_of_time), p + ":" + vlast, vlast, authColor(p), None)
for dep in self.dependencies(p):
for (ref,st,en) in self.dep_version_spans(p, dep):
tl.span(dep, epoch(st), epoch(en), dep + "::" + ref, ref, reflbar, "bottom")
depvers = self.dep_versions(p, dep)
try:
vn2 = self.versions(dep)
for vv,ww in zip(vn2[:-1], vn2[1:]):
self.logwith( "deploop", vv,ww, self.dc[dep].keys())
tl.span(dep, epoch(self.dc[dep][vv]), epoch(self.dc[dep][ww]),
dep + ":" + vv, vv, authColor(dep), "top")
vvlast = vn2[-1]
tl.span(dep, epoch(self.dc[dep][vvlast]), epoch(self.end_of_time),
dep + ":" + vvlast, vvlast, authColor(dep), "top")
except Exception, e:
self.logwith("Exception processing dependency", dep, e)
for vn in vers_names:
if vn in depvers:
dep_ver = self.extractVersionLimiter(depvers[vn])
self.logwith( dep_ver)
destrec = tl.findByKey(dep + ":" + dep_ver)
srcrec = tl.findByKey(p + ":" + vn)
if len(destrec) > 0 and len(srcrec) > 0:
tl.connect(destrec[0], srcrec[0])
self.logwith( "version", vn, "of", p, "did link to dependency", dep, "version", dep_ver)
else:
self.logwith( "version", vn, "of", p, "***can't*** find dependency", \
dep, "version", dep_ver, "lendestrec=", len(destrec), "lensrcrec=", len(srcrec))
else:
self.logwith(vn,"is not in",list(depvers))
self.logwith( "version", vn, "of", p, "did not update dependency on", dep)
示例2: graph_package_downstreams
# 需要導入模塊: from timeline import Timeline [as 別名]
# 或者: from timeline.Timeline import span [as 別名]
def graph_package_downstreams(self, p, pngname):
tl = Timeline()
def epoch(t): return t.toordinal() #float(t.strftime("%s"))
def authColor(p): return hashColor(self.author(p))
reflbar = "PaleGoldenrod"
vers_names = self.versions(p)
# Just show the first 20; the image gets too big otherwise
for dep in list(self.reverse_dependencies(p))[:20]:
for (ref,st,en) in self.dep_version_spans(dep, p):
try:
vname = str(ref).strip()
if vname == "": vname = "*"
except:
self.logwith("Could not correct version name ", ref)
vname = ref
tl.span(dep, epoch(st), epoch(en), dep + "::" + ref, "-->" + vname, reflbar, "bottom", invisibleBar=True)
depvers = self.dep_versions(dep, p)
try:
vn2 = self.versions(dep)
for vv,ww in zip(vn2[:-1], vn2[1:]):
self.logwith( "deploop", vv,ww, self.dc[dep].keys())
tl.span(dep, epoch(self.dc[dep][vv]), epoch(self.dc[dep][ww]),
dep + ":" + vv, vv, authColor(dep), "top")
vvlast = vn2[-1]
tl.span(dep, epoch(self.dc[dep][vvlast]), epoch(self.end_of_time),
dep + ":" + vvlast, vvlast, authColor(dep), "top")
except Exception, e:
self.logwith("Exception processing dependency", dep, e)
for vn in vers_names:
if vn in depvers:
dep_ver = self.extractVersionLimiter(depvers[vn])
self.logwith( dep_ver)
destrec = tl.findByKey(dep + ":" + dep_ver)
srcrec = tl.findByKey(p + ":" + vn)
if len(destrec) > 0 and len(srcrec) > 0:
tl.connect(destrec[0], srcrec[0])
self.logwith( "version", vn, "of", p, "did link to dependency", dep, "version", dep_ver)
else:
self.logwith( "version", vn, "of", p, "***can't*** find dependency", \
dep, "version", dep_ver, "lendestrec=", len(destrec), "lensrcrec=", len(srcrec))
else:
self.logwith(vn,"is not in",list(depvers))
self.logwith( "version", vn, "of", p, "did not update dependency on", dep)