Skip to content

Commit 4472f3e

Browse files
committed
fix(spelling): change 'writeable' to 'writable'
Signed-off-by: Milad Makdesi <milad@id8-engineering.io>
1 parent 1218c5f commit 4472f3e

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/em511/em511.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RegisterSpec:
3030
count (int): Number of consecutive registers to read.
3131
scale (int): Scaling factor to apply to the raw integer value.
3232
decimals (int): Number of decimal places to round the scaled value to.
33-
writeable (bool): Whether this register can be written to.
33+
writable (bool): Whether this register can be written to.
3434
range (bool): Whether range validation should be performed.
3535
min (int): Minimum allowed value for range validation.
3636
max (int): Maximum allowed value for range validation.
@@ -43,15 +43,15 @@ class RegisterSpec:
4343
range: bool = False
4444
min: int = 0
4545
max: int = 0x7FFFFFFF
46-
writeable: bool = False
46+
writable: bool = False
4747
return_type: type[int] | type[Decimal] = Decimal
4848

4949

5050
def register_properties(cls: T) -> T:
5151
"""Class decorator that auto-generates @property accessors for Modbus registers.
5252
5353
For each entry in `cls._register_specs`, this decorator dynamically creates
54-
a corresponding @property getter, and optionally a setter if `writeable=True`.
54+
a corresponding @property getter, and optionally a setter if `writable=True`.
5555
5656
The generated getter automatically calls `_read_register(register_name)`
5757
and the setter calls `_write_register(address, value)` with range validation
@@ -90,7 +90,7 @@ def setter(self: "Em511", value: int, _name: str = name, _spec: "RegisterSpec" =
9090
AttributeError: If the register is read-only.
9191
ValueError: If the written value is outside its defined range.
9292
"""
93-
if not _spec.writeable:
93+
if not _spec.writable:
9494
msg = f"Register '{_name}' is read-only."
9595
raise AttributeError(msg)
9696

@@ -99,9 +99,9 @@ def setter(self: "Em511", value: int, _name: str = name, _spec: "RegisterSpec" =
9999
raise ValueError(msg)
100100
self._write_register(_spec.address, int(value))
101101

102-
prop = property(getter, setter) if spec.writeable else property(getter)
102+
prop = property(getter, setter) if spec.writable else property(getter)
103103

104-
prop.__doc__ = f"{name} ({'read/write' if spec.writeable else 'read-only'})" + (
104+
prop.__doc__ = f"{name} ({'read/write' if spec.writable else 'read-only'})" + (
105105
f" range=[{spec.min}, {spec.max}]" if spec.range else ""
106106
)
107107

@@ -217,7 +217,7 @@ class Em511:
217217
min=0,
218218
max=9999,
219219
return_type=int,
220-
writeable=True,
220+
writable=True,
221221
),
222222
"alarm_status": RegisterSpec(
223223
address=0x0306,
@@ -234,7 +234,7 @@ class Em511:
234234
min=1,
235235
max=6,
236236
return_type=int,
237-
writeable=True,
237+
writable=True,
238238
),
239239
"alarm_delay": RegisterSpec(
240240
address=0x101A,
@@ -243,7 +243,7 @@ class Em511:
243243
min=0,
244244
max=3600,
245245
return_type=int,
246-
writeable=True,
246+
writable=True,
247247
),
248248
"dmd_integration_time": RegisterSpec(
249249
address=0x1010,
@@ -252,7 +252,7 @@ class Em511:
252252
min=0,
253253
max=6,
254254
return_type=int,
255-
writeable=True,
255+
writable=True,
256256
),
257257
"device_id": RegisterSpec(
258258
address=0x2000,
@@ -261,7 +261,7 @@ class Em511:
261261
min=1,
262262
max=247,
263263
return_type=int,
264-
writeable=True,
264+
writable=True,
265265
),
266266
"baud_rate": RegisterSpec(
267267
address=0x2001,
@@ -270,7 +270,7 @@ class Em511:
270270
min=1,
271271
max=5,
272272
return_type=int,
273-
writeable=True,
273+
writable=True,
274274
),
275275
"parity": RegisterSpec(
276276
address=0x2002,
@@ -279,7 +279,7 @@ class Em511:
279279
min=1,
280280
max=2,
281281
return_type=int,
282-
writeable=True,
282+
writable=True,
283283
),
284284
"stop_bit": RegisterSpec(
285285
address=0x2003,
@@ -288,7 +288,7 @@ class Em511:
288288
min=0,
289289
max=1,
290290
return_type=int,
291-
writeable=True,
291+
writable=True,
292292
),
293293
"reply_delay": RegisterSpec(
294294
address=0x2004,
@@ -297,7 +297,7 @@ class Em511:
297297
min=0,
298298
max=1000,
299299
return_type=int,
300-
writeable=True,
300+
writable=True,
301301
),
302302
"identification_code": RegisterSpec(
303303
address=0x000B,

0 commit comments

Comments
 (0)