本文整理汇总了Python中HTML.link方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.link方法的具体用法?Python HTML.link怎么用?Python HTML.link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML.link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_testbeam_html_pages
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def create_testbeam_html_pages(self):
testbeams = [self.results[x].getint('RunInfo', 'runno') / 100 for x in self.results]
testbeams = sorted(list(set(testbeams)))
testbeamDate = utilities.get_dict_from_file('%s/testBeamDates.cfg' % self.config_dir)
for testbeam in testbeams:
key = '%s' % testbeam
if not key in testbeamDate:
testbeamDate[key] = 'unkown'
irr = utilities.get_dict_from_file('%s/irradiationType.cfg' % self.config_dir)
allDiamonds = self.get_list_of_diamonds(self.results)
allDiamonds = sorted(allDiamonds, key=lambda z: '%s-%s' % (irr.get(z, 'unkown'), z))
allDiamondLinks = map(lambda z: HTML.link('%s (%s)' % (z, irr.get(z, 'unknown')), 'results_%s.html' % z),
allDiamonds)
testBeamLinkTable = []
header = [HTML.link('Test Beam', 'results.html')] + allDiamondLinks
for testbeam in testbeams:
results = filter(lambda z: self.results[z].getint('RunInfo', 'runno') / 100 == testbeam, self.results)
results = {key: self.results[key] for key in results}
diamonds = self.get_list_of_diamonds(results)
# results = sorted(results,key=itemgetter(mapping['RunNo'],mapping['dia'],mapping['corrected']))
print testbeam, len(results), diamonds
fileName = '%s/results_%sXX.html' % (self.config.get('HTML', 'outputDir'), testbeam)
fileName = fileName.replace('//', '/')
# raw_input(fileName)
self.create_html_overview_table(results, fileName)
fileName = 'results_%sXX.html' % testbeam
row = [HTML.link('%sXX - %s ' % (testbeam, testbeamDate['%s' % testbeam]), fileName)] + map(
lambda z: z in diamonds, allDiamonds)
testBeamLinkTable.append(row)
htmlcode = HTML.table(testBeamLinkTable, header_row=header)
fileName = '%s/results_testBeams.html' % self.config.get('HTML', 'outputDir')
utilities.save_html_code(fileName, htmlcode)
示例2: link
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def link(tmp_list):
"""
generate links to Tapper
"""
if len(tmp_list) > 1:
link_html = HTML.link("results+", "https://tapper/tapper/reports/idlist/" + ",".join(str(l) for l in tmp_list))
elif len(tmp_list) == 1:
link_html = HTML.link("results", "https://tapper/tapper/reports/id/" + ",".join(str(l) for l in tmp_list))
return link_html
示例3: make_debian_links
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def make_debian_links(pkg, version):
"""Return a string containing debian links for a package"""
pts_base = "http://packages.qa.debian.org/"
bts_base = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src="
deb_buildd_base = "https://buildd.debian.org/status/logs.php?arch=&pkg="
pts = HTML.link('PTS', pts_base + pkg)
bts = HTML.link('BTS', bts_base + pkg)
deb_buildd = HTML.link('Buildd', deb_buildd_base + pkg)
return " ".join((pts, bts, deb_buildd))
示例4: link
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def link(tmp_list):
'''
generate links to Tapper
'''
if len(tmp_list) > 1:
link_html = HTML.link('results+',
'https://tapper/tapper/reports/idlist/' +
','.join(str(l) for l in tmp_list))
elif len(tmp_list) == 1:
link_html = HTML.link('results',
'https://tapper/tapper/reports/id/' +
','.join(str(l) for l in tmp_list))
return link_html
示例5: make_ubuntu_links
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def make_ubuntu_links(pkg, version):
"""Return a string containing ubuntu links for a package"""
puc_base = "http://packages.ubuntu.com/search?searchon=sourcenames&keywords="
lp_base = "https://launchpad.net/ubuntu/+source/"
ubu_bugs_base = "https://launchpad.net/ubuntu/+source/%s/+bugs"
ubu_buildd_base = "https://launchpad.net/ubuntu/+source/%s/%s"
puc = HTML.link('packages.u.c.', puc_base + pkg)
lp = HTML.link('LP', lp_base + pkg)
ubu_bugs = HTML.link('Bugs', ubu_bugs_base % pkg)
ubu_buildd = HTML.link('Buildd', ubu_buildd_base % (pkg, version))
return " ".join((puc, lp, ubu_bugs, ubu_buildd))
示例6: form_linklist
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def form_linklist(linklist,fname,oligo=0):
if oligo==0:
linklist.append(
{'linktype':'data','deep':fname.compdeep,'type':fname.comptype,
'link':HTML.link(fname.get_level(),fname.get_name())
}
)
else:
linklist.append(
{'linktype':'table','deep':fname.compdeep,'type':fname.comptype,
'link':HTML.link(fname.get_level(),fname.path+str(oligo)+'-plet_'+fname.get_level()+'.html'),
'oligo':oligo
}
)
示例7: WriteToStaticHtmlFile
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def WriteToStaticHtmlFile(filename, content, anchor):
link = 'smart-stocker/' + filename
filename = WWW_ROOT + '/' + link
with open(filename, 'w') as output_file:
os.chmod(filename, 0o600)
output_file.write(content)
return HTML.link(anchor, link)
示例8: count_letters_and_write_to_file
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def count_letters_and_write_to_file(seq,inputfile):
'''запись 1 отчета в файл'''
seq=seq.lower()
## print seq,len(seq)
c=seq.count('c');g=seq.count('g');a=seq.count('a');t=seq.count('t') # подсчет букв
S=float(c+g+a+t)
## print S
CG=float(c+g)
AT=float(a+t)
outfile=inputfile.copy()
outfile.ext='.html'
outf=open(outfile.get_name(),'w')
def p(l):
'проценты'
return ' ('+str(round(l*100/S,2))+' %)'
print >> outf, HTML.link('Home','../report.html'),'<br><hr>',outfile.name,'<br><hr>'
print >> outf, 'conv. level:',outfile.get_level(),'<br><hr>'
## print >> outf, 'total amount of all letters:',S,'<br>'
## print >> outf, 'number of letters c:',c,p(c),'<br>'
## print >> outf, 'number of letters g:',g,p(g),'<br>'
## print >> outf, 'number of letters a:',a,p(a),'<br>'
## print >> outf, 'number of letters t:',t,p(t),'<br>'
## print >> outf, 'total number of letters (c+g):', CG, p(CG),'<br>'
## print >> outf, 'total number of letters (a+t):', AT, p(AT),'<br>'
## print >> outf, 'relevant amounts of pairs of letters: (a+t)/(c+g):', round(AT/CG,3),'<br>'
## print >> outf, 'pairwise relationship of letters: a/c:', round(a/c,3),'<br>'
## print >> outf, 'pairwise relationship of letters: a/g:', round(a/g,3),'<br>'
## print >> outf, 'pairwise relationship of letters: a/t:', round(a/t,3),'<br>'
## print >> outf, 'pairwise relationship of letters: g/c:', round(g/c,3),'<br>'
## print >> outf, '<br><hr>'
return outf
示例9: get_link
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def get_link(value, string_format, haslink, result):
mainLink = result.get('RunInfo', 'mainLink')
if haslink != 'None':
# print haslink
if '%(mainLink' in haslink and haslink.endswith('>)'):
divided = haslink.rsplit('%', 1)
# print 'divided "%s"'%divided
entries = divided[1].strip('()')
entries = entries.rsplit('<')
entry = entries[-1].strip('<>').split(',')
# print entry
link = divided[0].strip("'") % (mainLink, result.get(entry[0], entry[1]))
elif '%mainLink' in haslink:
links = haslink.rsplit('%', 1)
# replace('%mainLink','')%mainLink
link = links[0].strip("'") % mainLink
elif '%diamondName' in haslink:
links = haslink.rsplit('%', 1)
# replace('%mainLink','')%mainLink
link = links[0].strip("'") % result.get('RunInfo','dia')
else:
link = haslink
try:
website = string_format % value
except:
print 'ERROR could not convert "%s"' % string_format
website = string_format
ouput_link = HTML.link(website, link)
return ouput_link
try:
website = string_format % value
except:
print 'ERROR could not convert "%s"' % string_format
website = string_format
return website
示例10: form_linklist
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def form_linklist(linklist,filename):
fname=filename.copy()
fname.ext='.html'
linklist.append(
{'deep':fname.compdeep,'type':fname.comptype,
'link':HTML.link(fname.get_level(),'report/'+fname.get_name().rpartition('/')[2])
}
)
示例11: feed2html
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def feed2html(self, feed):
table_data = []
entrylist = []
for entry in feed.entry:
entrylist = [ HTML.link(entry.media.title.text,entry.media.player.url), entry.published.text[:10], entry.media.category[0].text, self.sec2time(entry.media.duration.seconds), self.formatViewCount(entry.statistics.view_count), '%.2f'%float(entry.rating.average)]
table_data.append(entrylist)
html_string = HTML.table(table_data, header_row=['Video title','Video published on','Video category','Video duration','Video view count','Video rating'])
return html_string
示例12: set_header
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def set_header(self):
headers = []
header_keys = []
mapping = OrderedDict()
header_list = self.config.options('HTML-header')
# print list
for i in header_list:
content = self.config.get('HTML-header', i).split(';')
header_keys.append(content[0])
if content[0] == 'RunNo':
headers.append(HTML.link('RunNo', 'results.html'))
elif content[0] == 'Diamond':
headers.append(HTML.link('Diamond', 'results_diamonds.html'))
else:
headers.append(content[0])
key = content[0]
content = content[1:]
newcontent = {}
keylist = -1
k = 0
for j in content:
if j.startswith('<') and j.endswith('>'):
m = j.strip('<>').strip().split(',')
newcontent['key'] = [l.strip() for l in m]
keylist = content.index(j)
elif content.index(j) == keylist + 1 and keylist != -1:
newcontent['valueType'] = j
elif content.index(j) == keylist + 2 and keylist != -1:
newcontent['default'] = j
elif j.startswith('TITLE[') and j.endswith(']'):
newcontent['title'] = j.strip('TITLE[]').strip("'")
else:
newcontent['info_%d' % k] = j
k += 1
mapping[key] = newcontent
for i in headers:
if 'href' in i:
pass
else:
pass
self.headers = headers
self.header_mapping = mapping
self.header_keys = header_keys
示例13: form_report
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def form_report(path,linklist,oligolist,compopt):
## linktab=HTML.link('Tables','report/tables.html')
linkdata=HTML.link('datafiles','report/data.html')
linkhome=HTML.link('Home','../report.html')
htmlcode=('<haed><link rel="stylesheet" type="text/css" href="http://matrix.petoukhov.com/css/default.css"'
+'media="screen" /></haed><br>'+linkdata+'<hr><br>'
)
data=('<haed><link rel="stylesheet" type="text/css" href="http://matrix.petoukhov.com/css/default.css"'
+'media="screen" /></haed>'
)
dtab=[]
for d in xrange(compopt['compdeep']+1):
dtab.append(['deep='+str(d)])
tables=''
oltab={}.fromkeys(oligolist)
for olt in oltab:
l=[]
l.append([str(olt)+'-plet'])
for d in xrange(compopt['compdeep']+1):
l.append(['deep='+str(d)])
oltab[olt]=l
for dlink in linklist:
if dlink['linktype']=='data':
dtab[dlink['deep']].append(dlink['link'])
else:
oltab[dlink['oligo']][dlink['deep']+1].append(dlink['link'])
for ot in oltab:
tables+=HTML.table(oltab[ot])
tables+='<hr><br>'
htmlcode+=tables
frep=open(path+'/report.html','w')
frep.write(htmlcode)
frep.close()
data+=linkhome+'<hr><br>'+HTML.table(dtab)
fdata=open(path+'/report/data.html','w')
fdata.write(data)
fdata.close()
示例14: html_write
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def html_write(info,data,oligo,inputfile,linklist):
tabinfo=HTML.table(info)
tab=HTML.table(data)
linkhome=HTML.link('Home','../report.html')
htmlcode=('<haed><link rel="stylesheet" type="text/css" href="http://matrix.petoukhov.com/css/default.css"'
+ 'media="screen" /></haed>'+linkhome+'<hr><br>'+ tabinfo+'<hr><br>'+tab
)
fname=inputfile.path+str(oligo)+'-plet_'+inputfile.get_level()+'.html'
fres=open(fname,'w')
fres.write(htmlcode)
fres.close()
form_linklist(linklist,inputfile,oligo)
示例15: PreProcessData
# 需要导入模块: import HTML [as 别名]
# 或者: from HTML import link [as 别名]
def PreProcessData(assigned, submitted, cc_comment, patchlog, reviews, bug_x_desc):
assigned_final = []
submitted_final = []
cc_comment_final = []
patchlog_final = []
reviews_final = []
for elt in assigned:
desc = elt[1]
if bug_x_desc.has_key(elt[0]):
desc = bug_x_desc.get(elt[0])
assigned_final.append((HTML.link(elt[0], 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + str(elt[0])),
cgi.escape(desc),
'<div><span class="lastTouch" title="' + str(elt[2]) + '">' + str(pretty_date(elt[2])) + '</span></div>',
cgi.escape(elt[3])))
for elt in submitted:
desc = elt[1]
if bug_x_desc.has_key(elt[0]):
desc = bug_x_desc.get(elt[0])
submitted_final.append((HTML.link(elt[0], 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + str(elt[0])),
cgi.escape(desc),
'<div><span class="lastTouch" title="' + str(elt[2]) + '">' + str(pretty_date(elt[2])) + '</span></div>',
cgi.escape(elt[3])))
for elt in cc_comment:
desc = elt[1]
if bug_x_desc.has_key(elt[0]):
desc = bug_x_desc.get(elt[0])
cc_comment_final.append((HTML.link(elt[0], 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + str(elt[0])),
cgi.escape(desc),
'<div><span class="lastTouch" title="' + str(elt[2]) + '">' + str(pretty_date(elt[2])) + '</span></div>',
cgi.escape(elt[3])))
history = list(set(submitted_final + assigned_final + cc_comment_final))
for elt in patchlog:
patchlog_final.append((HTML.link(elt[0], 'https://bug' + str(elt[1]) + '.bugzilla.mozilla.org/attachment.cgi?id=' + str(elt[0])),
HTML.link(elt[1], 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + str(elt[1])),
elt[2],
elt[3],
'<div><span class="lastTouch" title="' + str(elt[4]) + '">' + str(pretty_date(elt[4])) + '</span></div>',
cgi.escape(elt[5])))
for elt in reviews:
reviews_final.append((HTML.link(elt[0], 'https://bug' + str(elt[1]) + '.bugzilla.mozilla.org/attachment.cgi?id=' + str(elt[0])),
HTML.link(elt[1], 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + str(elt[1])),
elt[2],
elt[3],
'<div><span class="lastTouch" title="' + str(elt[4]) + '">' + str(pretty_date(elt[4])) + '</span></div>',
cgi.escape(elt[5])))
return history, assigned_final, submitted_final, cc_comment_final, patchlog_final, reviews_final