-
Notifications
You must be signed in to change notification settings - Fork 241
/
empty_constraint.py
39 lines (24 loc) · 976 Bytes
/
empty_constraint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from typing import TYPE_CHECKING
from .base_constraint import BaseConstraint
if TYPE_CHECKING:
from . import ConstraintTypes # noqa
class EmptyConstraint(BaseConstraint):
pretty_string = None
def matches(self, _): # type: ("ConstraintTypes") -> bool
return True
def is_empty(self): # type: () -> bool
return True
def allows(self, other): # type: ("ConstraintTypes") -> bool
return False
def allows_all(self, other): # type: ("ConstraintTypes") -> bool
return True
def allows_any(self, other): # type: ("ConstraintTypes") -> bool
return True
def intersect(self, other): # type: ("ConstraintTypes") -> "ConstraintTypes"
return other
def difference(self, other): # type: ("ConstraintTypes") -> None
return
def __eq__(self, other): # type: ("ConstraintTypes") -> bool
return other.is_empty()
def __str__(self): # type: () -> str
return ""