filter_classes.py 1.2 KB

1234567891011121314151617181920212223242526272829
  1. '''
  2. This file is used for filter. Each filter contains different Options. And should be used for different format types.
  3. If you don't find a fitting filter then program it in this file to structure your coding.
  4. If there is a similar Filter which does not perfectly fit into your code, please extend this Filter instead of creating a new one
  5. Another Note: Try to keep up with this format: so with a lot of "coding Notes", the Class system and the variable_names
  6. If you have to use non-class filter please describe why and when to use this non-class filter
  7. '''
  8. from typing import Union
  9. import datetime
  10. import numpy as np
  11. class ManualTimeFilter:
  12. '''
  13. This filter, takes a Key(axe) which maps on Values on a Matrix
  14. takes an Matrix in which Values are filtered
  15. takes a timeconstraint
  16. Example: Key= Johann, Matrix= Arbeitszeitmatrix , timeconstraint= Monday
  17. Result: Filtered Version of this Matrix
  18. '''
  19. def __init__(self, key: str, matrix: Union[np.array, list], timeconstraint: Union[str, datetime]):
  20. self.key= key
  21. self.matrix = matrix
  22. self.timeconstraint = timeconstraint
  23. def __call__(self):
  24. return self.matrix