def __init__(self, name, create_tar_files, opts, macros=None): self.opts = opts if macros is None: self.macros = opts.defaults else: self.macros = macros self.create_tar_files = create_tar_files log.notice('config: ' + name) self.config = config.file(name, opts, self.macros) self.script = script() self.macros['buildname'] = self._name_(self.macros['name'])
def __init__(self, name, create_tar_files, opts, macros=None): self.opts = opts if macros is None: self.macros = opts.defaults else: self.macros = macros self.create_tar_files = create_tar_files log.notice("config: " + name) self.config = config.file(name, opts, self.macros) self.script = script() self.macros["buildname"] = self._name_(self.macros["name"])
def __init__(self, name, create_tar_files, opts, macros = None): try: self.opts = opts if macros is None: self.macros = opts.defaults else: self.macros = macros self.create_tar_files = create_tar_files log.notice('config: ' + name) self.config = config.file(name, opts, self.macros) self.script = script() self.macros['buildname'] = self._name_(self.macros['name']) except error.general, gerr: log.notice(str(gerr)) log.stderr('Build FAILED') raise
def __init__(self, name, create_tar_files, opts, macros=None): try: self.opts = opts self.init_name = name self.init_macros = macros self.config = None self.create_tar_files = create_tar_files log.notice('config: ' + name) self.set_macros(macros) self.config = config.file(name, opts, self.macros) self.script = script() self.macros['buildname'] = self._name_(self.macros['name']) except error.general, gerr: log.notice(str(gerr)) log.stderr('Build FAILED') raise
def generate(self, name, opts=None, macros=None): self.bset_nesting += 1 self.buildset_start(name) if opts is None: opts = self.opts if macros is None: macros = self.macros bset = setbuilder.buildset(name, self.configs, opts, macros) for c in bset.load(): if c.endswith(".bset"): self.buildset(c, bset.opts, bset.macros) elif c.endswith(".cfg"): self.config(config.file(c, bset.opts, bset.macros), bset.opts, bset.macros) else: raise error.general("invalid config type: %s" % (c)) self.buildset_end(name) self.bset_nesting -= 1
def __init__(self, index, total, report, executable, rtems_tools, bsp, bsp_config, opts): self.index = index self.total = total self.report = report self.bsp = bsp self.bsp_config = bsp_config self.opts = copy.copy(opts) self.opts.defaults['test_index'] = str(index) self.opts.defaults['test_total'] = str(total) self.opts.defaults['bsp'] = bsp self.opts.defaults['bsp_arch'] = '%{arch}' if not path.isfile(executable): raise error.general('cannot find executable: %s' % (executable)) self.opts.defaults['test_executable'] = executable if rtems_tools: rtems_tools_bin = path.join(self.opts.defaults.expand(rtems_tools), 'bin') if not path.isdir(rtems_tools_bin): raise error.general('cannot find RTEMS tools path: %s' % (rtems_tools_bin)) self.opts.defaults['rtems_tools'] = rtems_tools_bin self.config = config.file(index, total, self.report, self.bsp_config, self.opts)
def __init__(self, index, total, report, executable, rtems_tools, bsp, bsp_config, opts): self.index = index self.total = total self.report = report self.bsp = bsp self.bsp_config = bsp_config self.opts = copy.copy(opts) self.opts.defaults['test_index'] = str(index) self.opts.defaults['test_total'] = str(total) self.opts.defaults['bsp'] = bsp self.opts.defaults['bsp_arch'] = '%%{%s_arch}' % (bsp) self.opts.defaults['bsp_opts'] = '%%{%s_opts}' % (bsp) if not path.isfile(executable): raise error.general('cannot find executable: %s' % (executable)) self.opts.defaults['test_executable'] = executable if rtems_tools: rtems_tools_bin = path.join(self.opts.defaults.expand(rtems_tools), 'bin') if not path.isdir(rtems_tools_bin): raise error.general('cannot find RTEMS tools path: %s' % (rtems_tools_bin)) self.opts.defaults['rtems_tools'] = rtems_tools_bin self.config = config.file(self.report, self.bsp_config, self.opts)
def __init__(self, name, create_tar_files, opts, macros = None): try: self.opts = opts self.init_name = name self.init_macros = macros self.config = None self.create_tar_files = create_tar_files log.notice('config: ' + name) self.set_macros(macros) self.config = config.file(name, opts, self.macros) self.script = script() self.macros['buildname'] = self._name_(self.macros['name']) except error.general as gerr: log.notice(str(gerr)) log.stderr('Build FAILED') raise except error.internal as ierr: log.notice(str(ierr)) log.stderr('Internal Build FAILED') raise except: raise
def generate(self, name, tree = None, opts = None, defaults = None): self.bset_nesting += 1 self.buildset_start(name) if tree is None: tree = self.tree if opts is None: opts = self.opts bset = setbuilder.buildset(name, self.configs, opts, defaults) if name in tree: raise error.general('duplicate build set in tree: %s' % (name)) tree[name] = { 'bset': { }, 'cfg': { 'file': [] } } for c in bset.load(): macros = copy.copy(bset.macros) if c.endswith('.bset'): self.generate(c, tree[name]['bset'], bset.opts, macros) elif c.endswith('.cfg'): self.config(config.file(c, bset.opts, macros), tree[name]['cfg'], bset.opts, macros) else: raise error.general('invalid config type: %s' % (c)) self.buildset_end(name) self.bset_nesting -= 1
def generate(self, name, tree=None, opts=None, macros=None): self.bset_nesting += 1 self.buildset_start(name) if tree is None: tree = self.tree if opts is None: opts = self.opts if macros is None: macros = self.macros bset = setbuilder.buildset(name, self.configs, opts, macros) if name in tree: raise error.general('duplicate build set in tree: %s' % (name)) tree[name] = {'bset': {}, 'cfg': {'file': []}} for c in bset.load(): macros = copy.copy(bset.macros) if c.endswith('.bset'): self.generate(c, tree[name]['bset'], bset.opts, macros) elif c.endswith('.cfg'): self.config(config.file(c, bset.opts, macros), tree[name]['cfg'], bset.opts, macros) else: raise error.general('invalid config type: %s' % (c)) self.buildset_end(name) self.bset_nesting -= 1
def __init__(self, args): self.config_file = config.file(args.config_file) self.config_file.read() self.zmq_ctx = zmq.Context()
import tensorflow as tf import numpy as np import process_batch import config from config import Config config = Config(config.file('./config.cfg')) TRAIN_DATA_PATH = config.getByPath('train_data_path') TEST_DATA_PATH = config.getByPath('test_data_path') VALID_DATA_PATH = config.getByPath('valid_data_path') HIDDEN_SIZE = config.getByPath('hidden_size') NUM_LAYERS = config.getByPath('num_layers') VOCAB_SIZE = config.getByPath('vocab_size') TRAIN_BATCH_SIZE = config.getByPath('train_batch_size') TRAIN_NUM_STEPS = config.getByPath('train_num_steps') VALID_BATCH_SIZE = config.getByPath('valid_batch_size') VALID_NUM_STEPS = config.getByPath('valid_num_steps') NUM_EPOCHS = config.getByPath('num_epochs') LSTM_KEEP_OUTPUT_PROB = config.getByPath('lstm_keep_output_prob') EMBEDDING_KEEP_PROB = config.getByPath('embedding_keep_prob') MAX_GRAD_NORM = config.getByPath('max_gradient_norm') SHARE_EMB_AND_SOFTMAX = config.getByPath('share_emb_and_softmax') class PTBModel: def __init__(self, batch_size, num_steps): self.x = tf.placeholder(tf.int32, [batch_size, num_steps]) self.y = tf.placeholder(tf.int32, [batch_size, num_steps])
# setup.py - sets up for raven to run # Author: Larry Hill import sys import config PARAMS = { 'PORT': 42429 } if __name__ == "__main__": if len(sys.argv) > 1: print "writing config file %s..." % sys.argv[0] cfg_file = config.file(sys.argv[1]) cfg_file.add_params(PARAMS) cfg_file.write() print "done"