Coverage for britney2/excusedeps.py: 100%
27 statements
« prev ^ index » next coverage.py v6.5.0, created at 2024-04-18 20:48 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2024-04-18 20:48 +0000
1from typing import Optional
3from britney2.policies import PolicyVerdict
6class DependencySpec(object):
8 def __init__(self, deptype, architecture: Optional[str] = None):
9 self.deptype = deptype
10 self.architecture = architecture
11 assert self.architecture != 'all', "all not allowed for DependencySpec"
14class DependencyState(object):
16 def __init__(self, dep):
17 """State of a dependency
19 :param dep: the excuse that we are depending on
21 """
22 self.valid = True
23 self.verdict = PolicyVerdict.PASS
24 self.dep = dep
26 @property
27 def possible(self) -> bool:
28 return True
30 def invalidate(self, verdict: PolicyVerdict) -> None:
31 self.valid = False
32 self.verdict = PolicyVerdict.worst_of(verdict)
35class ImpossibleDependencyState(DependencyState):
36 """Object tracking an impossible dependency"""
38 def __init__(self, verdict, desc):
39 """
41 :param desc: description of the impossible dependency
43 """
44 self.valid = False
45 self.verdict = verdict
46 self.desc = desc
47 self.dep = None
49 @property
50 def possible(self):
51 return False