lamindb 0.76.15__py3-none-any.whl → 0.77.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lamindb/__init__.py +2 -2
- lamindb/_artifact.py +9 -4
- lamindb/{_can_validate.py → _can_curate.py} +32 -23
- lamindb/_curate.py +24 -13
- lamindb/_finish.py +12 -7
- lamindb/_parents.py +8 -1
- lamindb/_query_set.py +58 -13
- lamindb/_record.py +192 -62
- lamindb/core/__init__.py +4 -2
- lamindb/core/_context.py +59 -32
- lamindb/core/_django.py +2 -2
- lamindb/core/_label_manager.py +3 -3
- lamindb/core/loaders.py +15 -5
- lamindb/core/storage/_anndata_accessor.py +7 -4
- lamindb/core/storage/_zarr.py +8 -1
- {lamindb-0.76.15.dist-info → lamindb-0.77.0.dist-info}/METADATA +18 -6
- {lamindb-0.76.15.dist-info → lamindb-0.77.0.dist-info}/RECORD +19 -20
- lamindb/_filter.py +0 -21
- {lamindb-0.76.15.dist-info → lamindb-0.77.0.dist-info}/LICENSE +0 -0
- {lamindb-0.76.15.dist-info → lamindb-0.77.0.dist-info}/WHEEL +0 -0
lamindb/core/_label_manager.py
CHANGED
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING
|
|
6
6
|
import numpy as np
|
7
7
|
from django.db import connections
|
8
8
|
from lamin_utils import colors, logger
|
9
|
-
from lnschema_core.models import
|
9
|
+
from lnschema_core.models import CanCurate, Feature
|
10
10
|
|
11
11
|
from lamindb._from_values import _print_values
|
12
12
|
from lamindb._record import (
|
@@ -116,7 +116,7 @@ def validate_labels(labels: QuerySet | list | dict):
|
|
116
116
|
label_uids = np.array(
|
117
117
|
[getattr(label, field) for label in labels if label is not None]
|
118
118
|
)
|
119
|
-
if issubclass(registry,
|
119
|
+
if issubclass(registry, CanCurate):
|
120
120
|
validated = registry.validate(label_uids, field=field, mute=True)
|
121
121
|
validated_uids = label_uids[validated]
|
122
122
|
validated_labels = registry.filter(
|
@@ -202,7 +202,7 @@ class LabelManager:
|
|
202
202
|
transfer_logs = {"mapped": [], "transferred": [], "run": None}
|
203
203
|
using_key = settings._using_key
|
204
204
|
for related_name, (_, labels) in get_labels_as_dict(
|
205
|
-
data, instance=
|
205
|
+
data, instance=data._state.db
|
206
206
|
).items():
|
207
207
|
labels = labels.all()
|
208
208
|
if not labels.exists():
|
lamindb/core/loaders.py
CHANGED
@@ -24,12 +24,13 @@ from typing import TYPE_CHECKING
|
|
24
24
|
|
25
25
|
import anndata as ad
|
26
26
|
import pandas as pd
|
27
|
+
from lamin_utils import logger
|
27
28
|
from lamindb_setup.core.upath import (
|
28
29
|
create_path,
|
29
30
|
infer_filesystem,
|
30
31
|
)
|
31
32
|
|
32
|
-
from
|
33
|
+
from ._settings import settings
|
33
34
|
|
34
35
|
if TYPE_CHECKING:
|
35
36
|
import mudata as md
|
@@ -79,7 +80,7 @@ def load_h5mu(filepath: UPathStr, **kwargs):
|
|
79
80
|
return md.read_h5mu(path_sanitized, **kwargs)
|
80
81
|
|
81
82
|
|
82
|
-
def load_html(path: UPathStr):
|
83
|
+
def load_html(path: UPathStr) -> None | UPathStr:
|
83
84
|
"""Display `.html` in ipython, otherwise return path."""
|
84
85
|
if is_run_from_ipython:
|
85
86
|
with open(path, encoding="utf-8") as f:
|
@@ -95,6 +96,7 @@ def load_html(path: UPathStr):
|
|
95
96
|
from IPython.display import HTML, display
|
96
97
|
|
97
98
|
display(HTML(data=body_content))
|
99
|
+
return None
|
98
100
|
else:
|
99
101
|
return path
|
100
102
|
|
@@ -108,17 +110,18 @@ def load_json(path: UPathStr) -> dict:
|
|
108
110
|
return data
|
109
111
|
|
110
112
|
|
111
|
-
def load_image(path: UPathStr):
|
113
|
+
def load_image(path: UPathStr) -> None | UPathStr:
|
112
114
|
"""Display `.svg` in ipython, otherwise return path."""
|
113
115
|
if is_run_from_ipython:
|
114
116
|
from IPython.display import Image, display
|
115
117
|
|
116
118
|
display(Image(filename=path))
|
119
|
+
return None
|
117
120
|
else:
|
118
121
|
return path
|
119
122
|
|
120
123
|
|
121
|
-
def load_svg(path: UPathStr) -> None |
|
124
|
+
def load_svg(path: UPathStr) -> None | UPathStr:
|
122
125
|
"""Display `.svg` in ipython, otherwise return path."""
|
123
126
|
if is_run_from_ipython:
|
124
127
|
from IPython.display import SVG, display
|
@@ -129,6 +132,12 @@ def load_svg(path: UPathStr) -> None | Path:
|
|
129
132
|
return path
|
130
133
|
|
131
134
|
|
135
|
+
def load_rds(path: UPathStr) -> UPathStr:
|
136
|
+
"""Just warn when trying to load `.rds`."""
|
137
|
+
logger.warning("Please use `laminr` to load `.rds` files")
|
138
|
+
return path
|
139
|
+
|
140
|
+
|
132
141
|
FILE_LOADERS = {
|
133
142
|
".csv": pd.read_csv,
|
134
143
|
".tsv": load_tsv,
|
@@ -142,9 +151,10 @@ FILE_LOADERS = {
|
|
142
151
|
".jpg": load_image,
|
143
152
|
".png": load_image,
|
144
153
|
".svg": load_svg,
|
154
|
+
".rds": load_rds,
|
145
155
|
}
|
146
156
|
|
147
|
-
SUPPORTED_SUFFIXES =
|
157
|
+
SUPPORTED_SUFFIXES = [sfx for sfx in FILE_LOADERS.keys() if sfx != ".rds"]
|
148
158
|
"""Suffixes with defined artifact loaders."""
|
149
159
|
|
150
160
|
|
@@ -54,13 +54,16 @@ if anndata_version_parse < version.parse("0.10.0"):
|
|
54
54
|
return SparseDataset(group)
|
55
55
|
|
56
56
|
else:
|
57
|
+
if anndata_version_parse >= version.parse("0.11.0"):
|
58
|
+
from anndata._core.sparse_dataset import ( # type: ignore
|
59
|
+
_CSRDataset as CSRDataset,
|
60
|
+
)
|
61
|
+
else:
|
62
|
+
from anndata._core.sparse_dataset import CSRDataset # type: ignore
|
57
63
|
from anndata._core.sparse_dataset import (
|
58
64
|
BaseCompressedSparseDataset as SparseDataset,
|
59
65
|
)
|
60
|
-
from anndata._core.sparse_dataset import
|
61
|
-
CSRDataset,
|
62
|
-
sparse_dataset,
|
63
|
-
)
|
66
|
+
from anndata._core.sparse_dataset import sparse_dataset # type: ignore
|
64
67
|
|
65
68
|
def _check_group_format(*args):
|
66
69
|
pass
|
lamindb/core/storage/_zarr.py
CHANGED
@@ -5,14 +5,21 @@ from typing import TYPE_CHECKING
|
|
5
5
|
|
6
6
|
import scipy.sparse as sparse
|
7
7
|
import zarr
|
8
|
-
from anndata
|
8
|
+
from anndata import __version__ as anndata_version
|
9
9
|
from anndata._io.specs import write_elem
|
10
10
|
from anndata._io.specs.registry import get_spec
|
11
11
|
from fsspec.implementations.local import LocalFileSystem
|
12
12
|
from lamindb_setup.core.upath import create_mapper, infer_filesystem
|
13
|
+
from packaging import version
|
13
14
|
|
14
15
|
from ._anndata_sizes import _size_elem, _size_raw, size_adata
|
15
16
|
|
17
|
+
if version.parse(anndata_version) < version.parse("0.11.0"):
|
18
|
+
from anndata._io import read_zarr
|
19
|
+
else:
|
20
|
+
from anndata.io import read_zarr
|
21
|
+
|
22
|
+
|
16
23
|
if TYPE_CHECKING:
|
17
24
|
from anndata import AnnData
|
18
25
|
from lamindb_setup.core.types import UPathStr
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lamindb
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.77.0
|
4
4
|
Summary: A data framework for biology.
|
5
5
|
Author-email: Lamin Labs <open-source@lamin.ai>
|
6
6
|
Requires-Python: >=3.9,<3.13
|
@@ -9,20 +9,22 @@ Classifier: Programming Language :: Python :: 3.9
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.10
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
12
|
-
Requires-Dist: lnschema_core==0.
|
13
|
-
Requires-Dist: lamin_utils==0.13.
|
14
|
-
Requires-Dist: lamin_cli==0.
|
12
|
+
Requires-Dist: lnschema_core==0.77.0
|
13
|
+
Requires-Dist: lamin_utils==0.13.8
|
14
|
+
Requires-Dist: lamin_cli==0.21.3
|
15
15
|
Requires-Dist: lamindb_setup
|
16
16
|
Requires-Dist: rapidfuzz
|
17
17
|
Requires-Dist: pyarrow
|
18
18
|
Requires-Dist: typing_extensions!=4.6.0
|
19
19
|
Requires-Dist: python-dateutil
|
20
|
-
Requires-Dist: anndata>=0.8.0,<=0.
|
20
|
+
Requires-Dist: anndata>=0.8.0,<=0.11.1
|
21
21
|
Requires-Dist: fsspec
|
22
22
|
Requires-Dist: graphviz
|
23
23
|
Requires-Dist: psycopg2-binary
|
24
24
|
Requires-Dist: lamindb_setup[aws] ; extra == "aws"
|
25
|
-
Requires-Dist: bionty==0.
|
25
|
+
Requires-Dist: bionty==0.53.1 ; extra == "bionty"
|
26
|
+
Requires-Dist: cellregistry ; extra == "cellregistry"
|
27
|
+
Requires-Dist: clinicore ; extra == "clinicore"
|
26
28
|
Requires-Dist: line_profiler ; extra == "dev"
|
27
29
|
Requires-Dist: pre-commit ; extra == "dev"
|
28
30
|
Requires-Dist: nox ; extra == "dev"
|
@@ -35,19 +37,29 @@ Requires-Dist: nbproject_test>=0.5.1 ; extra == "dev"
|
|
35
37
|
Requires-Dist: faker-biology ; extra == "dev"
|
36
38
|
Requires-Dist: django-schema-graph ; extra == "erdiagram"
|
37
39
|
Requires-Dist: readfcs>=1.1.9 ; extra == "fcs"
|
40
|
+
Requires-Dist: findrefs ; extra == "findrefs"
|
38
41
|
Requires-Dist: lamindb_setup[gcp] ; extra == "gcp"
|
39
42
|
Requires-Dist: nbproject==0.10.5 ; extra == "jupyter"
|
40
43
|
Requires-Dist: jupytext ; extra == "jupyter"
|
41
44
|
Requires-Dist: nbconvert ; extra == "jupyter"
|
45
|
+
Requires-Dist: omop ; extra == "omop"
|
46
|
+
Requires-Dist: ourprojects ; extra == "ourprojects"
|
47
|
+
Requires-Dist: wetlab ; extra == "wetlab"
|
42
48
|
Requires-Dist: zarr>=2.16.0 ; extra == "zarr"
|
43
49
|
Project-URL: Home, https://github.com/laminlabs/lamindb
|
44
50
|
Provides-Extra: aws
|
45
51
|
Provides-Extra: bionty
|
52
|
+
Provides-Extra: cellregistry
|
53
|
+
Provides-Extra: clinicore
|
46
54
|
Provides-Extra: dev
|
47
55
|
Provides-Extra: erdiagram
|
48
56
|
Provides-Extra: fcs
|
57
|
+
Provides-Extra: findrefs
|
49
58
|
Provides-Extra: gcp
|
50
59
|
Provides-Extra: jupyter
|
60
|
+
Provides-Extra: omop
|
61
|
+
Provides-Extra: ourprojects
|
62
|
+
Provides-Extra: wetlab
|
51
63
|
Provides-Extra: zarr
|
52
64
|
|
53
65
|
[](https://github.com/laminlabs/lamindb)
|
@@ -1,18 +1,17 @@
|
|
1
|
-
lamindb/__init__.py,sha256=
|
2
|
-
lamindb/_artifact.py,sha256=
|
3
|
-
lamindb/
|
1
|
+
lamindb/__init__.py,sha256=6E6iDqtEpPJwkp-5H-1Om9KnyDYDyFUBKEF3_mXFDhM,2275
|
2
|
+
lamindb/_artifact.py,sha256=4sHLnJQdWAjplB-dk0JXzhrHaaDn2ri5SeyvA7yzajQ,45166
|
3
|
+
lamindb/_can_curate.py,sha256=LhF78TqMUMsOXxy8ODZX9FLlH1-zszR9sKh3l6iVQ4o,19942
|
4
4
|
lamindb/_collection.py,sha256=MLOEoOgTu7rTlRD7zkm1k0YIk_gVhQDO17JbmZCptOs,14573
|
5
|
-
lamindb/_curate.py,sha256=
|
5
|
+
lamindb/_curate.py,sha256=BoZgaBBPK8aUggHmZMqbRjRCBL9CDHQCiWw4Kzg-_ww,64491
|
6
6
|
lamindb/_feature.py,sha256=9cgrcHoyOa1jpON-9KiUfFSHcxiGECiefUAqAx4cVvU,5325
|
7
7
|
lamindb/_feature_set.py,sha256=WdXw_YGlMXCs8l0WVHOrqvvrH2hsQLqCiho8LFDYwhI,8161
|
8
|
-
lamindb/
|
9
|
-
lamindb/_finish.py,sha256=VMAmxCUFmTKIMSCx7LEh4QAnWDeue6MeUAAzkMVEYMU,9546
|
8
|
+
lamindb/_finish.py,sha256=r8q6rhml2vHiDlojCnfSpS8pbfnq7u6MwIcBIwuVq2o,9745
|
10
9
|
lamindb/_from_values.py,sha256=uRtZLaMWKoANMMXm1hrADHfckRCTiK8_d02Yp07nLkw,14119
|
11
10
|
lamindb/_is_versioned.py,sha256=GWZk-usV6aB33Cl9AlrnEGE5nxUkZic7QJzOW_DrwQA,1298
|
12
|
-
lamindb/_parents.py,sha256=
|
11
|
+
lamindb/_parents.py,sha256=GTbDL4P9LnaoNXMe6uOrp4g_Q4ZUAEaW0tHULrBt8tU,17203
|
13
12
|
lamindb/_query_manager.py,sha256=noc05Ad-aADxckOVBVDAiErFB7gL8XTgckELvI4rGmM,3702
|
14
|
-
lamindb/_query_set.py,sha256=
|
15
|
-
lamindb/_record.py,sha256=
|
13
|
+
lamindb/_query_set.py,sha256=dGEJuQsYrzc-mPdHSRjMPHWrri8Fg78I10AsT18jomI,14666
|
14
|
+
lamindb/_record.py,sha256=5zpRt5mCSzlYxHlrMqDnduoRCx5ZiTUJyoJjFMmuVHY,31522
|
16
15
|
lamindb/_run.py,sha256=K_5drpLn3D7y3XtZ3vtAw35rG5RCSvB4bXQZx4ESSI0,1964
|
17
16
|
lamindb/_save.py,sha256=OD052Qr_hiMyAonHTktKETe_Bhnp1RY810y0rwZqpBQ,11352
|
18
17
|
lamindb/_storage.py,sha256=GBVChv-DHVMNEBJL5l_JT6B4RDhZ6NnwgzmUICphYKk,413
|
@@ -20,19 +19,19 @@ lamindb/_transform.py,sha256=HpqRCk0ZTmqxSV4nRbyvDq8fAQEE9wTj31d-CusiL6A,4720
|
|
20
19
|
lamindb/_ulabel.py,sha256=DQQzAPkrOg8W9I77BJ5umajR8MQcFSvXYUy53YNN2HA,1604
|
21
20
|
lamindb/_utils.py,sha256=LGdiW4k3GClLz65vKAVRkL6Tw-Gkx9DWAdez1jyA5bE,428
|
22
21
|
lamindb/_view.py,sha256=4Ln2ItTb3857PAI-70O8eJYqoTJ_NNFc7E_wds6OGns,2412
|
23
|
-
lamindb/core/__init__.py,sha256=
|
24
|
-
lamindb/core/_context.py,sha256=
|
22
|
+
lamindb/core/__init__.py,sha256=GX6MdHsEdrHbm19oDcWVap4k3b0bHj5ekG_J2snsFjs,1558
|
23
|
+
lamindb/core/_context.py,sha256=xqvht5dlqFER6EPwCS6nA0I5_iFlmhPVVeFzB85G5B4,24164
|
25
24
|
lamindb/core/_data.py,sha256=BVZkxK8aloSecH25LivbwnjcG1fz7Gs2UDceO5pWd3I,20049
|
26
|
-
lamindb/core/_django.py,sha256=
|
25
|
+
lamindb/core/_django.py,sha256=cEalbKHCAHp7ElXFtFmUAvzGsk_xCyr4puZ0HElxVAw,7153
|
27
26
|
lamindb/core/_feature_manager.py,sha256=q4WmzJvFLL_fAs-vNRgV2klanAoU6Wu8_g0O2dyIjVg,40027
|
28
|
-
lamindb/core/_label_manager.py,sha256=
|
27
|
+
lamindb/core/_label_manager.py,sha256=eOiHMyRW4p0TUo8d_ihnW9cO0CvGRR2AfDfs5KObbmk,10939
|
29
28
|
lamindb/core/_mapped_collection.py,sha256=EDS0xzOdCc_iGE_Iqv5COTVHNm4jWue7Jtcd8DdXkJU,24591
|
30
29
|
lamindb/core/_settings.py,sha256=6jNadlQdimxCsKR2ZyUD0YJYzOdubTnKktki-MqEWqQ,6137
|
31
30
|
lamindb/core/_sync_git.py,sha256=lIgl6YfpH4rCFT1WILAp7zlemZfxog1d0zp3cX0KIZw,4531
|
32
31
|
lamindb/core/_track_environment.py,sha256=Ywzg_sJ7guI1dcsN7h5orce9VdYl8VGVE3OLITlHBXQ,820
|
33
32
|
lamindb/core/exceptions.py,sha256=Y1XQGbv9MgNLVvoClpcwN4NugrLW3Xgy1up15wZK740,1783
|
34
33
|
lamindb/core/fields.py,sha256=47Jmh3efUr5ZscgimR_yckY-I3cNf8ScLutbwKCK3j4,162
|
35
|
-
lamindb/core/loaders.py,sha256=
|
34
|
+
lamindb/core/loaders.py,sha256=CGgWWtdOCpfdC0hxRQuuGZEgnyRuIvReCYhauw598IA,4338
|
36
35
|
lamindb/core/schema.py,sha256=Y1tGn93B236PtnYZkpgTNFgTXBcVujPM1qh1kNG6Nbs,3441
|
37
36
|
lamindb/core/types.py,sha256=cL4cmJFA1xfxAIFOQqoa_fvVzdUM3A5blHStVwRNtk4,280
|
38
37
|
lamindb/core/versioning.py,sha256=KUpd94F5QpbDxx9eKgZwrpPyQpm9YeHVedrTEO2a_mI,4839
|
@@ -40,13 +39,13 @@ lamindb/core/datasets/__init__.py,sha256=zRP98oqUAaXhqWyKMiH0s_ImVIuNeziQQ2kQ_t0
|
|
40
39
|
lamindb/core/datasets/_core.py,sha256=JGP_q-OQibDCEaI54jZ2F6fSbSW9Yg6oYOqgOCXM0v4,20414
|
41
40
|
lamindb/core/datasets/_fake.py,sha256=BZF9R_1iF0HDnvtZNqL2FtsjSMuqDIfuFxnw_LJYIh4,953
|
42
41
|
lamindb/core/storage/__init__.py,sha256=JOIMu_7unbyhndtH1j0Q-9AvY8knSuc1IJO9sQnyBAQ,498
|
43
|
-
lamindb/core/storage/_anndata_accessor.py,sha256=
|
42
|
+
lamindb/core/storage/_anndata_accessor.py,sha256=C321qng00vMmugukxv5dX8z3oJeRxq869DgAGaEd5rg,24413
|
44
43
|
lamindb/core/storage/_anndata_sizes.py,sha256=aXO3OB--tF5MChenSsigW6Q-RuE8YJJOUTVukkLrv9A,1029
|
45
44
|
lamindb/core/storage/_backed_access.py,sha256=t9iS9mlZQBy1FfIS-Twt-96npYiShbPwEo2y9_3b6jY,3517
|
46
45
|
lamindb/core/storage/_pyarrow_dataset.py,sha256=wuLsEvdblqMdUdDfMtis8AWrE3igzvFWTSTbxuD1Oc8,926
|
47
46
|
lamindb/core/storage/_tiledbsoma.py,sha256=0NPLS5m1icEhzWPfXAv4U2SNiLGqGQd7FM6xCm5wYEc,7269
|
48
47
|
lamindb/core/storage/_valid_suffixes.py,sha256=vUSeQ4s01rdhD_vSd6wKmFBsgMJAKkBMnL_T9Y1znMg,501
|
49
|
-
lamindb/core/storage/_zarr.py,sha256=
|
48
|
+
lamindb/core/storage/_zarr.py,sha256=sVd9jVt2q91maeL6GAqMhT6sqtD04vQRfxY3mvIUQlc,3854
|
50
49
|
lamindb/core/storage/objects.py,sha256=OzvBCS-Urz5mr-O95qYt6RGBDDX5HmjfRRKWPPDn1ZE,1797
|
51
50
|
lamindb/core/storage/paths.py,sha256=bQwRbGTOCx3DSFOQ404uT-3YBXrm8yfKuttNCdWwJpA,5892
|
52
51
|
lamindb/core/subsettings/__init__.py,sha256=KFHPzIE7f7Bj4RgMjGQF4CjTdHVG_VNFBrCndo49ixo,198
|
@@ -56,7 +55,7 @@ lamindb/integrations/__init__.py,sha256=RWGMYYIzr8zvmNPyVB4m-p4gMDhxdRbjES2Ed23O
|
|
56
55
|
lamindb/integrations/_vitessce.py,sha256=uPl45_w4Uu9_BhpBDDVonC1nDOuAnB7DAnzi5w5bZAE,4032
|
57
56
|
lamindb/setup/__init__.py,sha256=OwZpZzPDv5lPPGXZP7-zK6UdO4FHvvuBh439yZvIp3A,410
|
58
57
|
lamindb/setup/core/__init__.py,sha256=SevlVrc2AZWL3uALbE5sopxBnIZPWZ1IB0NBDudiAL8,167
|
59
|
-
lamindb-0.
|
60
|
-
lamindb-0.
|
61
|
-
lamindb-0.
|
62
|
-
lamindb-0.
|
58
|
+
lamindb-0.77.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
59
|
+
lamindb-0.77.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
60
|
+
lamindb-0.77.0.dist-info/METADATA,sha256=sRvsh2HFemzhSLonVj48xLEsFfSwQZZ_LvE2fbJn-js,2796
|
61
|
+
lamindb-0.77.0.dist-info/RECORD,,
|
lamindb/_filter.py
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from typing import TYPE_CHECKING
|
4
|
-
|
5
|
-
from ._query_set import QuerySet, process_expressions
|
6
|
-
|
7
|
-
if TYPE_CHECKING:
|
8
|
-
from lnschema_core import Record
|
9
|
-
|
10
|
-
|
11
|
-
def filter(registry: type[Record], *queries, **expressions) -> QuerySet:
|
12
|
-
"""See :meth:`~lamindb.core.Record.filter`."""
|
13
|
-
_using_key = None
|
14
|
-
if "_using_key" in expressions:
|
15
|
-
_using_key = expressions.pop("_using_key")
|
16
|
-
expressions = process_expressions(registry, expressions)
|
17
|
-
qs = QuerySet(model=registry, using=_using_key)
|
18
|
-
if len(expressions) > 0:
|
19
|
-
return qs.filter(*queries, **expressions)
|
20
|
-
else:
|
21
|
-
return qs
|
File without changes
|
File without changes
|