Skip to content

Modularization of the test functions

David Schäfer requested to merge modules into develop

This Merge Request is rather large, I therefore like to see two approvals. I won't assign anyone personally, because I guess, the review work is best split. I think it would be beneficial, if:

  • @palmb could review the general architecture, so basically the changes in saqc.core. The design is not particularly beautiful, maybe I missed something.
  • @luenensc could review the changes to saqc.funcs. I mainly added type hints there, but also made a few changes, when I or the type checker saw fit.

I feel rather uncomfortable with this MR, mainly because quite a few of the test functions are never hit by our test suite. Not only, but also because of the repetetive nature of the work involved, chances a high, that I screwed things up along the way. So please, be extra careful while reviewing this thing, it has the potential to accidentally remove functions from SaQC.

This Merge Request incorporates all changes made in !205 (closed), and therefor should be merged after !205 (closed)

Summary

The basic architecture is rather simplistic and is based on a lot of repetition. Not ideal, I know, but this was the only way, I could figure out, to get code completions in rather simplistic editing environments working. With the release of Python 3.10 (especially this feature and it's likely backport) in october, we should be able to remove the duplication of function signatures again.

Changes

  • There is a new core submodule named modules
  • Within saqc.core.modules, there is a new file for every file in saqc.funcs:
    • Each file defines exactly one class, which itself defines a method for every registered function from respective module in saqc.funcs
    • Most of the original signature is copy'n'pasted, but data and flagger are removed
  • All modules mentioned above inherit from a common ModuleBase class defined in saqc.core.modules.base, which mainly takes care of the redirection of function calls
  • The class FuncModules in saqc.core.modules.__init__ stitches all test function modules together. Its main purpose is to not clutter saqc.core.core.SaQC by too many repetitive attribute assignments
  • While I were at it, I added type hints to all registered functions in saqc.funcs. Seperating this into multiple MRs would have been the nicer approach, but I wanted to get modularization done, without further delays
Edited by Bert Palm

Merge request reports

Loading