labthings_fastapi.example_things
Example Thing subclasses, used for testing and demonstration purposes.
Package Contents
Classes
An example Thing with a few affordances |
|
A Thing that raises exceptions in actions/properites |
|
A Thing that raises an exception in init |
|
A Thing that raises an exception in enter |
API
- class labthings_fastapi.example_things.MyThing
Bases:
labthings_fastapi.thing.ThingAn example Thing with a few affordances
- anaction(repeats: Annotated[int, Field(description='The number of times to try the action')], undocumented: int, title: Annotated[str, Field(description='the title of the invocation')] = 'Untitled', attempts: Annotated[typing.Optional[list[str]], Field(description='Names for each attempt - I suggest final, Final, FINAL.')] = None) dict[str, str]
Quite a complicated action
This action has lots of parameters and is designed to confuse my schema generator. I hope it doesn’t!
I might even use some Markdown here:
If this renders, it supports lists
With at east two items.
- make_a_dict(extra_key: Optional[str] = None, extra_value: Optional[str] = None) dict[str, Optional[str]]
An action that returns a dict
- increment_counter()
Increment the counter property
This action doesn’t do very much - all it does, in fact, is increment the counter (which may be read using the
counterproperty).
- slowly_increase_counter(increments: int = 60, delay: float = 1)
Increment the counter slowly over a minute
- counter
‘ThingProperty(…)’
- foo
‘ThingProperty(…)’
- class labthings_fastapi.example_things.ThingWithBrokenAffordances
Bases:
labthings_fastapi.thing.ThingA Thing that raises exceptions in actions/properites
- broken_action()
An action that raises an exception
- broken_property()
A property that raises an exception
- class labthings_fastapi.example_things.ThingThatCantInstantiate
Bases:
labthings_fastapi.thing.ThingA Thing that raises an exception in init
- __init__()
- class labthings_fastapi.example_things.ThingThatCantStart
Bases:
labthings_fastapi.thing.ThingA Thing that raises an exception in enter
- __enter__()
- __exit__(exc_t, exc_v, exc_tb)