Skip to content

Commit

Permalink
Merge branch 'main' into packet-repr
Browse files Browse the repository at this point in the history
  • Loading branch information
medley56 authored Sep 25, 2024
2 parents 952c5f0 + 79462c8 commit 053c53e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions space_packet_parser/comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class Condition(MatchCriteria):
def __init__(self,
left_param: str,
operator: str,
*,
right_param: Optional[str] = None,
right_value: Optional[Any] = None,
left_use_calibrated_value: bool = True,
Expand Down
12 changes: 9 additions & 3 deletions space_packet_parser/encodings.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ class StringDataEncoding(DataEncoding):
_supported_encodings = ('US-ASCII', 'ISO-8859-1', 'Windows-1252', 'UTF-8', 'UTF-16',
'UTF-16LE', 'UTF-16BE', 'UTF-32', 'UTF-32LE', 'UTF-32BE')

def __init__(self, encoding: str = 'UTF-8',
def __init__(self, *,
encoding: str = 'UTF-8',
byte_order: Optional[str] = None,
termination_character: Optional[str] = None,
fixed_length: Optional[int] = None,
Expand Down Expand Up @@ -411,6 +412,7 @@ class NumericDataEncoding(DataEncoding, metaclass=ABCMeta):

def __init__(self, size_in_bits: int,
encoding: str,
*,
byte_order: str = "mostSignificantByteFirst",
default_calibrator: Optional[calibrators.Calibrator] = None,
context_calibrators: Optional[List[calibrators.ContextCalibrator]] = None):
Expand Down Expand Up @@ -550,7 +552,9 @@ class FloatDataEncoding(NumericDataEncoding):
"""<xtce:FloatDataEncoding>"""
_supported_encodings = ['IEEE-754', 'MIL-1750A']

def __init__(self, size_in_bits: int, encoding: str = 'IEEE-754',
def __init__(self, size_in_bits: int,
*,
encoding: str = 'IEEE-754',
byte_order: str = 'mostSignificantByteFirst',
default_calibrator: Optional[calibrators.Calibrator] = None,
context_calibrators: Optional[List[calibrators.ContextCalibrator]] = None):
Expand Down Expand Up @@ -666,7 +670,9 @@ def from_data_encoding_xml_element(cls, element: ElementTree.Element, ns: dict)
class BinaryDataEncoding(DataEncoding):
"""<xtce:BinaryDataEncoding>"""

def __init__(self, fixed_size_in_bits: Optional[int] = None,
def __init__(self,
*,
fixed_size_in_bits: Optional[int] = None,
size_reference_parameter: Optional[str] = None, use_calibrated_value: bool = True,
size_discrete_lookup_list: Optional[List[comparisons.DiscreteLookup]] = None,
linear_adjuster: Optional[callable] = None):
Expand Down
9 changes: 6 additions & 3 deletions space_packet_parser/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,11 @@ def parse_value(self, packet: parseables.CCSDSPacket, **kwargs):
class TimeParameterType(ParameterType, metaclass=ABCMeta):
"""Abstract class for time parameter types"""

def __init__(self, name: str, encoding: encodings.DataEncoding, unit: Optional[str] = None,
epoch: Optional[str] = None, offset_from: Optional[str] = None):
def __init__(self, name: str, encoding: encodings.DataEncoding,
*,
unit: Optional[str] = None,
epoch: Optional[str] = None,
offset_from: Optional[str] = None):
"""Constructor
Parameters
Expand Down Expand Up @@ -369,7 +372,7 @@ def from_parameter_type_xml_element(cls, element: ElementTree.Element, ns: dict)
encoding.default_calibrator = encoding_unit_scaler
epoch = cls.get_epoch(element, ns)
offset_from = cls.get_offset_from(element, ns)
return cls(name, encoding, unit, epoch, offset_from)
return cls(name, encoding, unit=unit, epoch=epoch, offset_from=offset_from)

@staticmethod
def get_units(parameter_type_element: ElementTree.Element, ns: dict) -> Union[str, None]:
Expand Down
3 changes: 2 additions & 1 deletion space_packet_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def legacy_parse_CCSDSPacket(packet: parseables.CCSDSPacket,
return packet

@staticmethod
def print_progress(current_bytes: int, total_bytes: Optional[int],
def print_progress(*, current_bytes: int, total_bytes: Optional[int],
start_time_ns: int, current_packets: int,
end: str = '\r', log: bool = False):
"""Prints a progress bar, including statistics on parsing rate.
Expand Down Expand Up @@ -282,6 +282,7 @@ def print_progress(current_bytes: int, total_bytes: Optional[int],

def generator(self, # pylint: disable=too-many-branches,too-many-statements
binary_data: Union[BinaryIO, socket.socket],
*,
parse_bad_pkts: bool = True,
skip_header_bits: int = 0,
root_container_name="CCSDSPacket",
Expand Down

0 comments on commit 053c53e

Please sign in to comment.