Skip to content

Commit

Permalink
📝 Show inherited class members in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf committed Aug 31, 2024
1 parent d281240 commit 53d8b4d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
74 changes: 41 additions & 33 deletions lamindb/_query_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def one(self) -> Record:
return one_helper(self)


class QuerySet(models.QuerySet, CanValidate):
class QuerySet(models.QuerySet):
"""Sets of records returned by queries.
See Also:
Expand Down Expand Up @@ -301,42 +301,50 @@ def latest_version(self) -> QuerySet:
else:
raise ValueError("Record isn't subclass of `lamindb.core.IsVersioned`")

@doc_args(Record.search.__doc__)
def search(self, string: str, **kwargs):
"""{}""" # noqa: D415
from ._record import _search

return _search(cls=self, string=string, **kwargs)
# -------------------------------------------------------------------------------------
# CanValidate
# -------------------------------------------------------------------------------------

@doc_args(Record.lookup.__doc__)
def lookup(self, field: StrField | None = None, **kwargs) -> NamedTuple:
"""{}""" # noqa: D415
from ._record import _lookup

return _lookup(cls=self, field=field, **kwargs)
@doc_args(Record.search.__doc__)
def search(self, string: str, **kwargs):
"""{}""" # noqa: D415
from ._record import _search

@doc_args(CanValidate.validate.__doc__)
def validate(self, values: ListLike, field: str | StrField | None = None, **kwargs):
"""{}""" # noqa: D415
from ._can_validate import _validate
return _search(cls=self, string=string, **kwargs)

return _validate(cls=self, values=values, field=field, **kwargs)

@doc_args(CanValidate.inspect.__doc__)
def inspect(self, values: ListLike, field: str | StrField | None = None, **kwargs):
"""{}""" # noqa: D415
from ._can_validate import _inspect
@doc_args(Record.lookup.__doc__)
def lookup(self, field: StrField | None = None, **kwargs) -> NamedTuple:
"""{}""" # noqa: D415
from ._record import _lookup

return _inspect(cls=self, values=values, field=field, **kwargs)
return _lookup(cls=self, field=field, **kwargs)

@doc_args(CanValidate.standardize.__doc__)
def standardize(
self, values: Iterable, field: str | StrField | None = None, **kwargs
):
"""{}""" # noqa: D415
from ._can_validate import _standardize

return _standardize(cls=self, values=values, field=field, **kwargs)
@doc_args(CanValidate.validate.__doc__)
def validate(self, values: ListLike, field: str | StrField | None = None, **kwargs):
"""{}""" # noqa: D415
from ._can_validate import _validate

return _validate(cls=self, values=values, field=field, **kwargs)


@doc_args(CanValidate.inspect.__doc__)
def inspect(self, values: ListLike, field: str | StrField | None = None, **kwargs):
"""{}""" # noqa: D415
from ._can_validate import _inspect

return _inspect(cls=self, values=values, field=field, **kwargs)


@doc_args(CanValidate.standardize.__doc__)
def standardize(self, values: Iterable, field: str | StrField | None = None, **kwargs):
"""{}""" # noqa: D415
from ._can_validate import _standardize

return _standardize(cls=self, values=values, field=field, **kwargs)


models.QuerySet.df = QuerySet.df
Expand All @@ -345,10 +353,10 @@ def standardize(
models.QuerySet.one = QuerySet.one
models.QuerySet.one_or_none = QuerySet.one_or_none
models.QuerySet.latest_version = QuerySet.latest_version
models.QuerySet.search = QuerySet.search
models.QuerySet.lookup = QuerySet.lookup
models.QuerySet.validate = QuerySet.validate
models.QuerySet.inspect = QuerySet.inspect
models.QuerySet.standardize = QuerySet.standardize
models.QuerySet.search = search
models.QuerySet.lookup = lookup
models.QuerySet.validate = validate
models.QuerySet.inspect = inspect
models.QuerySet.standardize = standardize
models.QuerySet._delete_base_class = models.QuerySet.delete
models.QuerySet.delete = QuerySet.delete
2 changes: 0 additions & 2 deletions lamindb/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
QuerySet
QueryManager
RecordsList
HasFeatures
HasParams
FeatureManager
ParamManager
LabelManager
Expand Down
2 changes: 1 addition & 1 deletion sub/lnschema-core

0 comments on commit 53d8b4d

Please sign in to comment.