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

Refactor the compu methods #306

Merged
merged 7 commits into from
May 23, 2024
Merged

Commits on May 23, 2024

  1. refactor the compu methods

    now, they work as they are defined by the XSD: all parameters are set
    by the fields specified by the basic `CompuMethod` class, and the
    specific behavior of the individual categories are implemented by
    subclasses.  This encompasses extracting the relevant data from their
    generic form via `__post_init__()` methods in the subclasses and doing
    the actual computations to translate internal values to/from physical
    values. This approach has the advantages that it is quite a bit
    cleaner than the previous code (albeit still quite messy IMO), that
    all compu methods can be handled using the same output writing code
    and -- most importantly -- that the code now reflects the
    specification reasonably closely now.
    
    Signed-off-by: Andreas Lauser <[email protected]>
    Signed-off-by: Katja Köhler <[email protected]>
    andlaus committed May 23, 2024
    Configuration menu
    Copy the full SHA
    67d2b30 View commit details
    Browse the repository at this point in the history
  2. compu methods: unify handling constants

    the XSD is very redundant and messy here: it defines multiple
    identical groups and does not use inheritance. That said, that does not prevent it to do it better...
    
    thanks to [at]kayoub5 for the nudge!
    
    Signed-off-by: Andreas Lauser <[email protected]>
    Signed-off-by: Katja Köhler <[email protected]>
    andlaus committed May 23, 2024
    Configuration menu
    Copy the full SHA
    cbd5a8f View commit details
    Browse the repository at this point in the history
  3. TabIntpCompuMethod: improve docstring

    Signed-off-by: Andreas Lauser <[email protected]>
    Signed-off-by: Katja Köhler <[email protected]>
    andlaus committed May 23, 2024
    Configuration menu
    Copy the full SHA
    53f2841 View commit details
    Browse the repository at this point in the history
  4. compu methods: raise En-/DecodeError when encountering incorrect runt…

    …ime data
    
    feeding incorrect data to be en-/decoded should only trigger
    `EncodeError` or `DecodeError`. (`OdxError` means "incorrect ODX
    model detected")
    
    Signed-off-by: Andreas Lauser <[email protected]>
    Signed-off-by: Katja Köhler <[email protected]>
    andlaus committed May 23, 2024
    Configuration menu
    Copy the full SHA
    10bc14b View commit details
    Browse the repository at this point in the history
  5. don't postfix private class functions with double underscores

    these are reservered for "magic" functions and according to PEP 8
    should never be newly created by user code.
    
    thanks to [at]kayoub5 for the catch!
    
    Signed-off-by: Andreas Lauser <[email protected]>
    Signed-off-by: Katja Köhler <[email protected]>
    andlaus committed May 23, 2024
    Configuration menu
    Copy the full SHA
    58ea631 View commit details
    Browse the repository at this point in the history
  6. make the latest version of ruff happy

    Signed-off-by: Andreas Lauser <[email protected]>
    Signed-off-by: Katja Köhler <[email protected]>
    andlaus committed May 23, 2024
    Configuration menu
    Copy the full SHA
    eea043c View commit details
    Browse the repository at this point in the history
  7. scale linear compu methods: improve detection of invertibility

    this makes the code conform to section 7.3.6.6.4 of the spec. Note
    that DOPs using non-invertible SCALE-LINEAR compu methods currently
    cannot be encoded.
    
    Signed-off-by: Andreas Lauser <[email protected]>
    Signed-off-by: Katja Köhler <[email protected]>
    andlaus committed May 23, 2024
    Configuration menu
    Copy the full SHA
    7cf8993 View commit details
    Browse the repository at this point in the history