Skip to content

Commit

Permalink
Made selected variables private so as not to show up in docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperVanDenBosch committed Jan 20, 2015
1 parent 764d6dd commit 8f92bd4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions niprov/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class HtmlExporter(object):

header = """
_header = """
<html>
<head>
<style>
Expand All @@ -18,7 +18,7 @@ class HtmlExporter(object):
</head>
<h1>Provenance</h1>
"""
tableheader ="""
_tableheader ="""
<table>
<thead>
<tr>
Expand All @@ -30,9 +30,9 @@ class HtmlExporter(object):
</thead>
<tbody>
"""
footer = '</html>'
expectedFields = ['acquired','subject','protocol']
allfields = ['path','ancestor','acquired','subject','protocol','transformation','code','logtext']
_footer = '</html>'
_expectedFields = ['acquired','subject','protocol']
_allfields = ['path','ancestor','acquired','subject','protocol','transformation','code','logtext']

def __init__(self, filesys, listener, externals):
self.filesys = filesys
Expand All @@ -47,18 +47,18 @@ def exportList(self, provenance):
"""
itemfmt = '<tr><td>{0[acquired]}</td><td>{0[subject]}</td><td>{0[protocol]}</td><td>{1}</td></tr>\n'
with self.filesys.open('provenance.html','w') as htmlfile:
htmlfile.write(self.header)
htmlfile.write(self.tableheader)
htmlfile.write(self._header)
htmlfile.write(self._tableheader)
for provitem in provenance:
for field in self.expectedFields:
for field in self._expectedFields:
if not (field in provitem):
provitem[field] = '?'
path = provitem['path']
if len(path) > 42:
path = '..'+path[-40:]
htmlfile.write(itemfmt.format(provitem, path))
htmlfile.write('</tbody></table>\n')
htmlfile.write(self.footer)
htmlfile.write(self._footer)
self.externals.run(['firefox', 'provenance.html'])

def export(self, provenance):
Expand All @@ -69,16 +69,16 @@ def export(self, provenance):
"""
provitem = provenance
keyvaluefmt = '<dt>{0}</dt><dd>{1}</dd>\n'
for field in self.expectedFields:
for field in self._expectedFields:
if not (field in provitem):
provitem[field] = '?'
with self.filesys.open('provenance.html','w') as htmlfile:
htmlfile.write(self.header)
htmlfile.write(self._header)
htmlfile.write('<dl>\n')
for field in self.allfields:
for field in self._allfields:
if field in provitem:
htmlfile.write(keyvaluefmt.format(field, provitem[field]))
htmlfile.write('</dl>\n')
htmlfile.write(self.footer)
htmlfile.write(self._footer)
self.externals.run(['firefox', 'provenance.html'])

0 comments on commit 8f92bd4

Please sign in to comment.