Skip to content

Commit 9dd4eb4

Browse files
committed
sphinx-ify documentation
fix places where the epydoc style comments were still used
1 parent 8141a31 commit 9dd4eb4

File tree

6 files changed

+53
-54
lines changed

6 files changed

+53
-54
lines changed

tlslite/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313
To use, do::
1414
1515
from tlslite import TLSConnection, ...
16-
16+
1717
If you want to import the most useful objects, the cleanest way is::
1818
1919
from tlslite.api import *
2020
2121
Then use the L{tlslite.TLSConnection.TLSConnection} class with a socket.
2222
(Or, use one of the integration classes in L{tlslite.integration}).
23-
24-
@version: 0.8.0-alpha36
2523
"""
2624

2725
from tlslite.api import *

tlslite/extensions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def parse(self, parser):
383383
"""Deserialise extension from on-the-wire data.
384384
385385
:param tlslite.utils.codec.Parser parser: data
386-
:rtype TLSExtension
386+
:rtype: TLSExtension
387387
"""
388388
if not parser.getRemainingLength():
389389
self._internal_value = None
@@ -1796,8 +1796,8 @@ class HeartbeatExtension(IntExtension):
17961796
"""
17971797
Heartbeat extension from RFC 6520
17981798
1799-
@type mode: int
1800-
@ivar mode: mode if peer is allowed or nor allowed to send responses
1799+
:type mode: int
1800+
:ivar mode: mode if peer is allowed or nor allowed to send responses
18011801
"""
18021802
def __init__(self):
18031803
super(HeartbeatExtension, self).__init__(

tlslite/handshakesettings.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Keypair(object):
6565
:vartype key: RSAKey or ECDSAKey
6666
:ivar key: private key
6767
68-
:vartype certificates: list of X509
68+
:vartype certificates: list(X509)
6969
:ivar certificates: the certificates to send to peer if the key is selected
7070
for use. The first one MUST include the public key of the ``key``
7171
"""
@@ -89,22 +89,22 @@ class VirtualHost(object):
8989
TODO: support SRP as alternative to certificates
9090
TODO: support PSK as alternative to certificates
9191
92-
:vartype keys: list of :ref:`~Keypair`
92+
:vartype keys: list(Keypair)
9393
:ivar keys: List of certificates and keys to be used in this
9494
virtual host. First keypair able to server ClientHello will be used.
9595
96-
:vartype hostnames: set of bytes
96+
:vartype hostnames: set(bytes)
9797
:ivar hostnames: all the hostnames that server supports
98-
please use :ref:`matches_hostname` to verify if the VirtualHost
98+
please use :py:meth:`matches_hostname` to verify if the VirtualHost
9999
can serve a request to a given hostname as that allows wildcard hosts
100100
that always reply True.
101101
102-
:vartype trust_anchors: list of X509
102+
:vartype trust_anchors: list(X509)
103103
:ivar trust_anchors: list of CA certificates supported for client
104104
certificate authentication, sent in CertificateRequest
105105
106-
:ivar app_protocols: all the application protocols that the server supports
107-
(for ALPN)
106+
:ivar list(bytes) app_protocols: all the application protocols that the
107+
server supports (for ALPN)
108108
"""
109109

110110
def __init__(self):
@@ -146,7 +146,7 @@ class HandshakeSettings(object):
146146
parameters larger than this length, an alert will be signalled.
147147
The default is 8193.
148148
149-
:vartype cipherNames: list
149+
:vartype cipherNames: list(str)
150150
:ivar cipherNames: The allowed ciphers.
151151
152152
The allowed values in this list are 'chacha20-poly1305', 'aes256gcm',
@@ -167,15 +167,15 @@ class HandshakeSettings(object):
167167
The default value is list that excludes 'rc4', 'null' and
168168
'chacha20-poly1305_draft00'.
169169
170-
:vartype macNames: list
170+
:vartype macNames: list(str)
171171
:ivar macNames: The allowed MAC algorithms.
172172
173173
The allowed values in this list are 'sha384', 'sha256', 'aead', 'sha'
174174
and 'md5'.
175175
176176
The default value is list that excludes 'md5'.
177177
178-
:vartype certificateTypes: list
178+
:vartype certificateTypes: list(str)
179179
:ivar certificateTypes: The allowed certificate types.
180180
181181
The only allowed certificate type is 'x509'. This list is only used
@@ -219,7 +219,7 @@ class HandshakeSettings(object):
219219
:vartype sendFallbackSCSV: bool
220220
:ivar sendFallbackSCSV: Whether to, as a client, send FALLBACK_SCSV.
221221
222-
:vartype rsaSigHashes: list
222+
:vartype rsaSigHashes: list(str)
223223
:ivar rsaSigHashes: List of hashes supported (and advertised as such) for
224224
TLS 1.2 signatures over Server Key Exchange or Certificate Verify with
225225
RSA signature algorithm.
@@ -229,7 +229,7 @@ class HandshakeSettings(object):
229229
The allowed hashes are: "md5", "sha1", "sha224", "sha256",
230230
"sha384" and "sha512". The default list does not include md5.
231231
232-
:vartype ecdsaSigHashes: list
232+
:vartype ecdsaSigHashes: list(str)
233233
:ivar ecdsaSigHashes: List of hashes supported (and advertised as such) for
234234
TLS 1.2 signatures over Server Key Exchange or Certificate Verify with
235235
ECDSA signature algorithm.
@@ -239,7 +239,7 @@ class HandshakeSettings(object):
239239
The allowed hashes are: "sha1", "sha224", "sha256",
240240
"sha384" and "sha512".
241241
242-
:vartype eccCurves: list
242+
:vartype eccCurves: list(str)
243243
:ivar eccCurves: List of named curves that are to be supported
244244
245245
:vartype useEncryptThenMAC: bool
@@ -261,21 +261,22 @@ class HandshakeSettings(object):
261261
first curve for eccCurves and may be distinct from curves from that
262262
list.
263263
264-
:vartype keyShares: list
264+
:vartype keyShares: list(str)
265265
:ivar keyShares: list of TLS 1.3 key shares to include in Client Hello
266266
267267
:vartype padding_cb: func
268268
:ivar padding_cb: Callback to function computing number of padding bytes
269269
for TLS 1.3. Signature is cb_func(msg_size, content_type, max_size).
270270
271-
:vartype pskConfigs: list of tuples
271+
:vartype pskConfigs: list(tuple(bytearray, bytearray, bytearray))
272272
:ivar pskConfigs: list of tuples, first element of the tuple is the
273273
human readable, UTF-8 encoded, "identity" of the associated secret
274274
(bytearray, can be empty for TLS 1.2 and earlier), second element is
275275
the binary secret (bytearray), third is an optional parameter
276-
specifying the PRF hash to be used in TLS 1.3 ('sha256' or 'sha384')
276+
specifying the PRF hash to be used in TLS 1.3 (``sha256`` or
277+
``sha384``)
277278
278-
:vartype ticketKeys: list of bytearray
279+
:vartype ticketKeys: list(bytearray)
279280
:ivar ticketKeys: keys to be used for encrypting and decrypting session
280281
tickets. First entry is the encryption key for new tickets and the
281282
default decryption key, subsequent entries are the fallback keys
@@ -296,7 +297,7 @@ class HandshakeSettings(object):
296297
:ivar ticketLifetime: maximum allowed lifetime of ticket encryption key,
297298
in seconds. 1 day by default
298299
299-
:vartype psk_modes: list
300+
:vartype psk_modes: list(str)
300301
:ivar psk_modes: acceptable modes for the PSK key exchange in TLS 1.3
301302
302303
:ivar int max_early_data: maximum number of bytes acceptable for 0-RTT
@@ -312,8 +313,8 @@ class HandshakeSettings(object):
312313
:ivar heartbeat_response_callback: Callback to function when Heartbeat
313314
response is received.
314315
315-
:vartype record_size_limit: int
316-
:ivar record_size_limit: maximum size of records we are willing to process
316+
:vartype ~.record_size_limit: int
317+
:ivar ~.record_size_limit: maximum size of records we are willing to process
317318
(value advertised to the other side). It must not be larger than
318319
2**14+1 (the maximum for TLS 1.3) and will be reduced to 2**14 if TLS
319320
1.2 or lower is the highest enabled version. Must not be set to values

tlslite/messages.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,14 +2268,14 @@ class Heartbeat(object):
22682268
"""
22692269
Handling Heartbeat messages from RFC 6520
22702270
2271-
@type message_type: int
2272-
@ivar message_type: type of message (response or request)
2271+
:type message_type: int
2272+
:ivar message_type: type of message (response or request)
22732273
2274-
@type payload: bytearray
2275-
@ivar payload: payload
2274+
:type payload: bytearray
2275+
:ivar payload: payload
22762276
2277-
@type padding: bytearray
2278-
@ivar padding: random padding of selected length
2277+
:type padding: bytearray
2278+
:ivar padding: random padding of selected length
22792279
"""
22802280

22812281
def __init__(self):
@@ -2335,8 +2335,8 @@ class KeyUpdate(HandshakeMsg):
23352335
"""
23362336
Handling KeyUpdate message from RFC 8446
23372337
2338-
@type message_type: int
2339-
@ivar message_type: type of message (update_not_requested or
2338+
:vartype message_type: int
2339+
:ivar message_type: type of message (update_not_requested or
23402340
update_requested)
23412341
"""
23422342

tlslite/tlsrecordlayer.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,14 +1342,14 @@ def _changeReadState(self):
13421342
def write_heartbeat(self, payload, padding_length):
13431343
"""Start a write operation of heartbeat_request.
13441344
1345-
@type payload: bytes
1346-
@param payload: Payload, that we want send in request and
1345+
:type payload: bytes
1346+
:param payload: Payload, that we want send in request and
13471347
get at response.
13481348
1349-
@type padding_length: int
1350-
@param padding_length: Length of padding.
1349+
:type padding_length: int
1350+
:param padding_length: Length of padding.
13511351
1352-
@raise socket.error: If a socket error occurs.
1352+
:raise socket.error: If a socket error occurs.
13531353
"""
13541354
if self.closed:
13551355
raise TLSClosedConnectionError(
@@ -1367,23 +1367,23 @@ def write_heartbeat(self, payload, padding_length):
13671367
def send_heartbeat_request(self, payload, padding_length):
13681368
"""Synchronous version of write_heartbeat function.
13691369
1370-
@type payload: bytes
1371-
@param payload: Payload, that we want send in request and
1372-
get at response.
1370+
:type payload: bytes
1371+
:param payload: Payload, that we want send in request and
1372+
get at response.
13731373
1374-
@type padding_length: int
1375-
@param padding_length: Length of padding.
1374+
:type padding_length: int
1375+
:param padding_length: Length of padding.
13761376
1377-
@raise socket.error: If a socket error occurs.
1377+
:raise socket.error: If a socket error occurs.
13781378
"""
13791379
for _ in self.write_heartbeat(payload, padding_length):
13801380
pass
13811381

13821382
def _handle_keyupdate_request(self, request):
13831383
"""Process the KeyUpdate request.
13841384
1385-
@type request: KeyUpdate
1386-
@param request: Recieved KeyUpdate message.
1385+
:type request: KeyUpdate
1386+
:param request: Recieved KeyUpdate message.
13871387
"""
13881388
if request.message_type == KeyUpdateMessageType.update_not_requested or\
13891389
request.message_type == KeyUpdateMessageType.update_requested:
@@ -1405,10 +1405,10 @@ def _handle_keyupdate_request(self, request):
14051405
def send_keyupdate_request(self, message_type):
14061406
"""Send a KeyUpdate message.
14071407
1408-
@type payload: int
1409-
@param payload: Type of KeyUpdate message.
1408+
:type payload: int
1409+
:param payload: Type of KeyUpdate message.
14101410
1411-
@raise socket.error: If a socket error occurs.
1411+
:raise socket.error: If a socket error occurs.
14121412
"""
14131413
if self.closed:
14141414
raise TLSClosedConnectionError(

tlslite/utils/format_output.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ def none_as_unknown(text, number):
99
"""
1010
Return text if text isn't None or empty, otherwise return 'unknown(number)'
1111
12-
@type text: str
13-
@param text: string, that we want format
14-
@type number: int
15-
@param number: number used in text
12+
:type text: str
13+
:param text: string, that we want format
14+
:type number: int
15+
:param number: number used in text
1616
"""
1717
if not text:
1818
text = "unknown({0})".format(number)

0 commit comments

Comments
 (0)