dump as a comma separated value file
9541
def DumpAsCSV (self, separator=",", file=sys.stdout):
                """"""
                for row in range(1, self.maxRow + 1):
                        sep = ""
                        for column in range(1, self.maxColumn + 1):
                                file.write("%s\"%s\"" % (sep, self.GetCellValue(column, row, "")))
                                sep = separator
                        file.write("\n")
1065812
def dump_ast(ast, indent=' ', newline='\n'):
    '''
    
    
    
    '''
    
    visitor = ASTPrinter(indent=indent, level=0, newline=newline)
    visitor.visit(ast)
    return visitor.dumps()
1059054
def dump(obj, fp=None, indent=None, sort_keys=False, **kw):
    

    if fp:
        iterable = YAMLEncoder(indent=indent, sort_keys=sort_keys, **kw).iterencode(obj)
        for chunk in iterable:
            fp.write(chunk)
    else:
        return dumps(obj, indent=indent, sort_keys=sort_keys, **kw)
1321251
def dump(self, blob, stream):
        

        json.dump(
            blob, stream, indent=self.indent, sort_keys=True,
            separators=self.separators,
        )
914491
static function dump ($value, $indent = 0)
  {
    return ltrim (str_indent (preg_replace ('/^array \((.*)\)/ms', '[$1]', var_export ($value, true)), $indent));
  }
122892
def dump(args):
    
    p = OptionParser(dump.__doc__)
    p.add_option("--dir",
                help="Working directory [default: %default]")
    p.add_option("--nosim", default=False, action="store_true",
                 help="Do not simulate qual to 50 [default: %default]")
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    fastbfile, = args
    d = opts.dir
    if d:
        from jcvi.assembly.preprocess import export_fastq

        rc = "jump" in fastbfile
        export_fastq(d, fastbfile, rc=rc)
        return

    sim = not opts.nosim
    pf = "j" if "jump" in fastbfile else "f"

    statsfile = "{0}.lib_stats".format(pf)
    if op.exists(statsfile):
        os.remove(statsfile)

    cmd = "SplitReadsByLibrary READS_IN={0}".format(fastbfile)
    cmd += " READS_OUT={0} QUALS=True".format(pf)
    sh(cmd)

    libs = []
    fp = open(statsfile)
    next(fp); next(fp)  # skip two rows
    for row in fp:
        if row.strip() == "":
            continue

        libname = row.split()[0]
        if libname == "Unpaired":
            continue

        libs.append(libname)

    logging.debug("Found libraries: {0}".format(",".join(libs)))

    cmds = []
    for libname in libs:
        cmd = "FastbQualbToFastq"
        cmd += " HEAD_IN={0}.{1}.AB HEAD_OUT={1}".format(pf, libname)
        cmd += " PAIRED=True PHRED_OFFSET=33"
        if sim:
            cmd += " SIMULATE_QUALS=True"
        if pf == 'j':
            cmd += " FLIP=True"

        cmds.append((cmd, ))

    m = Jobs(target=sh, args=cmds)
    m.run()

    for libname in libs:
        cmd = "mv {0}.A.fastq {0}.1.fastq".format(libname)
        sh(cmd)
        cmd = "mv {0}.B.fastq {0}.2.fastq".format(libname)
        sh(cmd)
911463
def dumpfile(item, path):
    '''
    
    '''
    with io.open(path, 'wb') as fd:
        fd.write(en(item))
430545
def dump2sqlite(records, output_file):
    """"""
    results_keys = list(records.results[0].keys())
    pad_data = []

    for key in REQUIRED_KEYS:
        if key not in results_keys:
            results_keys.append(key)
            pad_data.append("")

    conn = sqlite3.connect(os.path.expanduser(output_file), detect_types=sqlite3.PARSE_DECLTYPES)

    # in each row there needs to be data for every column
    # last column is current time
    pad_data.append(datetime.datetime.utcnow())

    to_db = [list(row.values()) + pad_data for row in records.results]

    cur = conn.cursor()
    cur.execute(
        "CREATE TABLE testcases ({},sqltime TIMESTAMP)".format(
            ",".join("{} TEXT".format(key) for key in results_keys)
        )
    )
    cur.executemany(
        "INSERT INTO testcases VALUES ({},?)".format(",".join(["?"] * len(results_keys))), to_db
    )

    if records.testrun:
        cur.execute("CREATE TABLE testrun (testrun TEXT)")
        cur.execute("INSERT INTO testrun VALUES (?)", (records.testrun,))

    conn.commit()
    conn.close()

    logger.info("Data written to '%s'", output_file)
1230935
def dump(self, file_name, page_size=10, vtimeout=10, sep='\n'):
        """"""
        fp = open(file_name, 'wb')
        n = 0
        l = self.get_messages(page_size, vtimeout)
        while l:
            for m in l:
                fp.write(m.get_body())
                if sep:
                    fp.write(sep)
                n += 1
            l = self.get_messages(page_size, vtimeout)
        fp.close()
        return n
1150403
def dump(obj, name, path=None, ext="dat", overwrite=True, silent=False):
    
    if path and os.path.isfile(path):
        raise ValueException("Specified path is a file.")

    filename = __get_filename(path, name, ext)
    
    if not overwrite and os.path.exists(filename):
        if not silent:
            raise ValueException("Specified output filename already exists.")
        return
    
    with open(filename, "wb") as f:
        pickle.dump(obj, f)
662435
function dumpFiles(title, fn) {
            var matches = fn();
            if (matches.length) {
                log.info("");
                log.info((title + ":")['green']);
                for (var i = 0; i < matches.length; i++) {
                    if (matches[i].src === matches[i].dst) {
                        log.info(matches[i].dst);
                    } else {
                        log.info(matches[i].dst + ' (from ' + matches[i].src + ')');
                    }
                }
            }
        }
986622
def dump(self):
        """"""
        self.print("Dumping data to {}".format(self.dump_filename))
        pickle.dump({
            'data': self.counts,
            'livetime': self.get_livetime()
        }, open(self.dump_filename, "wb"))
676080
def dumpb(self, obj, *, max_nested_level=100):
        """"""
        self._max_nested_level = max_nested_level
        return self._encode(obj).encode('utf-8')
1369394
def dumps(asts):
    
    d = asts.values.tostring()
    t = asts.index.values.astype(float).tostring()
    lt = struct.pack('<L', len(t))
    i = asts.name.encode('utf-8')
    li = struct.pack('<L', len(i))
    try:  # python 2
        return buffer(zlib.compress(li + lt + i + t + d))
    except NameError:  # python 3
        return zlib.compress(li + lt + i + t + d)
1118571
def Dump(self):
        
        prefs_file = open(self.prefs_path, 'w')
        for n in range(0,len(self.prefs)):
            if len(list(self.prefs.items())[n]) > 1:
                prefs_file.write(str(list(self.prefs.items())[n][0]) + ' = ' +
                                 str(list(self.prefs.items())[n][1]) + '\n')
        prefs_file.close()
1254959
def dump(data, stream=None, **kwargs):
    '''
    
    '''
    if 'allow_unicode' not in kwargs:
        kwargs['allow_unicode'] = True
    return yaml.dump(data, stream, **kwargs)
809259
def dump_t_coords(dataset_dir, data_dir, dataset, root=None, compress=True):
    """"""
    if root is None:
        root = {}
    tcoords = dataset.GetPointData().GetTCoords()
    if tcoords:
        dumped_array = dump_data_array(dataset_dir, data_dir, tcoords, {}, compress)
        root['pointData']['activeTCoords'] = len(root['pointData']['arrays'])
        root['pointData']['arrays'].append({'data': dumped_array})