Skip to content

Commit 2f880a4

Browse files
Apply suggestions from code review
Co-authored-by: Richard Bowman <richard.bowman@cantab.net>
1 parent 01af5bb commit 2f880a4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ addopts = [
5757
"--cov-report=term",
5858
"--cov-report=xml:coverage.xml",
5959
"--cov-report=html:htmlcov",
60+
"--cov-report=lcov",
6061
]
6162

6263
[tool.ruff]

src/labthings_fastapi/decorators/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def thing_setting(func: Callable) -> ThingSetting:
100100
This should be used as a decorator with a getter and a setter
101101
just like a standard python property decorator. If extra functionality
102102
is not required in the decorator, then using the ThingSetting class
103-
directly may allow for clearer code
103+
directly may allow for clearer code where the property works like a normal variable.
104104
105105
When creating a Setting using this decorator you must always create a setter
106106
as it is used to load the value from disk.
@@ -112,7 +112,7 @@ def thing_setting(func: Callable) -> ThingSetting:
112112
the dictionary representation of this BaseModel as this is what will be used to
113113
set the Setting when loading from disk on starting the server.
114114
115-
Note: If a setting updated, rather than explicitly set this will not trigger saving.
115+
Note: If a setting is mutated rather than set, this will not trigger saving.
116116
For example: if a Thing has a setting called `dictsetting` holding the dictionary
117117
`{"a": 1, "b": 2}` then `self.dictsetting = {"a": 2, "b": 2}` would trigger saving
118118
but `self.dictsetting[a] = 2` would not, as the setter for `dictsetting` is never

src/labthings_fastapi/descriptors/property.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def getter(self, func: Callable) -> Self:
229229
def setter(self, func: Callable) -> Self:
230230
"""Decorator to set the property's value
231231
232-
ThingPropertys are variables - so they will return the value they hold
232+
``ThingProperty`` descriptors return the value they hold
233233
when they are accessed. However, they can run code when they are set: this
234234
decorator sets a function as that code.
235235
"""
@@ -244,7 +244,7 @@ class ThingSetting(ThingProperty):
244244
A ThingSetting is a ThingProperty with extra functionality for triggering
245245
a Thing to save its settings.
246246
247-
Note: If a setting updated, rather than explicitly set this will not trigger saving.
247+
Note: If a setting is mutated rather than assigned to, this will not trigger saving.
248248
For example: if a Thing has a setting called `dictsetting` holding the dictionary
249249
`{"a": 1, "b": 2}` then `self.dictsetting = {"a": 2, "b": 2}` would trigger saving
250250
but `self.dictsetting[a] = 2` would not, as the setter for `dictsetting` is never

0 commit comments

Comments
 (0)