scope.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright 2023 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. from ..common._repr_enum import _ReprEnum
  12. class _OrderedEnum(_ReprEnum):
  13. def __ge__(self, other):
  14. if self.__class__ is other.__class__:
  15. return self.value >= other.value
  16. return NotImplemented
  17. def __gt__(self, other):
  18. if self.__class__ is other.__class__:
  19. return self.value > other.value
  20. return NotImplemented
  21. def __le__(self, other):
  22. if self.__class__ is other.__class__:
  23. return self.value <= other.value
  24. return NotImplemented
  25. def __lt__(self, other):
  26. if self.__class__ is other.__class__:
  27. return self.value < other.value
  28. return NotImplemented
  29. class Scope(_OrderedEnum):
  30. """Scope of a `DataNode^`.
  31. This enumeration can have the following values:
  32. - `GLOBAL`
  33. - `CYCLE`
  34. - `SCENARIO`
  35. """
  36. GLOBAL = 3
  37. CYCLE = 2
  38. SCENARIO = 1