sm_bluesky.common.utils#

Members

add_default_metadata

Decorator to add default metadata to the 'md' keyword argument.

add_extra_names_to_meta

auto_type_cast

Casts positional byte arguments to hinted types.

sm_bluesky.common.utils.add_default_metadata(func: TCallable, extra_metadata: dict[str, Any] | None = None) → TCallable[source]#

Decorator to add default metadata to the ‘md’ keyword argument.

The defaults can be overridden at run time: any key supplied in ‘md’ takes precedence over the same key in extra_metadata.

If ‘md’ is not provided, it will be set to a copy of extra_metadata. If ‘md’ is provided and not None, extra_metadata is used for the keys that ‘md’ does not define. If ‘md’ is provided and is None, it will be set to a copy of extra_metadata.

sm_bluesky.common.utils.auto_type_cast(func: Callable) → Callable[source]#

Casts positional byte arguments to hinted types. Skips ‘self’ and handles empty strings gracefully.