features.py 995 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Features modeled after my Rust lib https://crates.io/crates/human-repr
  2. class Features:
  3. def __init__(self):
  4. self._feature_space = False
  5. self._feature_1024 = False
  6. self._feature_iec = False
  7. @property
  8. def feature_space(self) -> bool:
  9. return self._feature_space
  10. @property
  11. def feature_1024(self) -> bool:
  12. return self._feature_1024
  13. @property
  14. def feature_iec(self) -> bool:
  15. return self._feature_iec
  16. @feature_space.setter
  17. def feature_space(self, value: bool): # pragma: no cover
  18. self._feature_space = bool(value)
  19. @feature_1024.setter
  20. def feature_1024(self, value: bool): # pragma: no cover
  21. self._feature_1024 = bool(value)
  22. @feature_iec.setter
  23. def feature_iec(self, value: bool): # pragma: no cover
  24. self._feature_iec = bool(value)
  25. self.feature_1024 = value
  26. def conv_space(space: bool) -> str:
  27. return {False: '', True: ' '}[space]
  28. FEATURES = Features()