Beispiel #1
0
 def get_using(self, u):
     for v in u.vars:
         self.using_vars.add(v) 
     var_tags = [E.var(name=v) for v in u.vars]
     base_filename = os.path.splitext(u.filename)[0]
     file_id = "%s_file" % base_filename
     self.add_csv(file_id, u.filename)
     return E.setdynvars(*var_tags, sourcetype="file", \
         fileid=file_id, delimiter=";", order="random")
Beispiel #2
0
    def get_var(self, v):
        attrs = {}
        if v.data_type == "string":
            attrs["sourcetype"] = "random_string"
            attrs["length"] = v.length            
        else:
            if v.ordering == "random":
                attrs["sourcetype"] = "random_number"
                attrs["start"] = v.min
                attrs["end"] = v.max
            else:
                filename = "_%s.csv" % v.name
                file_id = "%s_file" % v.name
                attrs["sourcetype"] = "file"
                attrs["order"] = "iter"
                attrs["fileid"] = file_id
                attrs["delimiter"] = ";"
                self.create_range_file( \
                    filename, int(v.min), int(v.max))
                self.add_csv(file_id, filename)

        return E.setdynvars(E.var(name=v.name), **attrs)