Skip to content

Commit 4bf7e9c

Browse files
committed
Add some docstrings
1 parent 51292cf commit 4bf7e9c

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/fastcs/attribute_io.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77

88

99
class AttributeIO(Generic[T, AttributeIORefT], Tracer):
10+
"""Base class for performing IO for an ``Attribute``
11+
12+
This class should be inherited to implement reading and writing values from
13+
``Attributes`` via some API. For read, ``Attribute``s implement the ``update``
14+
method and for write, ``Attribute`` implement the ``send`` method.
15+
16+
Concrete implementations of this class must be parameterised with a specific
17+
``AttributeIORef`` that defines exactly what part of the API the ``Attribute``
18+
corresponds to. See the docstring for ``AttributeIORef`` for more information.
19+
"""
20+
1021
ref_type = AttributeIORef
1122

1223
def __init_subclass__(cls) -> None:

src/fastcs/attribute_io_ref.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55

66
@dataclass(kw_only=True)
77
class AttributeIORef:
8+
"""Base for references to define IO for an ``Attribute`` over an API.
9+
10+
This object acts as a specification of the API that its corresponding
11+
``AttributeIO`` should access for a given ``Attribute``. The fields necessary to
12+
distinguish between different ``Attributes`` is an implementation detail of the IO,
13+
but some examples are a string to send over a TCP port, or URI within an HTTP
14+
server.
15+
"""
16+
817
update_period: float | None = None
918

1019

src/fastcs/logging/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,12 @@
4040
4141
logger = _logger.bind(logger_name=__name__)
4242
43-
4443
or to create a class logger with its name
4544
4645
.. code-block:: python
4746
4847
self.logger = _logger.bind(logger_name=__class__.__name__)
4948
50-
5149
As standard ``loguru`` supports ``trace`` level monitoring, but it should not be used in
5250
fastcs. Instead there is a ``Tracer`` class for verbose logging with fine-grained
5351
controls that can be enabled by the user at runtime.

src/fastcs/tracer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Tracer:
2020
2121
Example usage:
2222
.. code-block:: python
23+
2324
controller.ramp_rate.enable_tracing()
2425
controller.ramp_rate.disable_tracing()
2526
controller.connection.enable_tracing()

0 commit comments

Comments
 (0)