aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/state.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/proxy/state.py')
-rw-r--r--src/hydrilla/proxy/state.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/hydrilla/proxy/state.py b/src/hydrilla/proxy/state.py
index 69436c5..1246c92 100644
--- a/src/hydrilla/proxy/state.py
+++ b/src/hydrilla/proxy/state.py
@@ -52,15 +52,37 @@ from .simple_dependency_satisfying import ImpossibleSituation
class EnabledStatus(Enum):
"""
- ENABLED - User wished to always apply given mapping when it matched.
+ ENABLED - User wished to always apply given mapping when it matches site's
+ URL.
DISABLED - User wished to never apply given mapping.
- NO_MARK - User has not configured given mapping and it won't be used.
+ NO_MARK - User has not configured given mapping.
"""
- ENABLED = 'E'
- DISABLED = 'D'
- NO_MARK = 'N'
+ ENABLED = 'E'
+ DISABLED = 'D'
+ NO_MARK = 'N'
+
+
+class FrozenStatus(Enum):
+ """
+ EXACT_VERSION - User wished to always use the same version of a mapping.
+
+ REPOSITORY - User wished to always use a version of the mapping from the
+ same repository.
+
+ NOT_FROZEN - User did not restrict updates of the mapping.
+ """
+ EXACT_VERSION = 'E'
+ REPOSITORY = 'R'
+ NOT_FROZEN = 'N'
+
+ @staticmethod
+ def make(letter: t.Optional[str]) -> t.Optional[FrozenStatus]:
+ if letter is None:
+ return None
+
+ return FrozenStatus(letter)
class InstalledStatus(Enum):
@@ -201,6 +223,7 @@ class MappingDisplayInfo(item_infos.CorrespondsToMappingDCMixin):
ref: 'MappingRef'
identifier: str
enabled: EnabledStatus
+ frozen: t.Optional[FrozenStatus]
active_version: t.Optional['MappingVersionDisplayInfo']
@dc.dataclass(frozen=True)
@@ -212,6 +235,7 @@ class MappingVersionDisplayInfo(item_infos.CorrespondsToMappingDCMixin):
is_orphan: bool
is_local: bool
mapping_enabled: EnabledStatus
+ mapping_frozen: t.Optional[FrozenStatus]
@dc.dataclass(frozen=True, unsafe_hash=True) # type: ignore[misc]
class MappingRef(Ref, item_infos.CorrespondsToMappingDCMixin):