Skip to content

Commit 9dc8044

Browse files
author
David Miguel Susano Pinto
committed
doc: fix ReST syntax in docstrings.
1 parent 6b27f23 commit 9dc8044

File tree

1 file changed

+42
-28
lines changed

1 file changed

+42
-28
lines changed

microscope/abc.py

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,12 +1562,12 @@ def move_to(self, position: typing.Mapping[str, float]) -> None:
15621562
class DigitalIO(DataDevice, metaclass=abc.ABCMeta):
15631563
"""ABC for digital IO devices.
15641564
1565-
Digital IO devices (DIO) have a num,ber of digital lines that can
1566-
be for output, or optionally input and can switch between a on and
1567-
off state.
1565+
Digital IO devices (DIO) have a number of digital lines that can
1566+
be for output, or optionally input, and can switch between an On
1567+
and Off state.
15681568
15691569
Args:
1570-
numLines: total number of digital lines numberes 0 to n-1.
1570+
numLines: total number of digital lines numbers 0 to n-1.
15711571
15721572
"""
15731573

@@ -1584,44 +1584,52 @@ def __init__(self, numLines: int, **kwargs) -> None:
15841584
self._IOMap = [True] * self._numLines
15851585

15861586
def get_num_lines(self):
1587-
"""Returns the number of Io lines present in this instance"""
1587+
"""Returns the number of IO lines present in this device."""
15881588
return self._numLines
15891589

15901590
@abc.abstractmethod
15911591
def set_IO_state(self, line: int, state: bool):
1592-
"""Sets the state of a single Digital line to either Output or Input
1592+
"""Sets the state of a single digital line to either Output or Input.
15931593
15941594
Args:
1595-
line: The line to have its mode set.
1596-
1597-
state: True for Output or False for Input."""
1595+
line: the line to have its mode set.
1596+
state: ``True`` for Output or ``False`` for Input.
1597+
"""
15981598
raise NotImplementedError()
15991599

16001600
@abc.abstractmethod
16011601
def get_IO_state(self, line):
1602-
"""Returns the state of a single Digital line, either Output or Input
1602+
"""Returns the state of a single digital line, either Output or Input.
16031603
16041604
Args:
16051605
line: The line to have its mode set.
1606-
Return value is True for Output and False for Input"""
1606+
1607+
Returns:
1608+
Value is ``True`` for Output and ``False`` for Input.
1609+
"""
16071610
raise NotImplementedError()
16081611

16091612
def set_all_IO_state(self, stateArray):
16101613
"""Sets the state of all lines to either Input or Output
1614+
16111615
Args:
16121616
line: The line to have its mode set.
1613-
stateArray: Boolean array for the lines, True in output False
1614-
is Input"""
1617+
stateArray: Boolean array for the lines, ``True`` in
1618+
output ``False`` is Input.
1619+
1620+
"""
16151621
for i, state in enumerate(stateArray):
16161622
# set each line as defined in stateArray
16171623
self.set_IO_state(i, state)
16181624

16191625
def get_all_IO_state(self):
1620-
"""Returns the state of a all Digital line, either Output or Input
1626+
"""Returns the state of a all digital line, either Output or Input.
16211627
1622-
Returns a boolean array one entry for each line,
1623-
True for Output and False for Input"""
1628+
Returns:
1629+
A boolean array one entry for each line, ``True`` for
1630+
Output and ``False`` for Input.
16241631
1632+
"""
16251633
stateArray = [None] * self._numLines
16261634
for i in range(self._numLines):
16271635
stateArray[i] = self.get_IO_state(i)
@@ -1633,18 +1641,19 @@ def write_line(self, line, ouput):
16331641
16341642
Args:
16351643
line: the line to be set
1636-
output: the level True for high and Flase for low."""
1644+
output: the level ``True`` for high and ``False`` for low.
1645+
"""
16371646

16381647
raise NotImplementedError()
16391648

16401649
def write_all_lines(self, ouput_array):
16411650
"""Sets the output level of every output line.
16421651
16431652
Args:
1644-
output_array: Boolean array of output states True for high,
1645-
False for low, array entries for lines set
1646-
as inputs are ignored."""
1647-
1653+
output_array: Boolean array of output states ``True`` for
1654+
high, ``False`` for low, array entries for lines set
1655+
as inputs are ignored.
1656+
"""
16481657
if len(ouput_array) != self._numLines:
16491658
raise ("Output array must be numLines in length")
16501659
for i in range(self._numLines):
@@ -1655,15 +1664,21 @@ def write_all_lines(self, ouput_array):
16551664
@abc.abstractmethod
16561665
def read_line(self, line):
16571666
"""Read a single input line.
1667+
16581668
Args:
16591669
line: the line to read
1660-
Return: A boolean of the line state"""
1670+
1671+
Returns:
1672+
A boolean of the line state.
1673+
"""
16611674
raise NotImplementedError()
16621675

16631676
def read_all_lines(self):
16641677
"""Read all the input lines.
1665-
Return: Boolean Array with outline enteries set to None."""
16661678
1679+
Returns:
1680+
Boolean array with outline entries set to ``None``.
1681+
"""
16671682
readarray = [None] * self._numLines
16681683
for i in range(self._numLines):
16691684
readarray[i] = self.read_line(i)
@@ -1673,15 +1688,14 @@ def read_all_lines(self):
16731688
class ValueLogger(DataDevice, metaclass=abc.ABCMeta):
16741689
"""ABC for Value logging device.
16751690
1676-
Value logging Devices utilise the DataDevice infrastrucrure to send
1677-
values to a receiving client. A typical example of data is temperature
1678-
measurements.
1691+
Value logging devices utilise the :class:`DataDevice`
1692+
infrastrucrure to send values to a receiving client. A typical
1693+
example of data is temperature measurements.
16791694
16801695
Args:
16811696
numSensors: total number of measurements.
16821697
16831698
"""
1684-
16851699
def __init__(self, numSensors: int, **kwargs) -> None:
16861700
super().__init__(**kwargs)
16871701
if numSensors < 1:
@@ -1696,5 +1710,5 @@ def initialize(self):
16961710
raise NotImplementedError()
16971711

16981712
def get_num_sensors(self):
1699-
"""Returns the number of sensors lines present in this instance"""
1713+
"""Returns the number of sensors lines present in this instance."""
17001714
return self._numSensors

0 commit comments

Comments
 (0)