From e74482626c8d24cf0d477cbb6f5d7290720197dc Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Wed, 26 Jul 2023 09:50:44 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=B8=20Type=20annotate=20FeatureMan?= =?UTF-8?q?ager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lnschema_core/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lnschema_core/models.py b/lnschema_core/models.py index 9bdfba90..958719f9 100644 --- a/lnschema_core/models.py +++ b/lnschema_core/models.py @@ -18,6 +18,7 @@ from django.db import models from django.db.models import CASCADE, PROTECT from django.db.models.query_utils import DeferredAttribute as Field +from lamindb_setup import _check_instance_setup from upath import UPath from lnschema_core.mocks import AnnDataAccessor, BackedAccessor, QuerySet @@ -27,8 +28,12 @@ from .types import TransformType from .users import current_user_id -if TYPE_CHECKING: +_INSTANCE_SETUP = _check_instance_setup() + +if TYPE_CHECKING or _INSTANCE_SETUP: import pandas as pd + from lamindb.dev import FeatureManager + IPYTHON = getattr(builtins, "__IPYTHON__", False) TRANSFORM_TYPE_DEFAULT = TransformType.notebook if IPYTHON else TransformType.pipeline @@ -1490,7 +1495,7 @@ def save(self, *args, **kwargs) -> None: pass @property - def features(self): + def features(self) -> "FeatureManager": """Feature manager (:class:`~lamindb.dev.FeatureManager`).""" from lamindb._feature_manager import FeatureManager From 273a348d257b9857a3e09cdee2f99b219745763d Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Wed, 26 Jul 2023 10:35:50 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Turn=20into=20abstract?= =?UTF-8?q?=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lnschema_core/models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lnschema_core/models.py b/lnschema_core/models.py index 958719f9..a0a8dd94 100644 --- a/lnschema_core/models.py +++ b/lnschema_core/models.py @@ -1497,9 +1497,7 @@ def save(self, *args, **kwargs) -> None: @property def features(self) -> "FeatureManager": """Feature manager (:class:`~lamindb.dev.FeatureManager`).""" - from lamindb._feature_manager import FeatureManager - - return FeatureManager(self) + pass class Dataset(ORM):