Convert the DVC Plots content to DVC Render datapoints. Return both generated datapoints and updated properties.
(self, revision: str)
| 39 | return datas, self.properties |
| 40 | |
| 41 | def flat_datapoints(self, revision: str) -> tuple[list[dict], dict]: |
| 42 | """ |
| 43 | Convert the DVC Plots content to DVC Render datapoints. |
| 44 | Return both generated datapoints and updated properties. |
| 45 | """ |
| 46 | path = self.properties.get("out") |
| 47 | datapoints = [] |
| 48 | datas, properties = self.convert() |
| 49 | for filename, _, image_data in datas: |
| 50 | if path: |
| 51 | if not os.path.isdir(path): |
| 52 | os.makedirs(path, exist_ok=True) |
| 53 | src = self._write_image( |
| 54 | os.path.abspath(path), revision, filename, image_data |
| 55 | ) |
| 56 | else: |
| 57 | src = self._encode_image(image_data) |
| 58 | datapoint = {REVISION: revision, FILENAME: filename, SRC: src} |
| 59 | datapoints.append(datapoint) |
| 60 | return datapoints, properties |