pylabrobot.high_res.sample_storage.AmbiStore.find_resources#

AmbiStore.find_resources(fn: Callable[[Resource], bool] | None = None, *, metadata: Mapping[str, Any] | None = None, has_metadata: str | Iterable[str] | None = None, recursive: bool = True, name: Pattern | Callable[[Any], bool] | str | None = None, type: type | Tuple[type, ...] | Pattern | Callable[[Any], bool] | str | None = None, model: Pattern | Callable[[Any], bool] | str | None = None, category: Pattern | Callable[[Any], bool] | str | None = None) List[Resource]#

Find resources matching top-level attributes, metadata, and/or a predicate.

All supplied criteria must match (logical AND). The search always includes self in addition to its children, so e.g. deck.find_resources() with no criteria returns the deck itself plus every descendant.

Parameters:
  • fn (Callable[[Resource], bool] | None) – Optional predicate receiving a Resource and returning True if it matches.

  • metadata (Mapping[str, Any] | None) – Metadata key-value pairs that must all match. If a value is callable it is treated as a predicate receiving metadata.get(key) (None when absent); otherwise the key must be present and equal.

  • has_metadata (str | Iterable[str] | None) – A single key or iterable of keys that must be present in metadata (values are not inspected).

  • recursive (bool) – If True, search self and all descendants. If False, search self and direct children only.

  • name (Pattern | Callable[[Any], bool] | str | None) – Matches the resource name. Can be a string, regex or callable.

  • type (type | Tuple[type, ...] | Pattern | Callable[[Any], bool] | str | None) – Matches the resource type. Can be a type or tuple of types, which are matched using isinstance, a string or regex, which are matched against the type names, or a callable which receives type(resource).

  • model (Pattern | Callable[[Any], bool] | str | None) – Matches the resource model. Can be a string, regex or callable.

  • category (Pattern | Callable[[Any], bool] | str | None) – Matches the resource category. Can be a string, regex or callable.

Returns:

List of matching Resource instances. self is considered first (so it appears first if it matches), followed by its descendants in get_all_children order (direct children before deeper descendants).

Return type:

List[Resource]