Skip to content

Commit 76684b9

Browse files
Remove vestigial code
1 parent 70858c2 commit 76684b9

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

src/labthings_fastapi/decorators/__init__.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,13 @@ def thing_action(func: Optional[Callable] = None, **kwargs):
7575
def thing_property(func: Callable) -> PropertyDescriptor:
7676
"""Mark a method of a Thing as a Property
7777
78-
We replace the function with a `Descriptor` that's a
79-
subclass of `PropertyDescriptor`
78+
Replace the function with a `Descriptor` that's a
79+
`PropertyDescriptor`
8080
8181
TODO: try https://stackoverflow.com/questions/54413434/type-hinting-with-descriptors
8282
"""
8383

84-
class PropertyDescriptorSubclass(PropertyDescriptor):
85-
def __get__(self, obj, objtype=None):
86-
return super().__get__(obj, objtype)
87-
88-
return PropertyDescriptorSubclass(
84+
return PropertyDescriptor(
8985
return_type(func),
9086
readonly=True,
9187
observable=False,
@@ -98,15 +94,11 @@ def thing_setting(func: Callable) -> SettingDescriptor:
9894
9995
A setting is a property that persists between runs
10096
101-
We replace the function with a `Descriptor` that's a
102-
subclass of `SettingDescriptor`
97+
Replace the function with a `Descriptor` that's a
98+
`SettingDescriptor`
10399
"""
104100

105-
class SettingDescriptorSubclass(SettingDescriptor):
106-
def __get__(self, obj, objtype=None):
107-
return super().__get__(obj, objtype)
108-
109-
return SettingDescriptorSubclass(
101+
return SettingDescriptor(
110102
return_type(func),
111103
readonly=True,
112104
observable=False,

src/labthings_fastapi/descriptors/property.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
from __future__ import annotations
6-
import logging
76
from typing import TYPE_CHECKING, Annotated, Any, Callable, Optional
87
from typing_extensions import Self
98
from labthings_fastapi.utilities.introspection import get_summary, get_docstring
@@ -53,7 +52,6 @@ def __init__(
5352
# The lines below allow _getter and _setter to be specified by subclasses
5453
self._setter = setter or getattr(self, "_setter", None)
5554
self._getter = getter or getattr(self, "_getter", None)
56-
self.save_location = None
5755
# Try to generate a DataSchema, so that we can raise an error that's easy to
5856
# link to the offending PropertyDescriptor
5957
type_to_dataschema(self.model)

src/labthings_fastapi/server/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from __future__ import annotations
2-
import logging
32
from typing import Optional, Sequence, TypeVar
43
import os.path
54
from fastapi import FastAPI, Request

0 commit comments

Comments
 (0)