@staticmethod
    def parse_spec(opts, spec):
        """Parse the comma-separated key=value configuration from the gen spec.
           Names and semantics were inspired from subset of mcsoda parameters."""
        cfg = {'cur-ops': 0,
               'cur-gets': 0,
               'cur-sets': 0,
               'cur-items': 0,
               'exit-after-creates': 0,
               'max-items': 10000,
               'min-value-size': 10,
               'prefix': "",
               'ratio-sets': 0.05,
               'json': 0}
        for kv in spec[len("gen:"):].split(','):
            if kv:
                k = kv.split('=')[0].strip()
                v = kv.split('=')[1].strip()
                try:
                    if k in cfg:
                        cfg[k] = type(cfg[k])(v)
                    else:
                        return "error: unknown workload gen parameter: %s" % (k), None
                except __HOLE__:
                    return "error: could not parse value from: %s" % (kv), None
        return 0, cfg
dataset/ETHPy150Open membase/membase-cli/pump_gen.py/GenSource.parse_spec