-
Notifications
You must be signed in to change notification settings - Fork 241
/
base_constraint.py
37 lines (24 loc) · 1.11 KB
/
base_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
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from . import ConstraintTypes # noqa
class BaseConstraint(object):
def allows(self, other): # type: ("ConstraintTypes") -> bool
raise NotImplementedError
def allows_all(self, other): # type: ("ConstraintTypes") -> bool
raise NotImplementedError()
def allows_any(self, other): # type: ("ConstraintTypes") -> bool
raise NotImplementedError()
def difference(self, other): # type: ("ConstraintTypes") -> "ConstraintTypes"
raise NotImplementedError()
def intersect(self, other): # type: ("ConstraintTypes") -> "ConstraintTypes"
raise NotImplementedError()
def union(self, other): # type: ("ConstraintTypes") -> "ConstraintTypes"
raise NotImplementedError()
def is_any(self): # type: () -> bool
return False
def is_empty(self): # type: () -> bool
return False
def __repr__(self): # type: () -> str
return "<{} {}>".format(self.__class__.__name__, str(self))
def __eq__(self, other): # type: ("ConstraintTypes") -> bool
raise NotImplementedError()