Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring, type annotations and fixes #51

Merged
merged 21 commits into from
May 10, 2024

Commits on Mar 8, 2024

  1. [refactor] Use DatumSpecification and DataQueryDatumSpecification in …

    …PDUs
    
    Instead of duplicating code already in the above two classes,
    existing classes that implement the same functionality use them instead.
    
    Access to the underlying attributes is provided through @property-decorated methods.
    
    Affected classes:
    Data Query PDU
    Action Request PDU
    Data PDU
    Set Data PDU
    Event Report PDU
    Comment PDU
    ... and their Reliable counterparts
    ngjunsiang committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    8d1df89 View commit details
    Browse the repository at this point in the history
  2. [style] PEP8 style fixes

    Remove unnecessary whitespace, and add any where required to follow PEP8 recommendations.
    ngjunsiang committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    cc5566d View commit details
    Browse the repository at this point in the history
  3. [refactor] determine number of fixed datums and variable datums dynam…

    …ically
    
    Instead of storing the number  of fixed datums and variable datums as an attribute,
    calculate it from the list of fixed/variable datums when required.
    
    The original attribute names are still accessible, through class properties.
    ngjunsiang committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    b4ccb3d View commit details
    Browse the repository at this point in the history
  4. [style] remove object superclass from class declaration

    This style is no longer required in Python 3; all classes that do not inherit another superclass
    are automatically assumed to subclass object.
    ngjunsiang committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    cb8697b View commit details
    Browse the repository at this point in the history
  5. [refactor] use class attributes for fixed recordType and recordLength

    These are moved from the __init__() to class attributes.
    This pattern makes it less likely for users to accidentally initialise the class with the
    wrong recordType or recordLength, where these values are known beforehand.
    
    Class attributes are accessible by instances of the class, so the serialize() and parse()
    methods are unaffected.
    
    ### Further changes
    
    - added type annotations to attributes, marking them as being an enum, int, or float,
      along with their size in bits
    - fixed init types for some attributes
    - removed some unnecessary comments
    - added table UID in comments for some enums
    ngjunsiang committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    fa6b689 View commit details
    Browse the repository at this point in the history
  6. [refactor] remove number of fixed/variable datums from init

    These are calculated from the list of fixed/variable datum records instead.
    The attributes are still accessible as properties.
    ngjunsiang committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    f62b7e3 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a1093d4 View commit details
    Browse the repository at this point in the history
  8. [fix] DataQueryDatumSpecification reads datumIDs as int instead of Fi…

    …xedDatum or VariableDatum
    ngjunsiang committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    d73d359 View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2024

  1. [docs, fix] Type annotations, parsing fixes

    Changes:
    - removed redundant comments, whitespace
    - added type aliases for Python int, float, bytes
    - added type annotation for init parameters, padding
    - added UID number in comments for enums from SISO-REF-010
    - changed superclass attribute values (pduType, protocolFamily) from init to class attributes
    - Fixed some parsing of arrays
    ngjunsiang committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    76dedb4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a203b75 View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2024

  1. [docs] fix typo in comment

    ngjunsiang committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    5ed33d2 View commit details
    Browse the repository at this point in the history
  2. [refactor] Add type annotations for remaining opendis modules

    The type aliases are moved to their own file, types.py, to avoid a dependency loop.
    ngjunsiang committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    38f71d8 View commit details
    Browse the repository at this point in the history
  3. [fix] fix typo

    ngjunsiang committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    055237d View commit details
    Browse the repository at this point in the history
  4. [refactor] Use context manager for File IO

    This is considered safer as it automatically releases the file handle
    if the program should crash before f.close() is reached.
    ngjunsiang committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    96f3cfb View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2024

  1. Configuration menu
    Copy the full SHA
    0a15142 View commit details
    Browse the repository at this point in the history
  2. [fix] typo fix

    ngjunsiang committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    57e9827 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2024

  1. Delete extraneous file

    ngjunsiang authored Mar 17, 2024
    Configuration menu
    Copy the full SHA
    edd27bd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    460b1e3 View commit details
    Browse the repository at this point in the history
  3. Delete extraneous file

    ngjunsiang authored Mar 17, 2024
    Configuration menu
    Copy the full SHA
    0f8307c View commit details
    Browse the repository at this point in the history
  4. Delete extraneous file

    ngjunsiang authored Mar 17, 2024
    Configuration menu
    Copy the full SHA
    6091189 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0b66829 View commit details
    Browse the repository at this point in the history