types.py: Derive enumerations from standard library classes
`types.py` defines a few enumerations, but only some of them are
derived from the standard `enum.Enum` class.
Among other things, this makes type checking difficult as the inferred
type of the values is `<class 'int'>` or `<class 'str'>`, and not
something like `<enum 'Scope'>`.
Note that `Consistency` is derived from `IntEnum` and not `Enum`, since
it is sometimes used in comparisons.
diff --git a/src/buildstream/types.py b/src/buildstream/types.py
index 6f6262e..d186c4f 100644
--- a/src/buildstream/types.py
+++ b/src/buildstream/types.py
@@ -25,7 +25,7 @@
"""
-from enum import Enum
+from enum import Enum, IntEnum
class Scope(Enum):
@@ -56,7 +56,7 @@
"""
-class Consistency():
+class Consistency(IntEnum):
"""Defines the various consistency states of a :class:`.Source`.
"""
@@ -81,7 +81,7 @@
"""
-class CoreWarnings():
+class CoreWarnings(Enum):
"""CoreWarnings()
Some common warnings which are raised by core functionalities within BuildStream are found in this class.