MCPcopy Create free account
hub / github.com/Relento/lego_release / begin_html

Method begin_html

util/html_table.py:52–72  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

50 self.end_html()
51
52 def begin_html(self):
53 if osp.isfile(self.visdir):
54 raise FileExistsError('Visualization dir "{}" is a file.'.format(self.visdir))
55 elif osp.isdir(self.visdir):
56 if yes_or_no('Visualization dir "{}" is not empty. Do you want to overwrite?'.format(self.visdir)):
57 shutil.rmtree(self.visdir)
58 else:
59 raise FileExistsError('Visualization dir "{}" already exists.'.format(self.visdir))
60
61 os.makedirs(self.visdir, exist_ok=True)
62 os.makedirs(osp.join(self.visdir, 'assets'), exist_ok=True)
63 self._index_file = open(self.get_index_filename(), 'w')
64 self._print('<html>')
65 self._print('<head>')
66 self._print('<title>{}</title>'.format(self.title))
67 self._print('<style>')
68 self._print('td {vertical-align:top;padding:5px}')
69 self._print('</style>')
70 self._print('</head>')
71 self._print('<body>')
72 self._print('<h1>{}</h1>'.format(self.title))
73
74 def end_html(self):
75 self._print('</body>')

Callers 2

htmlMethod · 0.95

Calls 3

get_index_filenameMethod · 0.95
_printMethod · 0.95
yes_or_noFunction · 0.85

Tested by

no test coverage detected