Skip to content

Commit 7ecfcf6

Browse files
committed
doc: fix doc issues
https://onedigi.atlassian.net/browse/XBPL-425 Signed-off-by: Tatiana Leon <[email protected]>
1 parent 0cbcf52 commit 7ecfcf6

File tree

12 files changed

+57
-54
lines changed

12 files changed

+57
-54
lines changed

digi/xbee/devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9002,7 +9002,7 @@ def export(self, dir_path=None, name=None, desc=None):
90029002
90039003
If the provided path already exists the file is removed.
90049004
9005-
Params:
9005+
Args:
90069006
dir_path (String, optional, default=`None`): Absolute path of the
90079007
directory to export the network. It should not include the file
90089008
name. If not defined home directory is used.
@@ -9052,7 +9052,7 @@ def update_nodes(self, task_list):
90529052
"""
90539053
Performs the provided update tasks. It blocks until all tasks finish.
90549054
9055-
Params:
9055+
Args:
90569056
task_list (List or tuple): List of update tasks
90579057
(:class:`.FwUpdateTask` or :class:`.ProfileUpdateTask`)
90589058

digi/xbee/firmware.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6440,7 +6440,7 @@ def _get_updater_candidates(self, net_discover=False):
64406440
Returns a list of updater candidates extracted from the current
64416441
network connections or from a neighbor discover.
64426442
6443-
Params:
6443+
Args:
64446444
net_discover (Boolean, optional, default=False): `True` to perform
64456445
a neighbor discover, `False` to use current network connections.
64466446
@@ -6497,7 +6497,7 @@ def _is_valid_updater_candidate(self, node):
64976497
Checks if the provided node is a valid candidate to be the updater node
64986498
for the update process of the remote.
64996499
6500-
Params:
6500+
Args:
65016501
node (:class: `.RemoteXBeeDevice`): The node to check if it is a
65026502
possible updater.
65036503
"""
@@ -6522,7 +6522,7 @@ def _determine_best_updater_from_candidates_list_zigbee(self, candidates):
65226522
Determines which is the best updater node of the given list for a
65236523
Zigbee network.
65246524
6525-
Params:
6525+
Args:
65266526
candidates (List): List of possible XBee updater devices.
65276527
65286528
Returns:
@@ -6546,7 +6546,7 @@ def _determine_best_updater_from_candidates_list_digimesh(self, candidates):
65466546
Determines which is the best updater node of the given list for a
65476547
DigiMesh network.
65486548
6549-
Params:
6549+
Args:
65506550
candidates (List): List of possible XBee updater devices.
65516551
65526552
Returns:
@@ -6701,7 +6701,7 @@ def _ota_callback(self, frame):
67016701
"""
67026702
Callback used to receive OTA firmware update process status frames.
67036703
6704-
Params:
6704+
Args:
67056705
frame (:class:`.XBeePacket`): Received XBee packet.
67066706
"""
67076707
# If frame was already received, ignore this frame, just notify.
@@ -6737,7 +6737,7 @@ def _create_ota_explicit_packet(self, frame_id, payload):
67376737
Creates and returns an OTA firmware update explicit packet using the
67386738
given parameters.
67396739
6740-
Params:
6740+
Args:
67416741
frame_id (Integer): Frame ID of the packet.
67426742
payload (Bytearray): Packet payload.
67436743
@@ -6832,7 +6832,7 @@ def _send_firmware_data(self, data, ebl_file):
68326832
"""
68336833
Sends the given firmware data to the updater device.
68346834
6835-
Params:
6835+
Args:
68366836
Bytearray: Firmware data to send.
68376837
ebl_file (:class:`._EBLFile`): Ebl file being transferred.
68386838

digi/xbee/models/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class SMSMessage:
320320
This class is used within the library to read SMS sent to Cellular devices.
321321
"""
322322

323-
__PHONE_NUMBER_PATTERN = "^\+?\d+$"
323+
__PHONE_NUMBER_PATTERN = r"^\+?\d+$"
324324

325325
def __init__(self, phone_number, data):
326326
"""

digi/xbee/packets/cellular.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from digi.xbee.util import utils
2323

2424

25-
PATTERN_PHONE_NUMBER = "^\+?\d+$"
25+
PATTERN_PHONE_NUMBER = r"^\+?\d+$"
2626
"""Pattern used to validate the phone number parameter of SMS packets."""
2727

2828

digi/xbee/packets/factory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
+----------------+ +-------------------+ +--------------------------- + +----------------+
4545
| 0x7E | | MSB | LSB | | API-specific Structure | | 1 Byte |
4646
+----------------+ +-------------------+ +----------------------------+ +----------------+
47-
\___________________________________ _________________________________/
48-
\/
47+
\\___________________________________ ________________________________/
48+
\\/
4949
Characters Escaped If Needed
5050
5151
MSB = Most Significant Byte, LSB = Least Significant Byte
@@ -121,7 +121,7 @@
121121
SocketReceiveFromPacket, SocketStatePacket
122122
from digi.xbee.packets.wifi import RemoteATCommandWifiPacket, \
123123
RemoteATCommandResponseWifiPacket, IODataSampleRxIndicatorWifiPacket
124-
from digi.xbee.packets.zigbee import RegisterJoiningDevicePacket,\
124+
from digi.xbee.packets.zigbee import RegisterJoiningDevicePacket, \
125125
RegisterDeviceStatusPacket, RouteRecordIndicatorPacket, OTAFirmwareUpdateStatusPacket
126126
from digi.xbee.packets.bluetooth import BluetoothGAPScanLegacyAdvertisementResponsePacket, \
127127
BluetoothGAPScanExtendedAdvertisementResponsePacket, BluetoothGAPScanStatusPacket

digi/xbee/profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ def xbee(self):
13871387
@property
13881388
def profile_path(self):
13891389
"""
1390-
Gets the *.xpro file path.
1390+
Gets the `*.xpro` file path.
13911391
13921392
Returns:
13931393
String: The profile path for the update task.

digi/xbee/reader.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from digi.xbee.exception import TimeoutException, InvalidPacketException
4343
from digi.xbee.io import IOSample
4444

45-
4645
# Maximum number of parallel callbacks.
4746
MAX_PARALLEL_CALLBACKS = 50
4847

@@ -65,6 +64,7 @@ def callback_prototype(*args, **kwargs):
6564
.. seealso::
6665
| list (Python standard class)
6766
"""
67+
6868
def __call__(self, *args, **kwargs):
6969
for func in self:
7070
future = EXECUTOR.submit(func, *args, **kwargs)
@@ -510,7 +510,7 @@ class methods. This callbacks must have a certain header, see each event
510510
Here are the parameters which will be received by the event callbacks,
511511
depending on which event it is in each case:
512512
513-
The following parameters are passed via \*\*kwargs to event callbacks of:
513+
The following parameters are passed via \\*\\*kwargs to event callbacks of:
514514
515515
1. PacketReceived:
516516
1.1 received_packet (:class:`.XBeeAPIPacket`): Received packet.
@@ -1659,11 +1659,11 @@ def __execute_user_callbacks(self, packet, remote=None):
16591659
# Bluetooth BLE GAP Scan Legacy Advertisement Response
16601660
elif f_type == ApiFrameType.BLUETOOTH_GAP_SCAN_LEGACY_ADVERTISEMENT_RESPONSE:
16611661
self.__ble_gap_scan_received(BLEGAPScanLegacyAdvertisementMessage(
1662-
packet.address,
1663-
packet.address_type,
1664-
packet.advertisement_flags,
1665-
packet.rssi,
1666-
packet.payload))
1662+
packet.address,
1663+
packet.address_type,
1664+
packet.advertisement_flags,
1665+
packet.rssi,
1666+
packet.payload))
16671667
self._log.debug(self._LOG_PATTERN.format(
16681668
comm_iface=str(self.__xbee.comm_iface), event="RECEIVED",
16691669
fr_type="BLE GAP SCAN LEGACY", sender=str(packet.address),
@@ -1672,17 +1672,17 @@ def __execute_user_callbacks(self, packet, remote=None):
16721672
# Bluetooth BLE GAP Scan Extended Advertisement Response
16731673
elif f_type == ApiFrameType.BLUETOOTH_GAP_SCAN_EXTENDED_ADVERTISEMENT_RESPONSE:
16741674
self.__ble_gap_scan_received(BLEGAPScanExtendedAdvertisementMessage(
1675-
packet.address,
1676-
packet.address_type,
1677-
packet.advertisement_flags,
1678-
packet.rssi,
1679-
packet.advertisement_set_id,
1680-
packet.primary_phy,
1681-
packet.secondary_phy,
1682-
packet.tx_power,
1683-
packet.periodic_interval,
1684-
packet.data_completeness,
1685-
packet.payload))
1675+
packet.address,
1676+
packet.address_type,
1677+
packet.advertisement_flags,
1678+
packet.rssi,
1679+
packet.advertisement_set_id,
1680+
packet.primary_phy,
1681+
packet.secondary_phy,
1682+
packet.tx_power,
1683+
packet.periodic_interval,
1684+
packet.data_completeness,
1685+
packet.payload))
16861686
self._log.debug(self._LOG_PATTERN.format(
16871687
comm_iface=str(self.__xbee.comm_iface), event="RECEIVED",
16881688
fr_type="BLE GAP SCAN EXTENDED", sender=str(packet.address),
@@ -1691,7 +1691,7 @@ def __execute_user_callbacks(self, packet, remote=None):
16911691
# Bluetooth BLE GAP Scan Status Response
16921692
elif f_type == ApiFrameType.BLUETOOTH_GAP_SCAN_STATUS:
16931693
self.__ble_gap_scan_status_received(BLEGAPScanStatusMessage(
1694-
packet.scan_status))
1694+
packet.scan_status))
16951695
self._log.debug(self._LOG_PATTERN.format(
16961696
comm_iface=str(self.__xbee.comm_iface), event="RECEIVED",
16971697
fr_type="BLE GAP SCAN STATUS", sender="None",

digi/xbee/util/exportutils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def generate_network_xml(xbee, date_now=None, name=None, desc=None):
3030
"""
3131
Generates the XML hierarchy representing the network of the given XBee.
3232
33-
Params:
33+
Args:
3434
xbee (:class:`.XBeeDevice`): Local XBee node.
3535
date_now (:class: `datetime.datetime`, optional, default=`None`): Date
3636
to set in the XML.
@@ -69,7 +69,7 @@ def _generate_nodes_xml(xbee, level=0):
6969
"""
7070
Generates the XML element representing the network of the given XBee.
7171
72-
Params:
72+
Args:
7373
xbee (:class:`.XBeeDevice`): Local XBee node.
7474
level (Integer, optional, default=0): Indentation level.
7575
@@ -96,7 +96,7 @@ def _generate_node_xml(node, level=0):
9696
"""
9797
Generates the XML element representing the given XBee node.
9898
99-
Params:
99+
Args:
100100
xbee (:class:`.AbstractXBeeDevice`): XBee node.
101101
level (Integer, optional, default=0): Indentation level.
102102
@@ -146,7 +146,7 @@ def _generate_serial_config_xml(serial_port, level=0):
146146
"""
147147
Generates the XML element representing the given serial port.
148148
149-
Params:
149+
Args:
150150
serial_port (:class:`serial.serialutil.SerialBase`): Serial port.
151151
level (Integer, optional, default=0): Indentation level.
152152
@@ -189,7 +189,7 @@ def _generate_connections_xml(node, connections, level=0):
189189
"""
190190
Generates the XML node representing the given connections.
191191
192-
Params:
192+
Args:
193193
xbee (:class:`.AbstractXBeeDevice`): XBee node.
194194
connections (List): List of :class:`.Connection`.
195195
level (Integer, optional, default=0): Indentation level.

digi/xbee/util/srp.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from digi.xbee.util import utils
2222

23+
2324
@unique
2425
class HAType(Enum):
2526
"""
@@ -78,6 +79,7 @@ def get(cls, code):
7879

7980
HAType.__doc__ += utils.doc_enum(HAType)
8081

82+
8183
@unique
8284
class NgGroupParams(Enum):
8385
"""
@@ -286,11 +288,11 @@ def get(cls, code):
286288

287289

288290
def create_salted_verification_key(user, password, hash_alg=HAType.SHA256,
289-
ng_type=NgGroupParams.NG_1024, salt_len=4):
291+
ng_type=NgGroupParams.NG_1024, salt_len=4):
290292
"""
291293
Generates a salted verification key for the provided username and password.
292294
293-
Params:
295+
Args:
294296
user (String): Username string.
295297
password (String): Plain text password.
296298
hash_alg (:class:`.HAType`, optional, default=`HAType.SHA256`): Hash algorithm.
@@ -301,39 +303,39 @@ def create_salted_verification_key(user, password, hash_alg=HAType.SHA256,
301303
Returns:
302304
Tuple (bytes, bytes): Tuple with salt and verifier.
303305
"""
304-
s = generate_salt(l=salt_len)
306+
s = generate_salt(length=salt_len)
305307
v = generate_verifier(user, password, hash_alg=hash_alg, ng_type=ng_type,
306308
salt=s, sep=":")
307309

308310
return s, v
309311

310312

311-
def generate_salt(l=4):
313+
def generate_salt(length=4):
312314
"""
313315
Generates new salt.
314316
315-
Params:
316-
l (Integer, optional, default=`4`): Number of bytes.
317+
Args:
318+
length (Integer, optional, default=`4`): Number of bytes.
317319
318320
Returns:
319321
Bytes: The generated salt.
320322
"""
321-
return os.urandom(l)
323+
return os.urandom(length)
322324

323325

324326
def generate_verifier(user, password, salt, hash_alg=HAType.SHA256,
325327
ng_type=NgGroupParams.NG_1024, sep=":"):
326328
"""
327329
Calculates a verifier for the provided salt and configured password.
328330
329-
Params:
331+
Args:
330332
user (String): Username string.
331333
password (String): Plain text password.
332334
salt (bytes): Salt to generate a verifier.
333335
hash_alg (:class:`.HAType`, optional, default=`HAType.SHA256`): Hash algorithm.
334336
ng_type (:class:`.NgGroupParams`, optional, default=`NgGroupParams.NG_1024`):
335337
Prime generator type.
336-
sep (String, optional, default= `:`): Separator string.
338+
sep (String, optional): Separator string.
337339
338340
Returns:
339341
Bytes: The generated verifier.
@@ -352,12 +354,12 @@ def __calculate_x(user, password, salt, hash_alg=HAType.SHA256, sep=":"):
352354
"""
353355
Calculates the user secret parameter.
354356
355-
Params:
357+
Args:
356358
user (String): Username string.
357359
password (String): Plain text password.
358360
salt (bytes): Salt byte array.
359361
hash_alg (:class:`.HAType`, optional, default=`HAType.SHA256`): Hash algorithm.
360-
sep (String, optional, default= `:`): Separator string.
362+
sep (String, optional): Separator string.
361363
362364
Returns:
363365
Integer: The user secret value.
@@ -376,7 +378,7 @@ def __hash(hash_alg, *args):
376378
"""
377379
Calculates the hash of the provided arguments.
378380
379-
Params:
381+
Args:
380382
args: Variable argument list of object to use for hash.
381383
382384
Returns:
@@ -393,7 +395,7 @@ def __to_bytes(obj):
393395
"""
394396
Converts object to byte array, with optional context.
395397
396-
Params:
398+
Args:
397399
obj: Object to convert.
398400
399401
Returns:

doc/api/digi.xbee.models.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ Submodules
2121
digi.xbee.models.message
2222
digi.xbee.models.options
2323
digi.xbee.models.protocol
24+
digi.xbee.models.statistics
2425
digi.xbee.models.status
2526
digi.xbee.models.zdo

0 commit comments

Comments
 (0)