space-packet-parser 4.0.2__tar.gz → 4.1.0__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,7 +1,7 @@
1
1
  cff-version: 1.2.0
2
2
  title: 'space_packet_parser'
3
3
  type: software
4
- version: '4.0.2'
4
+ version: '4.1.0'
5
5
  description: A CCSDS telemetry packet decoding library based on the XTCE packet format description standard.
6
6
  license: BSD-3-Clause
7
7
  abstract: The space_packet_parser Python library is a generalized, configurable packet decoding library for CCSDS telemetry
@@ -11,9 +11,9 @@ abstract: The space_packet_parser Python library is a generalized, configurable
11
11
  generator pattern. The binary string may originate from an in-memory bit stream, a buffered file reader opened in
12
12
  binary mode, or a python socket object; in every case, a small buffer is used to read chunks of data to ensure that
13
13
  memory usage is minimal. The space_packet_parser library supports robust error handling and is capable of skipping malformed
14
- packet structures, unidentified packet structures, and can dynamically parse mixed APID packet streams. The
14
+ packet structures and unidentified packet structures and can dynamically parse mixed APID packet streams. The
15
15
  `Parser.generator` object supports keyword arguments for debugging such as the ability to return unraised parsing
16
- errors, which contain
16
+ errors, which contain partial instances of parsed packet data to aid in debugging.
17
17
  authors:
18
18
  - email: gavin.medley@lasp.colorado.edu
19
19
  name: Gavin Medley
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: space-packet-parser
3
- Version: 4.0.2
3
+ Version: 4.1.0
4
4
  Summary: A CCSDS telemetry packet decoding library based on the XTCE packet format description standard.
5
5
  Home-page: https://github.com/medley56/space_packet_parser
6
6
  License: BSD-3-Clause
@@ -16,12 +16,19 @@ Classifier: Programming Language :: Python :: 3.8
16
16
  Classifier: Programming Language :: Python :: 3.9
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
- Requires-Dist: bitstring (>=3.0.0,<5)
19
+ Requires-Dist: bitstring (>=3.0.0,<4.2)
20
20
  Project-URL: Repository, https://github.com/medley56/space_packet_parser
21
21
  Description-Content-Type: text/markdown
22
22
 
23
- # Space Packet Parser - a configurable parser for CCSDS telemetry packets
24
- This is a package for decoding CCSDS telemetry packets according to an XTCE or CSV packet structure definition.
23
+ # Space Packet Parser
24
+
25
+ ----------
26
+ ![Test Status](https://github.com/medley56/space_packet_parser/actions/workflows/tests.yml/badge.svg)
27
+ ![Doc Status](https://readthedocs.org/projects/space-packet-parser/badge/?version=latest)
28
+
29
+ Documentation: https://space-packet-parser.readthedocs.io/en/latest/
30
+
31
+ Space Packet Parser is a package for decoding CCSDS telemetry packets according to an XTCE or CSV packet structure definition.
25
32
  It is based on the UML model of the XTCE spec and aims to support all but the most esoteric elements of the
26
33
  XTCE telemetry packet specification.
27
34
 
@@ -35,3 +42,4 @@ Resources:
35
42
  pip install space_packet_parser
36
43
  ```
37
44
 
45
+
@@ -1,5 +1,12 @@
1
- # Space Packet Parser - a configurable parser for CCSDS telemetry packets
2
- This is a package for decoding CCSDS telemetry packets according to an XTCE or CSV packet structure definition.
1
+ # Space Packet Parser
2
+
3
+ ----------
4
+ ![Test Status](https://github.com/medley56/space_packet_parser/actions/workflows/tests.yml/badge.svg)
5
+ ![Doc Status](https://readthedocs.org/projects/space-packet-parser/badge/?version=latest)
6
+
7
+ Documentation: https://space-packet-parser.readthedocs.io/en/latest/
8
+
9
+ Space Packet Parser is a package for decoding CCSDS telemetry packets according to an XTCE or CSV packet structure definition.
3
10
  It is based on the UML model of the XTCE spec and aims to support all but the most esoteric elements of the
4
11
  XTCE telemetry packet specification.
5
12
 
@@ -12,3 +19,4 @@ Resources:
12
19
  ```bash
13
20
  pip install space_packet_parser
14
21
  ```
22
+
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "space_packet_parser"
3
- version = "4.0.2"
3
+ version = "4.1.0"
4
4
  description = "A CCSDS telemetry packet decoding library based on the XTCE packet format description standard."
5
5
  license = "BSD-3-Clause"
6
6
  readme = "README.md"
@@ -35,7 +35,7 @@ keywords = [
35
35
 
36
36
  [tool.poetry.dependencies]
37
37
  python = ">=3.8,<3.12"
38
- bitstring = ">=3.0.0,<5"
38
+ bitstring = ">=3.0.0,<4.2"
39
39
 
40
40
  [tool.poetry.group.dev.dependencies]
41
41
  pylint = "^2"
@@ -47,6 +47,7 @@ sphinx = "^6.1.3"
47
47
  myst-parser = "^1.0.0"
48
48
  sphinx-autoapi = "^2.0.1"
49
49
  sphinx-rtd-theme = "^1.2.0"
50
+ coverage = "^7.2.5"
50
51
 
51
52
  [tool.poetry.group.examples]
52
53
  optional = true
@@ -401,6 +401,7 @@ class PacketParser:
401
401
  ccsds_headers_only : bool, Optional
402
402
  If True, only parses the packet headers (does not use the provided packet definition).
403
403
  yield_unrecognized_packet_errors : bool, Optional
404
+ Default False.
404
405
  If False, UnrecognizedPacketTypeErrors are caught silently and parsing continues to the next packet.
405
406
  If True, the generator will yield an UnrecognizedPacketTypeError in the event of an unrecognized
406
407
  packet. Note: These exceptions are not raised by default but are instead returned so that the generator
@@ -445,24 +446,29 @@ class PacketParser:
445
446
  Number of bits added to the buffer. Note that the buffer may still have nonzero length from previous
446
447
  data even when this returns zero.
447
448
  """
449
+ curser_pos = buffer.pos # Keep track of the original buffer cursor location
448
450
  if isinstance(source, io.BufferedIOBase):
449
451
  new_bytes = source.read(read_size_bytes)
450
452
  buffer += new_bytes
451
- return len(new_bytes)*8
452
-
453
- if isinstance(source, socket.socket):
453
+ n_new_bits = len(new_bytes)*8
454
+ elif isinstance(source, socket.socket):
454
455
  new_bytes = source.recv(read_size_bytes)
455
456
  buffer += new_bytes # Append BitStream with newly read bytes
456
- return len(new_bytes)*8
457
-
458
- if isinstance(source, bitstring.ConstBitStream):
457
+ n_new_bits = len(new_bytes)*8
458
+ elif isinstance(source, bitstring.ConstBitStream):
459
+ # This either reads read_size_bytes bytes or it just reads to the end of the data
459
460
  new_bits = source[source.pos:source.pos + read_size_bytes * 8]
460
- assert isinstance(new_bits, bitstring.ConstBitStream)
461
- source.pos += len(new_bits) # This way we never overshoot the end of the data
461
+ source.pos += len(new_bits) # Set the source.pos to exactly where we read to
462
462
  buffer += new_bits
463
- return len(new_bits)
464
-
465
- raise ValueError(f"Unrecognized data source: {source}")
463
+ n_new_bits = len(new_bits)
464
+ elif isinstance(source, io.TextIOWrapper):
465
+ raise IOError(f"Packet data file opened in TextIO mode. You must open packet data in binary mode.")
466
+ else:
467
+ raise IOError(f"Unrecognized data source: {source}")
468
+
469
+ # Reset buffer.pos to the original position before we extended it
470
+ buffer.pos = curser_pos
471
+ return n_new_bits
466
472
 
467
473
  # ========
468
474
  # Start of generator
@@ -1,30 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['space_packet_parser']
6
-
7
- package_data = \
8
- {'': ['*']}
9
-
10
- install_requires = \
11
- ['bitstring>=3.0.0,<5']
12
-
13
- setup_kwargs = {
14
- 'name': 'space-packet-parser',
15
- 'version': '4.0.2',
16
- 'description': 'A CCSDS telemetry packet decoding library based on the XTCE packet format description standard.',
17
- 'long_description': '# Space Packet Parser - a configurable parser for CCSDS telemetry packets\nThis is a package for decoding CCSDS telemetry packets according to an XTCE or CSV packet structure definition. \nIt is based on the UML model of the XTCE spec and aims to support all but the most esoteric elements of the \nXTCE telemetry packet specification.\n\nResources:\n- [XTCE (Green Book - Informational Report)](https://public.ccsds.org/Pubs/660x2g2.pdf)\n- [XTCE Element Description (Green Book - Informational Report)](https://public.ccsds.org/Pubs/660x1g2.pdf)\n- [XTCE (Blue Book - Recommended Standard)](https://public.ccsds.org/Pubs/660x0b2.pdf)\n\n## Installation\n```bash\npip install space_packet_parser\n```\n',
18
- 'author': 'Gavin Medley',
19
- 'author_email': 'gavin.medley@lasp.colorado.edu',
20
- 'maintainer': 'Gavin Medley',
21
- 'maintainer_email': 'gavin.medley@lasp.colorado.edu',
22
- 'url': 'https://github.com/medley56/space_packet_parser',
23
- 'packages': packages,
24
- 'package_data': package_data,
25
- 'install_requires': install_requires,
26
- 'python_requires': '>=3.8,<3.12',
27
- }
28
-
29
-
30
- setup(**setup_kwargs)