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

Method canonize_link

util/html_table.py:172–185  ·  view source on GitHub ↗
(self, filetype, obj, row_identifier=None, col_identifier=None)

Source from the content-addressed store, hash-verified

170 return filename
171
172 def canonize_link(self, filetype, obj, row_identifier=None, col_identifier=None):
173 if filetype == 'file':
174 assert isinstance(obj, six.string_types)
175 return osp.relpath(obj, self.visdir), osp.basename(obj)
176 elif filetype == 'image':
177 if not isinstance(obj, six.string_types):
178 obj = self.save_image(obj, row_identifier, col_identifier)
179 return osp.relpath(obj, self.visdir), osp.basename(obj)
180 elif filetype == 'figure':
181 if not isinstance(obj, six.string_types):
182 obj = self.save_figure(obj, row_identifier, col_identifier)
183 return osp.relpath(obj, self.visdir), osp.basename(obj)
184 else:
185 raise ValueError('Unknown file type: {}.'.format(filetype))
186
187
188def yes_or_no(question, default="yes"):

Callers 1

rowMethod · 0.95

Calls 2

save_imageMethod · 0.95
save_figureMethod · 0.95

Tested by

no test coverage detected