PyVLCB 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyVLCB
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A library for CBUS / VLCB communication
5
5
  Author-email: "Stewart Watkiss (penguintutor)" <5587863+penguintutor@users.noreply.github.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyVLCB"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "A library for CBUS / VLCB communication"
9
9
  readme = {file="README.md", content-type = "text/markdown"}
10
10
  requires-python = ">=3.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyVLCB
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A library for CBUS / VLCB communication
5
5
  Author-email: "Stewart Watkiss (penguintutor)" <5587863+penguintutor@users.noreply.github.com>
6
6
  License: MIT License
@@ -152,6 +152,7 @@ class VLCBOpcode:
152
152
  """
153
153
  # Dict from opcode to dict of opcode information
154
154
  opcodes = {
155
+ '': {'opc': 'N/A', 'title': 'Null', 'format': '', 'minpri': 0, 'comment': 'Null Opcode / data packet'},
155
156
  '00': {'opc': 'ACK', 'title': 'General Acknowledgement', 'format': '', 'minpri': 2, 'comment': 'Positive response to query/request performed for report of availability online'},
156
157
  '01': {'opc': 'NAK', 'title': 'General No Ack', 'format': '', 'minpri': 2, 'comment': 'Negative response to query/request denied'},
157
158
  '02': {'opc': 'HLT', 'title': 'Bus Halt', 'format': '', 'minpri': 0, 'comment': 'Commonly broadcasted to all nodes to indicate CBUS is not available and no further packets should be sent until a BON or ARST is received'},
@@ -462,14 +463,15 @@ class VLCBOpcode:
462
463
 
463
464
  Returns:
464
465
  String: shortened opcode string
466
+ or empty string for NULL opcode
465
467
 
466
- Raises:
467
- ValueError: If string does not contain at least 2 characters
468
468
  """
469
- if len(opcode_string) >= 2:
469
+ # Also ignore - in position 1 (eg. " - ")
470
+ if len(opcode_string) >= 2 and opcode_string[1] != "-":
470
471
  return opcode_string[0:2]
471
472
  else:
472
- raise ValueError(f"String {opcode_string} is too short.")
473
+ # If not a opcode_string (eg. Null) return ""
474
+ return ""
473
475
 
474
476
  # Get min priority from opcode
475
477
  @staticmethod
@@ -483,7 +485,7 @@ class VLCBOpcode:
483
485
  ValueError: If opcode not found
484
486
  """
485
487
  opcode = VLCBOpcode.opcode_extract(opcode)
486
- if opcode in VLCBOpcode.opcodes.keys():
488
+ if opcode in VLCBOpcode.opcodes:
487
489
  return VLCBOpcode.opcodes[opcode]['minpri']
488
490
  else:
489
491
  raise ValueError(f"Opcode {opcode} is not defined.")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes