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

🚸 Eliminate kwargs #366

Merged
merged 1 commit into from
Apr 11, 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
25 changes: 18 additions & 7 deletions lnschema_core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def inspect(
field: str | StrField | None = None,
*,
mute: bool = False,
**kwargs,
organism: str | Registry | None = None,
) -> InspectResult:
"""Inspect if values are mappable to a field.

Expand All @@ -134,6 +134,7 @@ def inspect(
against the source ID or `'name'` to map against the ontologies
field names.
mute: Mute logging.
organism: An Organism name or record.

See Also:
:meth:`~lamindb.core.CanValidate.validate`
Expand Down Expand Up @@ -162,7 +163,7 @@ def validate(
field: str | StrField | None = None,
*,
mute: bool = False,
**kwargs,
organism: str | Registry | None = None,
) -> np.ndarray:
"""Validate values against existing values of a string field.

Expand Down Expand Up @@ -206,7 +207,7 @@ def standardize(
public_aware: bool = True,
keep: Literal["first", "last", False] = "first",
synonyms_field: str = "synonyms",
**kwargs,
organism: str | Registry | None = None,
) -> list[str] | dict[str, str]:
"""Maps input synonyms to standardized names.

Expand All @@ -227,6 +228,7 @@ def standardize(

When a field is converted into return_field, keep marks which matches to keep when multiple return_field values map to the same field value.
synonyms_field: A field containing the concatenated synonyms.
organism: An Organism name or record.

Returns:
If `return_mapper` is `False`: a list of standardized names. Otherwise,
Expand Down Expand Up @@ -400,15 +402,20 @@ class Registry(models.Model):

@classmethod
def from_values(
cls, values: ListLike, field: StrField | None = None, **kwargs
cls,
values: ListLike,
field: StrField | None = None,
organism: Registry | str | None = None,
public_source: Registry | None = None,
) -> list[Registry]:
"""Bulk create validated records by parsing values for an identifier (a name, an id, etc.).

Args:
values: A list of values for an identifier, e.g.
`["name1", "name2"]`.
field: A `Registry` field to look up, e.g., `bt.CellMarker.name`.
**kwargs: Additional conditions for creation of records, e.g., `organism="human"`.
organism: An Organism name or record.
public_source: A PublicSource record.

Returns:
A list of validated records. For bionty registries, also returns knowledge-coupled records.
Expand Down Expand Up @@ -1400,7 +1407,9 @@ def from_values( # type: ignore
field: FieldAttr = Feature.name,
type: str | None = None,
name: str | None = None,
**kwargs,
mute: bool = False,
organism: Registry | str | None = None,
public_source: Registry | None = None,
) -> FeatureSet | None:
"""Create feature set for validated features.

Expand Down Expand Up @@ -1430,7 +1439,9 @@ def from_df(
df: pd.DataFrame,
field: FieldAttr = Feature.name,
name: str | None = None,
**kwargs,
mute: bool = False,
organism: Registry | str | None = None,
public_source: Registry | None = None,
) -> FeatureSet | None:
"""Create feature set for validated features."""
pass
Expand Down
Loading