Skip to content

Commit 94735bd

Browse files
committed
Now documenting private members.
1 parent 51bd647 commit 94735bd

3 files changed

Lines changed: 37 additions & 35 deletions

File tree

docs/reference/decoder/index.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ Decode a cuplcodec URL
77
The decoder extracts a timestamped list of samples from a cuplcodec URL.
88

99
.. automodule:: wscodec.decoder.decoderfactory
10-
:members:
10+
:private-members:
1111

1212
.. inheritance-diagram:: wscodec.decoder.hdc2021.TempRH_URL wscodec.decoder.hdc2021.Temp_URL
1313
:parts: 2
1414

1515
.. autoclass:: wscodec.decoder.hdc2021.TempRH_URL
16-
:members:
16+
:private-members:
1717

1818
.. autoclass:: wscodec.decoder.hdc2021.Temp_URL
19-
:members:
19+
:private-members:
2020

2121
.. autoclass:: wscodec.decoder.samples.SamplesURL
22-
:members:
22+
:private-members:
2323

2424
.. autoclass:: wscodec.decoder.pairs.PairsURL
25-
:members:
25+
:private-members:
2626

2727
.. automodule:: wscodec.decoder.circularbuffer
28-
:members:
28+
:private-members:
2929

3030
Sample
3131
--------
@@ -34,24 +34,24 @@ Sample
3434
:parts: 2
3535

3636
.. autoclass:: wscodec.decoder.hdc2021.TempRHSample
37-
:members:
37+
:private-members:
3838

3939
.. autoclass:: wscodec.decoder.hdc2021.TempSample
40-
:members:
40+
:private-members:
4141

4242
.. autoclass:: wscodec.decoder.samples.Sample
43-
:members:
43+
:private-members:
4444

4545
Pair
4646
-----
4747

4848
.. autoclass:: wscodec.decoder.pairs.Pair
49-
:members:
49+
:private-members:
5050

5151
Status
5252
-------
5353

5454
.. automodule:: wscodec.decoder.status
55-
:members:
55+
:private-members:
5656

5757

wscodec/decoder/circularbuffer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
class CircularBufferURL:
88
"""
9-
t
9+
1010
"""
11-
ELAPSED_LEN_BYTES = 4
12-
ENDSTOP_LEN_BYTES = 16
13-
ENDSTOP_BYTE = '~' # This must be URL Safe
11+
ELAPSED_LEN_BYTES = 4 #: Length of the endstop elapsed minutes field in bytes (including the endstop itself).
12+
ENDSTOP_LEN_BYTES = 16 #: Length of the endstop in bytes.
13+
ENDSTOP_BYTE = '~' #: The last character in the endstop and the end of the circular buffer. Must be URL safe.
1414

1515
def __init__(self, statb64: str, circb64: str = None):
1616
"""

wscodec/decoder/pairs.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
import hashlib
88
import hmac
99

10-
BYTES_PER_PAIR = 3
11-
BYTES_PER_PAIRB64 = 4
12-
PAIRS_PER_DEMI = 2
13-
BYTES_PER_DEMI = BYTES_PER_PAIRB64 * PAIRS_PER_DEMI
10+
BYTES_PER_PAIR = 3 #: The number of bytes in each decoded Pair.
11+
BYTES_PER_PAIRB64 = 4 #: The number of bytes in each base64 encoded Pair.
12+
PAIRS_PER_DEMI = 2 #: The number of pairs in each 8-byte demi.
13+
BYTES_PER_DEMI = BYTES_PER_PAIRB64 * PAIRS_PER_DEMI #: The number of bytes in each demi.
14+
1415

1516
class HashType(Enum):
1617
MD5 = 1
1718
HMAC_MD5 = 2
1819

20+
1921
class Pair:
2022
"""
2123
Class representing a pair of 12-bit sensor readings.
@@ -100,23 +102,23 @@ def readings(self):
100102

101103

102104
class PairsURL(CircularBufferURL):
103-
def __init__(self, *args, usehmac: bool = False, secretkey: str = None, **kwargs):
104-
"""
105-
This takes the payload of the linearised buffer, which is a long string of base64 characters. It decodes this
106-
into a list of pairs. The hash (MD5 or HMAC-MD5) is taken and compared with that supplied in the URL by the
107-
encoder. If the hashes match then the decode has been successful. If not, an exception is raised.
105+
"""
106+
This takes the payload of the linearised buffer, which is a long string of base64 characters. It decodes this
107+
into a list of pairs. The hash (MD5 or HMAC-MD5) is taken and compared with that supplied in the URL by the
108+
encoder. If the hashes match then the decode has been successful. If not, an exception is raised.
108109
109-
Parameters
110-
----------
111-
*args
112-
Variable length argument list.
113-
usehmac: bool
114-
True if the hash inside the circular buffer endstop is HMAC-MD5. False if it is MD5.
115-
secretkey: str
116-
HMAC secret key as a string. Normally 16 characters long.
117-
**kwargs
118-
Keyword arguments to be passed to parent class constructors.
119-
"""
110+
Parameters
111+
----------
112+
*args
113+
Variable length argument list.
114+
usehmac: bool
115+
True if the hash inside the circular buffer endstop is HMAC-MD5. False if it is MD5.
116+
secretkey: str
117+
HMAC secret key as a string. Normally 16 characters long.
118+
**kwargs
119+
Keyword arguments to be passed to parent class constructors.
120+
"""
121+
def __init__(self, *args, usehmac: bool = False, secretkey: str = None, **kwargs):
120122
super().__init__(*args, **kwargs)
121123

122124
self._decode_pairs()

0 commit comments

Comments
 (0)