Skip to content

Instantly share code, notes, and snippets.

@qsorix
Created July 3, 2010 11:53
Show Gist options
  • Save qsorix/462523 to your computer and use it in GitHub Desktop.
Save qsorix/462523 to your computer and use it in GitHub Desktop.
def read(self, model, network, mapping, schedule):
# local variables for each configuration file
ctx_model = {}
ctx_network = {}
ctx_mapping = {}
ctx_schedule = {}
# resources can be defined in any configuration part
glob_resources = Resources.public_functions
def setup_glob(module):
x = module.public_functions.copy()
x.update(glob_resources)
return x
(glob_model, glob_network, glob_mapping, glob_schedule) = map(setup_glob, [Model, Network, Mapping, Schedule])
execfile(model, glob_model, ctx_model)
execfile(network, glob_network, ctx_network)
# populate mapping and schedule with variables defined in model/network parts
ctx_mapping.update(ctx_model)
ctx_mapping.update(ctx_network)
ctx_schedule.update(ctx_model)
execfile(mapping, glob_mapping, ctx_mapping)
execfile(schedule, glob_schedule, ctx_schedule)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment