Skip to content

Commit 71e1a2e

Browse files
authored
Merge pull request #231 from DiamondLightSource/docs-warnings
Fix docs build. Add docstrings.
2 parents 51292cf + 17b15d0 commit 71e1a2e

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

docs/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@
8989
("py:class", "p4p.nt.NTTable"),
9090
# Problems in FastCS itself
9191
("py:class", "fastcs.transport.epics.pva.pvi_tree._PviSignalInfo"),
92+
("py:class", "fastcs.logging._logging.LogLevel"),
93+
("py:class", "fastcs.logging._graylog.GraylogEndpoint"),
94+
("py:class", "fastcs.logging._graylog.GraylogStaticFields"),
95+
("py:class", "fastcs.logging._graylog.GraylogEnvFields"),
96+
("py:obj", "fastcs.launch.build_controller_api"),
97+
("docutils", "fastcs.demo.controllers.TemperatureControllerSettings"),
9298
# TypeVar without docstrings still give warnings
9399
("py:class", "fastcs.datatypes.T_Numerical"),
94100
("py:class", "strawberry.schema.schema.Schema"),
@@ -99,6 +105,8 @@
99105
(r"py:.*", r"tickit.*"),
100106
]
101107

108+
suppress_warnings = ["docutils"]
109+
102110
# Both the class’ and the __init__ method’s docstring are concatenated and
103111
# inserted into the main body of the autoclass directive
104112
autoclass_content = "both"

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)