From ecd5d14f4e08e51da76a330a252b77bf701a66a9 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Thu, 14 Nov 2024 16:53:36 +0100 Subject: [PATCH 1/2] fix documentation, add .gif --- lamindb/core/loaders.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lamindb/core/loaders.py b/lamindb/core/loaders.py index 89c0c6104..c879a8991 100644 --- a/lamindb/core/loaders.py +++ b/lamindb/core/loaders.py @@ -109,7 +109,7 @@ def load_json(path: UPathStr) -> dict: def load_image(path: UPathStr): - """Display `.svg` in ipython, otherwise return path.""" + """Display `.jpg`, `.png` or `.gif` in ipython, otherwise return path.""" if is_run_from_ipython: from IPython.display import Image, display @@ -141,6 +141,7 @@ def load_svg(path: UPathStr) -> None | Path: ".h5mu": load_h5mu, ".jpg": load_image, ".png": load_image, + ".gif": load_image, ".svg": load_svg, } From 6315c4c188e577c4de8f60c1df96e422b0cc70a8 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Thu, 14 Nov 2024 16:53:43 +0100 Subject: [PATCH 2/2] add yaml data loader --- lamindb/core/loaders.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lamindb/core/loaders.py b/lamindb/core/loaders.py index c879a8991..f8715b915 100644 --- a/lamindb/core/loaders.py +++ b/lamindb/core/loaders.py @@ -10,6 +10,7 @@ load_h5mu load_html load_json + load_yaml load_image load_svg @@ -107,6 +108,14 @@ def load_json(path: UPathStr) -> dict: data = json.load(f) return data +def load_yaml(path: UPathStr) -> dict: + """Load `.yaml` to `dict`.""" + import yaml + + with open(path) as f: + data = yaml.safe_load(f) + return data + def load_image(path: UPathStr): """Display `.jpg`, `.png` or `.gif` in ipython, otherwise return path.""" @@ -138,6 +147,7 @@ def load_svg(path: UPathStr) -> None | Path: ".zarr": load_anndata_zarr, ".html": load_html, ".json": load_json, + ".yaml": load_yaml, ".h5mu": load_h5mu, ".jpg": load_image, ".png": load_image,