labthings_fastapi.thing_class_settings ====================================== .. py:module:: labthings_fastapi.thing_class_settings .. autoapi-nested-parse:: Settings that control how a `lt.Thing` interacts with LabThings. This module defines the type used by `lt.Thing._class_settings` to control how it interacts with LabThings. Most of this module is intended for internal use: the only user-facing item is the type `ThingClassSettings` Attributes ---------- .. autoapisummary:: labthings_fastapi.thing_class_settings.SETTINGS_TYPEADAPTER Classes ------- .. autoapisummary:: labthings_fastapi.thing_class_settings.ThingClassSettings Functions --------- .. autoapisummary:: labthings_fastapi.thing_class_settings.validate_thing_class_settings labthings_fastapi.thing_class_settings.get_class_settings labthings_fastapi.thing_class_settings.get_validate_properties_on_set Module Contents --------------- .. py:class:: ThingClassSettings Bases: :py:obj:`TypedDict` Settings that define how a Thing operates. Initialize self. See help(type(self)) for accurate signature. .. py:attribute:: validate_properties_on_set :type: ReadOnly[bool] Whether property values are validated when set from Python. This is not yet enabled by default, but will be in future. A `DeprecationWarning` will be raised if it is not set to `True`. .. py:data:: SETTINGS_TYPEADAPTER .. py:function:: validate_thing_class_settings(cls: type[Thing]) -> None Validate a class settings dict. This retrieves the dict from the class, and ensures the attribute is a valid `ThingClassSettings` typed dict. :param cls: The `Thing` subclass where we are validating. :raises InvalidClassSettingsError: if the dictionary is not valid. .. py:function:: get_class_settings(cls: type[Thing]) -> ThingClassSettings Retrieve a class settings dict or default to an empty dict. :param cls: The class from which to retrieve the dict. :return: The ``_class_settings`` dict, or an empty dict. :raises TypeError: if the settings is not a dictionary. .. py:function:: get_validate_properties_on_set(cls: type[Thing]) -> bool Determine whether properties should perform validation when set from Python. .. note:: Check that the default value defined here matches the docstring for `ThingClassSettings`\ . :param cls: the `Thing` subclass on which the property is defined. :return: whether validation should be performed.