Skip to content

Commit b10b4ec

Browse files
committed
Move patching to patch file
1 parent e8f5ce7 commit b10b4ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

switch_model/utilities/patches.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import pyomo.version
66
from pyomo.core.base.misc import _robust_sort_keyfcn
77

8+
from switch_model.utilities.load_data import patch_to_allow_loading
9+
from pyomo.environ import Set, Param
10+
811

912
def fixed_robust_sort_keyfcn(self, val, use_key=True):
1013
"""Generate a tuple ( str(type_name), val ) for sorting the value.
@@ -57,6 +60,10 @@ def patch_pyomo():
5760

5861
setattr(_robust_sort_keyfcn, "__call__", fixed_robust_sort_keyfcn)
5962

63+
# Patch Set and Param to allow specifying input file location (via input_file="...")
64+
patch_to_allow_loading(Set)
65+
patch_to_allow_loading(Param)
66+
6067

6168
def replace_method(class_ref, method_name, new_source_code):
6269
"""

0 commit comments

Comments
 (0)