Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions cpmpy/expressions/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class Expression(object):
- any ``__op__`` python operator overloading
"""

def __init__(self, name: str, arg_list: tuple[Any, ...]):
def __init__(self, name: str, arg_list: tuple[Any, ...], has_subexpr: Optional[bool] = None):
"""
Constructor of the Expression class

Expand All @@ -138,10 +138,6 @@ def __init__(self, name: str, arg_list: tuple[Any, ...]):
def args(self) -> tuple[Any, ...]:
return self._args

@args.setter
def args(self, args: Iterable[Any]) -> None:
raise AttributeError("Cannot modify read-only attribute 'args', use 'update_args()'")

def update_args(self, args: Iterable[Any]) -> None:
""" Allows in-place update of the expression's arguments.
Resets all cached computations which depend on the expression tree.
Expand Down Expand Up @@ -226,10 +222,10 @@ def is_bool(self):
"""
return True

def value(self):
return None # default
def value(self) -> Optional[int]:
return None # default

def get_bounds(self):
def get_bounds(self) -> tuple[int, int]:
if self.is_bool():
return 0, 1 #default for boolean expressions
raise NotImplementedError(f"`get_bounds` is not implemented for type {self}")
Expand Down
Loading
Loading