77from __future__ import print_function
88
99import functools
10- import os , types , sys , argparse , time , datetime , traceback , subprocess , platform
10+ import os , types , sys , argparse , time , datetime , traceback , subprocess
1111import warnings
1212
1313import switch_model .__main__ as main
1414from pyomo .environ import *
15- from pyomo .core .base .set import UnknownSetDimen
1615from pyomo .dataportal import DataManagerFactory
1716from pyomo .dataportal .plugins .csv_table import CSVTable
1817
1918from switch_model .utilities .results_info import add_info , ResultsInfoSection
2019from switch_model .utilities .scaling import _ScaledVariable , _get_unscaled_expression
2120import pyomo .opt
22- import switch_model .utilities .custom_loading as pyo
21+ from switch_model .utilities .load_data import load_registered_inputs , load_data
2322
2423# Define string_types (same as six.string_types). This is useful for
2524# distinguishing between strings and other iterables.
@@ -277,7 +276,7 @@ def load_inputs(model, inputs_dir=None, attach_data_portal=False):
277276 timer = StepTimer ()
278277 data = DataPortal (model = model )
279278 data .load_aug = types .MethodType (load_aug , data )
280- pyo . load_registered_inputs (data , inputs_dir )
279+ load_registered_inputs (data , inputs_dir )
281280 for module in model .get_modules ():
282281 if hasattr (module , "load_inputs" ):
283282 module .load_inputs (model , data , inputs_dir )
@@ -596,6 +595,7 @@ def check_mandatory_components(model, *mandatory_model_components):
596595 return True
597596
598597
598+ < << << << HEAD
599599class InputError (Exception ):
600600 """Exception raised for errors in the input.
601601
@@ -614,11 +614,16 @@ def __str__(self):
614614def load_aug (
615615 switch_data , optional = False , auto_select = False , optional_params = [], ** kwds
616616):
617+ == == == =
618+ def load_aug (switch_data , optional = False , auto_select = False ,
619+ optional_params = [], ** kwds ):
620+ > >> >> >> 941 c8e2e (Further improvements )
617621 """
618622 This is a wrapper for the DataPortal object that accepts additional
619623 keywords. This currently supports a flag for the file being optional.
620624 The name load_aug() is not great and may be changed.
621625 """
626+ < << << << HEAD
622627 # TODO:
623628 # Allow user to specify filename when defining parameters and sets.
624629 # Also allow user to specify the name(s) of the column(s) in each set.
@@ -760,6 +765,9 @@ def get_column_name(p):
760765 # All done with cleaning optional bits. Pass the updated arguments
761766 # into the DataPortal.load() function.
762767 switch_data .load (** kwds )
768+ == == == =
769+ load_data (switch_data , optional , auto_select , optional_params , ** kwds )
770+ >> >> >> > 941 c8e2e (Further improvements )
763771
764772
765773# Register a custom data manager that wraps the default CSVTable DataManager
0 commit comments