Beispiel #1
0
 def __init__(self,
              component_descriptor: ComponentDescriptor,
              ld: LogicalData,
              template_attribute: TemplateAttribute,
              ):
     super().__init__(component_descriptor)
     if self.component_descriptor.has_attribute_L:
         self.label = RepCode.IDENT(ld)
     else:
         self.label = template_attribute.label
     if self.component_descriptor.has_attribute_C:
         self.count = RepCode.UVARI(ld)
     else:
         self.count = template_attribute.count
     if self.component_descriptor.has_attribute_R:
         self.rep_code = RepCode.USHORT(ld)
     else:
         self.rep_code = template_attribute.rep_code
     if self.component_descriptor.has_attribute_U:
         self.units = RepCode.UNITS(ld)
     else:
         self.units = template_attribute.units
     if self.component_descriptor.has_attribute_V:
         self.value = [RepCode.code_read(self.rep_code, ld) for _i in range(self.count)]
     else:
         self.value = template_attribute.value
Beispiel #2
0
 def __init__(self, lr_type: int, ld: File.LogicalData):
     self.lr_type: int = lr_type
     # [RP66V1 Section 3.3 Indirectly Formatted Logical Record]
     self.object_name: RepCode.ObjectName = RepCode.OBNAME(ld)
     # [RP66V1 Section 5.6.1 Frames]
     self.frame_number = RepCode.UVARI(ld)
     self.preamble_length = ld.index
     self.remain = ld.remain
     # Frame numbers start from 1 but there are many observed cases of IFLRs that have a 0 frame number and zero
     # remaining data. Here we only warn if the frame number is zero and the remaining data is non-zero.
     # We warn rather than raising in the spirit of optimism.
     if self.frame_number == 0 and self.remain != 0:
         logger.warning(
             f'Frame number needs to be >= 1, not {self.frame_number} [RP66V1 Section 5.6.1 Frames] (there is data remaining)'
         )
Beispiel #3
0
def test_UVARI(ld, expected):
    result = RepCode.UVARI(ld)
    assert result == expected
    assert ld.remain == 0