Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏷️ Remove duplicated typing in Curator #2232

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions lamindb/_curate.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ def save_artifact(
"""Save the dataset as artifact.

Args:
description: `str | None = None` A description of the DataFrame object.
key: `str | None = None` A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: `Artifact | None = None` Previous version of the artifact. Triggers a revision.
run: `Run | None = None` The run that creates the artifact.
description: A description of the DataFrame object.
key: A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: Previous version of the artifact. Triggers a revision.
run: The run that creates the artifact.

Returns:
A saved artifact record.
Expand All @@ -157,14 +157,14 @@ class DataFrameCurator(BaseCurator):
See also :class:`~lamindb.Curator`.

Args:
df: `pd.DataFrame` The DataFrame object to curate.
columns: `FieldAttr=Feature.name` The field attribute for the feature column.
categoricals: `dict[str, FieldAttr] | None = None` A dictionary mapping column names to registry_field.
using_key: `str | None = None` The reference instance containing registries to validate against.
verbosity: `str = "hint"` The verbosity level.
organism: `str | None = None` The organism name.
sources: `dict[str, Record] | None = None` A dictionary mapping column names to Source records.
exclude: `dict | None = None` A dictionary mapping column names to values to exclude.
df: The DataFrame object to curate.
columns: The field attribute for the feature column.
categoricals: A dictionary mapping column names to registry_field.
using_key: The reference instance containing registries to validate against.
verbosity: The verbosity level.
organism: The organism name.
sources: A dictionary mapping column names to Source records.
exclude: A dictionary mapping column names to values to exclude.

Returns:
A curator object.
Expand Down Expand Up @@ -440,10 +440,10 @@ def save_artifact(
"""Save the validated DataFrame and metadata.

Args:
description: `str | None = None` Description of the DataFrame object.
key: `str | None = None` A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: `Artifact | None = None` Previous version of the artifact. Triggers a revision.
run: `Run | None = None` The run that creates the artifact.
description: Description of the DataFrame object.
key: A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: Previous version of the artifact. Triggers a revision.
run: The run that creates the artifact.

Returns:
A saved artifact record.
Expand Down Expand Up @@ -494,15 +494,15 @@ class AnnDataCurator(DataFrameCurator):
See :doc:`docs:cellxgene-curate` for instructions on how to curate against a specific cellxgene schema version.

Args:
data: `ad.AnnData | UPathStr` The AnnData object or an AnnData-like path.
var_index: `FieldAttr` The registry field for mapping the ``.var`` index.
categoricals: `dict[str, FieldAttr] | None = None` A dictionary mapping ``.obs.columns`` to a registry field.
obs_columns: `FieldAttr` The registry field for mapping the ``.obs.columns``.
using_key: `str | None = None` A reference LaminDB instance.
verbosity: `str = "hint"` The verbosity level.
organism: `str | None = None` The organism name.
sources: `dict[str, Record] | None = None` A dictionary mapping ``.obs.columns`` to Source records.
exclude: `dict | None = None` A dictionary mapping column names to values to exclude.
data: The AnnData object or an AnnData-like path.
var_index: The registry field for mapping the ``.var`` index.
categoricals: A dictionary mapping ``.obs.columns`` to a registry field.
obs_columns: The registry field for mapping the ``.obs.columns``.
using_key: A reference LaminDB instance.
verbosity: The verbosity level.
organism: The organism name.
sources: A dictionary mapping ``.obs.columns`` to Source records.
exclude: A dictionary mapping column names to values to exclude.

Examples:
>>> import bionty as bt
Expand Down Expand Up @@ -709,10 +709,10 @@ def save_artifact(
"""Save the validated ``AnnData`` and metadata.

Args:
description: `str | None = None` A description of the ``AnnData`` object.
key: `str | None = None` A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: `Artifact | None = None` Previous version of the artifact. Triggers a revision.
run: `Run | None = None` The run that creates the artifact.
description: A description of the ``AnnData`` object.
key: A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: Previous version of the artifact. Triggers a revision.
run: The run that creates the artifact.

Returns:
A saved artifact record.
Expand Down Expand Up @@ -751,17 +751,17 @@ class MuDataCurator:
the object should be recreated using :meth:`~lamindb.Curator.from_mudata`.

Args:
mdata: `MuData` The MuData object to curate.
var_index: `dict[str, dict[str, FieldAttr]]` The registry field for mapping the ``.var`` index for each modality.
mdata: The MuData object to curate.
var_index: The registry field for mapping the ``.var`` index for each modality.
For example:
``{"modality_1": bt.Gene.ensembl_gene_id, "modality_2": ln.CellMarker.name}``
categoricals: `dict[str, FieldAttr] | None = None` A dictionary mapping ``.obs.columns`` to a registry field.
categoricals: A dictionary mapping ``.obs.columns`` to a registry field.
Use modality keys to specify categoricals for MuData slots such as `"rna:cell_type": bt.CellType.name"`.
using_key: `str | None = None` A reference LaminDB instance.
verbosity: `str = "hint"` The verbosity level.
organism: `str | None = None` The organism name.
sources: `dict[str, Record] | None = None` A dictionary mapping ``.obs.columns`` to Source records.
exclude: `dict | None = None` A dictionary mapping column names to values to exclude.
using_key: A reference LaminDB instance.
verbosity: The verbosity level.
organism: The organism name.
sources: A dictionary mapping ``.obs.columns`` to Source records.
exclude: A dictionary mapping column names to values to exclude.

Examples:
>>> import bionty as bt
Expand Down Expand Up @@ -1004,8 +1004,8 @@ def standardize(self, key: str, modality: str | None = None):
"""Replace synonyms with standardized values.

Args:
key: `str` The key referencing the slot in the `MuData`.
modality: `str | None = None` The modality name.
key: The key referencing the slot in the `MuData`.
modality: The modality name.

Inplace modification of the dataset.
"""
Expand All @@ -1026,10 +1026,10 @@ def save_artifact(
"""Save the validated ``MuData`` and metadata.

Args:
description: `str | None = None` A description of the ``MuData`` object.
key: `str | None = None` A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: `Artifact | None = None` Previous version of the artifact. Triggers a revision.
run: `Run | None = None` The run that creates the artifact.
description: A description of the ``MuData`` object.
key: A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: Previous version of the artifact. Triggers a revision.
run: The run that creates the artifact.

Returns:
A saved artifact record.
Expand Down Expand Up @@ -1437,10 +1437,10 @@ def save_artifact(
description: A description of the artifact.
organism: The organism name.
adata: The AnnData object to save and get n_observations, must be provided if data is a path.
type: `Literal["dataset", "model"] | None = None` The artifact type.
key: `str | None = None` A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: `Artifact | None = None` Previous version of the artifact. Triggers a revision.
run: `Run | None = None` The run that creates the artifact.
type: The artifact type.
key: A path-like key to reference artifact in default storage, e.g., `"myfolder/myfile.fcs"`. Artifacts with the same key form a revision family.
revises: Previous version of the artifact. Triggers a revision.
run: The run that creates the artifact.

Returns:
The saved Artifact.
Expand Down