From 2b8bf5e5459ac800711535f6cdb833d065bf0909 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 30 Jan 2025 19:01:49 +0000 Subject: [PATCH] docs: Clean up `_merge_kwds`, `_solve` --- altair/datasets/_reader.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/altair/datasets/_reader.py b/altair/datasets/_reader.py index 2162d910c..4075598ec 100644 --- a/altair/datasets/_reader.py +++ b/altair/datasets/_reader.py @@ -254,15 +254,11 @@ def _query( msg = f"Found no results for:\n {constraints!r}" raise ValueError(msg) - # TODO: Docs def _merge_kwds(self, meta: Metadata, kwds: dict[str, Any], /) -> Mapping[str, Any]: """ - Hook to utilize ``meta`` to extend ``kwds`` with known helpful defaults. + Extend user-provided arguments with dataset & library-specfic defaults. - - User provided arguments have a higher precedence. - - The keywords for schemas vary between libraries - - pandas is internally inconsistent - - By default, returns unchanged + .. important:: User-provided arguments have a higher precedence. """ if self._schema_cache.is_active() and ( schema := self._schema_cache.schema_kwds(meta) @@ -282,22 +278,15 @@ def _scan_metadata( return self._metadata_frame.filter(*predicates, **constraints) return self._metadata_frame - # TODO: Docs def _solve( self, meta: Metadata, impls: Sequence[BaseImpl[R]], / ) -> Callable[..., R]: """ - Return the first function meeting constraints of meta. - - Notes - ----- - - Iterate over impls - - Each one can either match or signal an error - - An error blocks any additional checking - - Both include & exclude - - Uses ``ItemsView`` to support set ops - - `meta` isn't iterated over - - Leaves the door open for caching the search space + Return the first function that satisfies dataset constraints. + + See Also + -------- + ``altair.datasets._readimpl.BaseImpl.unwrap_or_skip`` """ items = meta.items() it = (some for impl in impls if (some := impl.unwrap_or_skip(items)))