Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the _suppress_ctypes attribute from Block #3347

Merged
merged 1 commit into from
Aug 14, 2024
Merged
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
2 changes: 0 additions & 2 deletions pyomo/contrib/cp/interval_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ def _getitem_when_not_present(self, index):

class ScalarIntervalVar(IntervalVarData, IntervalVar):
def __init__(self, *args, **kwds):
self._suppress_ctypes = set()

IntervalVarData.__init__(self, self)
IntervalVar.__init__(self, *args, **kwds)
self._data[None] = self
Expand Down
2 changes: 0 additions & 2 deletions pyomo/contrib/piecewise/piecewise_linear_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,6 @@ class ScalarPiecewiseLinearFunction(
PiecewiseLinearFunctionData, PiecewiseLinearFunction
):
def __init__(self, *args, **kwds):
self._suppress_ctypes = set()

PiecewiseLinearFunctionData.__init__(self, self)
PiecewiseLinearFunction.__init__(self, *args, **kwds)
self._data[None] = self
Expand Down
12 changes: 0 additions & 12 deletions pyomo/core/base/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,13 +960,8 @@ def add_component(self, name, val):
% (name, type(val), self.name, type(getattr(self, name)))
)
#
# Skip the add_component() logic if this is a
# component type that is suppressed.
#
_component = self.parent_component()
_type = val.ctype
if _type in _component._suppress_ctypes:
return
#
# Raise an exception if the component already has a parent.
#
Expand Down Expand Up @@ -1048,12 +1043,6 @@ def add_component(self, name, val):
else:
self._ctypes[_type] = [_new_idx, _new_idx, 1]
#
# Propagate properties to sub-blocks:
# suppressed ctypes
#
if _type is Block:
val._suppress_ctypes |= _component._suppress_ctypes
#
# Error, for disabled support implicit rule names
#
if '_rule' in val.__dict__ and val._rule is None:
Expand Down Expand Up @@ -2029,7 +2018,6 @@ def __init__(

def __init__(self, *args, **kwargs):
"""Constructor"""
self._suppress_ctypes = set()
_rule = kwargs.pop('rule', None)
_options = kwargs.pop('options', None)
# As concrete applies to the Block at declaration time, we will
Expand Down
6 changes: 0 additions & 6 deletions pyomo/gdp/disjunct.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,6 @@ def _activate_without_unfixing_indicator(self):

class ScalarDisjunct(DisjunctData, Disjunct):
def __init__(self, *args, **kwds):
## FIXME: This is a HACK to get around a chicken-and-egg issue
## where BlockData creates the indicator_var *before*
## Block.__init__ declares the _defer_construction flag.
self._defer_construction = True
self._suppress_ctypes = set()

DisjunctData.__init__(self, self)
Disjunct.__init__(self, *args, **kwds)
self._data[None] = self
Expand Down
Loading