def __init__(self): self.age = 0 self.T = 300 self.Args = Args() self.graph_snode = collections.OrderedDict() self.graph_node = collections.OrderedDict() self.graph_edge = collections.OrderedDict() self.material = collections.OrderedDict() self.n = None # node num self.e = None # edge num self.s = None # space num self.v = None # voltage num self.m = None # material num self.s_matrix = None # space-node matrix self.m_matrix = None # material-node matrix self.x = None # density of node self.x_s = None # space size of node self.e_x = None # e^x self.k1 = None # k1 self.k2 = None # k2 self.k3 = None # k3 self.k4 = None # k4 self.k5 = None # k5 self.init_materials = None
def __init__(self, graph): self.Utill = Utill() self.Args = Args() self.Calculater = Calculater(self.Utill) self.graph = graph self.socketIO = SocketIO('localhost',3030)
def testInvalidDouble(self): try: Args("x##", ["-x", "Forty two"]) self.fail("Args constructor should have thrown exception") except ArgsException as e: self.assertEqual(ArgsException.ErrorCode.INVALID_DOUBLE, e.getErrorCode())
def __init__(self, vector=None, time=0): self.Args = Args() self.dim = self.Args.dim if vector is not None: self.psi = vector else: vector = np.zeros(self.dim) self.time = 0 self.history = list()
def __init__(self): self.Args = Args() self.cash_regist_list = self.Args.cash_regist_list self.cash = self.cash_regist() self.db_root_path = self.db_root_path_load() self.db_name_filter_key = self.Args.db_name_filter_key self.RDF_function = dict()
def testNonLetterSchema(self): try: Args("*", []) self.fail("Args constructor should have thrown exception") except ArgsException as e: self.assertEqual(ArgsException.ErrorCode.INVALID_ARGUMENT_NAME, e.getErrorCode()) self.assertEqual("*", e.getErrorArgumentId())
def testInvalidArgumentFormat(self): try: Args("f~", []) self.fail("Args constructor should have thrown exception") except ArgsException as e: self.assertEqual(ArgsException.ErrorCode.INVALID_FORMAT, e.getErrorCode()) self.assertEqual("f", e.getErrorArgumentId())
def testMissingDouble(self): try: Args("x##", ["-x"]) self.fail("Args constructor should have thrown exception") except ArgsException as e: self.assertEqual(ArgsException.ErrorCode.MISSING_DOUBLE, e.getErrorCode()) self.assertEqual("x", e.getErrorArgumentId())
def testMissingStringArgument(self): try: args = Args("x*", ["-x"]) self.fail("Args constructor should have thrown exception") except ArgsException as e: self.assertEqual(ArgsException.ErrorCode.MISSING_STRING, e.getErrorCode()) self.assertEqual("x", e.getErrorArgumentId())
def testWithNoSchemaButWithOneArgument(self): try: Args("", ["-x"]) self.fail( "Expect ArgsException in testWithNoSchemaButWithOneArgument") except ArgsException as e: self.assertEqual(ArgsException.ErrorCode.UNEXPECTED_ARGUMENT, e.getErrorCode()) self.assertEqual("x", e.getErrorArgumentId())
def testInvalidInteger(self): try: Args("x#", ["-x", "Forty two"]) self.fail("Args constructor should have thrown exception") except ArgsException as e: self.assertEqual(ArgsException.ErrorCode.INVALID_INTEGER, e.getErrorCode()) self.assertEqual("x", e.getErrorArgumentId()) self.assertEqual("Forty two", e.getErrorParameter())
def __init__( self, T_op=None, time=0) : self.Args = Args() self.dim = self.Args.dim if T_op is not None : self.T_op = T_op else : self.T_op = numpy.zeros((self.dim, self,dim))
def __init__(self, neuron_network_filename): self.Utill = Utill() self.Args = Args() self.graph = HierarchicalGraph() # make hierarchy graph self.neuron_network = NeuronNetwork(self.graph) self.neuron_group = NeuronGroup(self.graph) self.neuron_model = NeuronModel(self.graph) self.neuron_element = NeuronElement(self.graph) self.build(neuron_network_filename) #build hierarchial neuron layer
def __init__(self): self.Args = Args() self.Utill = Utill() self.depth = 0 self.hierarchy = dict( ) # {Neural Network:0, Neuron Group:1, Neuron:2, ,...} self.hierarchical_graph = dict( ) # {Neural Network:Graph(), Neuron Group:Graph(), Neuron:Graph(), ,...} self.hierarchical_group_dict = dict() # {{label: "~", "from":, "to"}} self.hierarchical_up_group_dict = dict() # {"neuronA":neoronGroupB..} self.hierarchical_down_group_dict = dict( ) # {"neuronA":{proteinA, proteinB,...}} self.hierarchical_down_group_input_dict = dict( ) # {"neuronA":{proteinA, proteinB,...}} self.hierarchical_down_group_output_dict = dict( ) # {"neuronA":{proteinA, proteinB,...}} self.node_label_dict = dict( ) # {"neuronA":{'label':"neuronA", ...}...} #index for synaps add self.neuron_model_local_from_dict = dict( ) # index for select candidate in neuron self.neuron_model_synaps_dict = dict( ) # index for add synaps in neuron - local element self.neuron_model_local_input_dict = dict( ) # index for add synaps in neuron - local input element self.neuron_element_local_input_dict = dict( ) # index for add synaps - add output_pointer self.hierarchical_down_group_indexer = dict() #indexer #job list self.job_list = list() # job list self.local_input_job_list = list() # input neuron element node self.global_input_job_list = list() # input neuron element node self.age = 0 self.pointer = 0 self.debug = True self.debug_dict = dict() self.debug_show = dict() self.debug_show_time = 30
import sys import os cur_dir = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(cur_dir, "ImageEditor")) sys.path.append(os.path.join(cur_dir, "Input")) from BatchImageEditor import BatchImageEditor from Args import Args from BatchJob import BatchJob from Help import Help if len(sys.argv) < 2: Help.print_help() args = Args(sys.argv[1:]) options = args.get_options() job = BatchJob(options) editor = BatchImageEditor() editor.process_images(job)
def testSimpeIntPresent(self): args = Args("x#", ["-x", 42]) self.assertEqual(1, args.cardinality()) self.assertTrue(args.has('x')) self.assertEqual(42, args.getInt('x'))
def testSpacesInFormat(self): args = Args("x, y", ["-xy"]) self.assertEqual(2, args.cardinality()) self.assertTrue(args.has("x")) self.assertTrue(args.has("y"))
def testSimpleStringPresent(self): args = Args("x*", ["-x", "param"]) self.assertEqual(1, args.cardinality()) self.assertTrue(args.has('x')) self.assertEqual("param", args.getString("x"))
def testSimpleBooleanPresent(self): args = Args("x", ["-x"]) self.assertEqual(1, args.cardinality()) self.assertEqual(True, args.getBoolean("x"))
def testCreateWithNoSchemaOrArguments(self): args = Args("", "") self.assertEqual(args.cardinality(), 0)
def __init__(self, graph): self.Utill = Utill() self.Args = Args() self.graph = graph
def __init__(self): self.opt = Args().options
def __init__(self, graph, neuron_network_node): self.Utill = Utill() self.Args = Args()
for key, values in dict.items(): if not values: err_msg(key) i = 1 return i tplhst_msg = 'Error , the template host name should not be None ! ' hst_msg = 'Error , the host name should not be None ! ' adr_msg = 'Error , the address should not be None ! ' inc_msg = 'Error , the inc or exc groups should noe be None ! ' tplsrc_msg = 'Error , the template service name should not be None ! ' src_msg = 'Error , the service name should noe be None ! ' msg_list = [tplhst_msg, hst_msg, adr_msg, inc_msg, tplsrc_msg, src_msg] opt = Args().options i = 0 if opt.createhost: msg("Template Host : %s" % (opt.tplhostname)) msg(" New Host : %s" % (opt.hostname)) msg(" Host Address : %s" % (opt.address)) dict = { msg_list[0]: opt.tplhostname, msg_list[1]: opt.hostname, msg_list[2]: opt.address } i = check_args(dict, i) if i == 1: sys.exit()
def __init__(self): Args.__init__(self) self.repo_path = "/home/xiey/Git/faurecia-nagios-configuration"
def __init__(self): self.args = Args() self.exception = NewException(self.args) self.fileNames = FileNames(self.args) self.names = Names()
import sys from Args import Args elementId = sys.argv[1] arguments = sys.argv[2:] args = Args(elementId, arguments)
def __init__(self): self.Generation = np.array([]) self.Generation_cnt = 1 self.Args = Args()
def testSimpleDoublePresent(self): args = Args("x##", ["-x", "42.3"]) self.assertEqual(1, args.cardinality()) self.assertTrue(args.has('x')) self.assertEqual(42.3, args.getDouble("x"))
def __init__(self, Utill): self.Args = Args() self.Utill = Utill
def test_normal(self): a = Args("l:bool,p:int,d:str", "-l true -d usr/log -p 8080") self.assertEqual(a.get_value("l"), True) self.assertEqual(a.get_value("d"), "usr/log") self.assertEqual(a.get_value("p"), 8080)