Beispiel #1
0
def sourceset_from_table(t):
	N = len(t)
	ss = SourceSet()
	for i in range(N):
		s = Source()
		ss.push_back(s)
	for f in sourceset_fields:
		vals = t.getcolumn(f.lower())
		for s,v in zip(ss,vals):
			fname = "set" + f
			func = getattr(s, fname)
			if func is None:
				raise Exception('Function not found in Source object: ' + fname + ', object %s' % str(s))
			func(v)
	return ss
Beispiel #2
0
def sourceset_from_dict(d):
    x = d[sourceset_fields[0]]
    N = len(x)
    ss = SourceSet()
    for i in range(N):
        s = Source()
        ss.push_back(s)

    for f in sourceset_fields:
        vals = d[f]
        for s, v in zip(ss, vals):
            func = getattr(s, "set" + f)
            func(v)

    return ss
Beispiel #3
0
def sourceset_from_dict(d):
	x = d[sourceset_fields[0]]
	N = len(x)
	ss = SourceSet()
	for i in range(N):
		s = Source()
		ss.push_back(s)

	for f in sourceset_fields:
		vals = d[f]
		for s,v in zip(ss,vals):
			func = getattr(s, "set" + f)
			func(v)

	return ss
Beispiel #4
0
def sourceset_from_table(t):
    N = len(t)
    ss = SourceSet()
    for i in range(N):
        s = Source()
        ss.push_back(s)
    for f in sourceset_fields:
        vals = t.getcolumn(f.lower())
        for s, v in zip(ss, vals):
            fname = "set" + f
            func = getattr(s, fname)
            if func is None:
                raise Exception('Function not found in Source object: ' +
                                fname + ', object %s' % str(s))
            func(v)
    return ss