Copy only files and configs into the database.
        :param ds: The source dataset to copy
        :param cb: A progress callback, taking two parameters: cb(message, num_records)
        :return:
192068
def copy_dataset_files(self, ds, incver=False, cb=None, **kwargs):
        
        from ambry.orm import File

        tables = [File]

        return self._copy_dataset_copy(ds, tables, incver, cb, **kwargs)
821374
def copy(self):
        
        o = SimLibrary()
        o.procedures = dict(self.procedures)
        o.non_returning = set(self.non_returning)
        o.prototypes = dict(self.prototypes)
        o.default_ccs = dict(self.default_ccs)
        o.names = list(self.names)
        return o
1107476
def create(cls, train_ds, valid_ds, test_ds=None, path:PathOrStr='.', no_check:bool=False, bs=64, val_bs:int=None,
               num_workers:int=0, device:torch.device=None, collate_fn:Callable=data_collate,
               dl_tfms:Optional[Collection[Callable]]=None, bptt:int=70, backwards:bool=False, **dl_kwargs) -> DataBunch:
        ""
        datasets = cls._init_ds(train_ds, valid_ds, test_ds)
        val_bs = ifnone(val_bs, bs)
        datasets = [LanguageModelPreLoader(ds, shuffle=(i==0), bs=(bs if i==0 else val_bs), bptt=bptt, backwards=backwards)
                    for i,ds in enumerate(datasets)]
        val_bs = bs
        dls = [DataLoader(d, b, shuffle=False, **dl_kwargs) for d,b in zip(datasets, (bs,val_bs,val_bs,val_bs)) if d is not None]
        return cls(*dls, path=path, device=device, dl_tfms=dl_tfms, collate_fn=collate_fn, no_check=no_check)
763035
def CopyConfig(self):
    
    newconf = self.MakeNewConfig()
    newconf.raw_data = copy.deepcopy(self.raw_data)
    newconf.files = copy.deepcopy(self.files)
    newconf.secondary_config_parsers = copy.deepcopy(
        self.secondary_config_parsers)
    newconf.writeback = copy.deepcopy(self.writeback)
    newconf.writeback_data = copy.deepcopy(self.writeback_data)
    newconf.global_override = copy.deepcopy(self.global_override)
    newconf.context_descriptions = copy.deepcopy(self.context_descriptions)
    newconf.constants = copy.deepcopy(self.constants)
    newconf.initialized = copy.deepcopy(self.initialized)
    return newconf
370929
def copy(self, version=None, tx_ins=None, tx_outs=None, lock_time=None,
             tx_joinsplits=None, joinsplit_pubkey=None, joinsplit_sig=None):
        '''
        
        '''
        return SproutTx(
            version=version if version is not None else self.version,
            tx_ins=tx_ins if tx_ins is not None else self.tx_ins,
            tx_outs=tx_outs if tx_outs is not None else self.tx_outs,
            lock_time=(lock_time if lock_time is not None
                       else self.lock_time),
            tx_joinsplits=(tx_joinsplits if tx_joinsplits is not None
                           else self.tx_joinsplits),
            joinsplit_pubkey=(joinsplit_pubkey if joinsplit_pubkey is not None
                              else self.joinsplit_pubkey),
            joinsplit_sig=(joinsplit_sig if joinsplit_sig is not None
                           else self.joinsplit_sig))
603529
def copyRecord(  rid, numCopies = 1, dbid = @dbid )
      clearFieldValuePairList
      getRecordInfo( dbid, rid ) { |field|
         if field and field.elements[ "value" ] and field.elements[ "value" ].has_text?
            if field.elements[ "fid" ].text.to_i > 5 #skip built-in fields
               addFieldValuePair( field.elements[ "name" ].text, nil, nil, field.elements[ "value" ].text )
            end
         end
      }
      newRecordIDs = []
      if @fvlist and @fvlist.length > 0
         numCopies.times {
           addRecord( dbid, @fvlist )
           newRecordIDs << @rid if @rid and @update_id
         }
      end
      if block_given?
         newRecordIDs.each{ |newRecordID| yield newRecordID }
      else
         newRecordIDs
      end
   end
46586
def cp(src, dst, overwrite=False):
    

    if not isinstance(src, list):
        src = [src]

    dst = os.path.expanduser(dst)
    dst_folder = os.path.isdir(dst)

    if len(src) > 1 and not dst_folder:
        raise OSError("Cannot copy multiple item to same file")

    for item in src:
        source = os.path.expanduser(item)
        destination = (dst if not dst_folder else
                       os.path.join(dst, os.path.basename(source)))
        if not overwrite and os.path.exists(destination):
            _logger.warning("Not replacing {0} with {1}, overwrite not enabled"
                            "".format(destination, source))
            continue

        shutil.copy(source, destination)
1133654
def copy_all(self, source_databox):
        
        self.copy_headers(source_databox)
        self.copy_columns(source_databox)
        return self
1025118
def bulk_copy(self, ids):
        
        schema = ResultSchema()
        return self.service.bulk_copy(self.base, self.RESOURCE, ids, schema)
444253
def create(cls, train_ds, valid_ds, test_ds=None, path:PathOrStr='.', bs:int=32, val_bs:int=None, pad_idx=1,
               pad_first=True, device:torch.device=None, no_check:bool=False, backwards:bool=False, **dl_kwargs) -> DataBunch:
        ""
        datasets = cls._init_ds(train_ds, valid_ds, test_ds)
        val_bs = ifnone(val_bs, bs)
        collate_fn = partial(pad_collate, pad_idx=pad_idx, pad_first=pad_first, backwards=backwards)
        train_sampler = SortishSampler(datasets[0].x, key=lambda t: len(datasets[0][t][0].data), bs=bs)
        train_dl = DataLoader(datasets[0], batch_size=bs, sampler=train_sampler, drop_last=True, **dl_kwargs)
        dataloaders = [train_dl]
        for ds in datasets[1:]:
            lengths = [len(t) for t in ds.x.items]
            sampler = SortSampler(ds.x, key=lengths.__getitem__)
            dataloaders.append(DataLoader(ds, batch_size=val_bs, sampler=sampler, **dl_kwargs))
        return cls(*dataloaders, path=path, device=device, collate_fn=collate_fn, no_check=no_check)
585919
function copyTemplateDir (srcDir, outDir, vars, cb) {
  if (!cb) {
    if (!vars) vars = noop
    cb = vars
    vars = {}
  }

  assert.equal(typeof srcDir, 'string')
  assert.equal(typeof outDir, 'string')
  assert.equal(typeof vars, 'object')
  assert.equal(typeof cb, 'function')

  // create directory
  mkdirp(outDir, function (err) {
    if (err) return cb(err)

    const rs = readdirp({ root: srcDir })
    const streams = []
    const createdFiles = []

    // create a new stream for every file emitted
    rs.on('data', function (file) {
      createdFiles.push(path.join(outDir, maxstache(removeUnderscore(file.path), vars)))
      streams.push(writeFile(outDir, vars, file))
    })

    // delegate errors & close streams
    eos(rs, function (err) {
      if (err) return cb(err)
      parallel(streams, function (err) {
        if (err) return cb(err)
        cb(null, createdFiles)
      })
    })
  })
}
694983
@Override
    public DataSet copy() {
        DataSet ret = new DataSet(getFeatures().dup(), getLabels().dup());
        if (getLabelsMaskArray() != null)
            ret.setLabelsMaskArray(getLabelsMaskArray().dup());
        if (getFeaturesMaskArray() != null)
            ret.setFeaturesMaskArray(getFeaturesMaskArray().dup());
        ret.setColumnNames(getColumnNames());
        ret.setLabelNames(getLabelNames());
        return ret;
    }
792505
def copyfileobj(src, dst, length=None, exception=OSError):
    
    if length == 0:
        return
    if length is None:
        shutil.copyfileobj(src, dst)
        return

    # BUFSIZE = 16 * 1024
    blocks, remainder = divmod(length, BUFSIZE)
    # for b in range(blocks):
    for _ in range(blocks):
        buf = src.read(BUFSIZE)
        if len(buf) < BUFSIZE:
            raise exception("unexpected end of data")
        dst.write(buf)

    if remainder != 0:
        buf = src.read(remainder)
        if len(buf) < remainder:
            raise exception("unexpected end of data")
        dst.write(buf)
    return
785905
def copy(self, filename=None):
        
        dst = os.path.join(self.dst_path, filename)
        src = os.path.join(self.src_path, filename)
        dst_tmp = os.path.join(self.dst_tmp, filename)
        self.put(src=src, dst=dst_tmp, callback=self.update_progress, confirm=True)
        self.rename(src=dst_tmp, dst=dst)
624606
def copy_database_data(self, source, destination, optimized=False):
        
        # Change database to source
        self.enable_printing = False
        self.change_db(source)
        tables = self.tables

        # Copy database data by executing INSERT and SELECT commands in a single query
        if optimized:
            self._copy_database_data_serverside(source, destination, tables)

        # Generate and execute SELECT and INSERT commands
        else:
            self._copy_database_data_clientside(tables, source, destination)

        self.enable_printing = True
287487
def fast_deduplication_backup(self, old_backup_entry, process_bar):
        
        # TODO: merge code with parts from deduplication_backup()
        src_path = self.dir_path.resolved_path
        log.debug("*** fast deduplication backup: '%s'", src_path)
        old_file_path = old_backup_entry.get_backup_path()

        if not self.path_helper.abs_dst_path.is_dir():
            try:
                self.path_helper.abs_dst_path.makedirs(mode=phlb_config.default_new_path_mode)
            except OSError as err:
                raise BackupFileError("Error creating out path: %s" % err)
        else:
            assert not self.path_helper.abs_dst_filepath.is_file(), (
                "Out file already exists: %r" % self.path_helper.abs_src_filepath
            )

        with self.path_helper.abs_dst_hash_filepath.open("w") as hash_file:
            try:
                old_file_path.link(self.path_helper.abs_dst_filepath)  # call os.link()
            except OSError as err:
                log.error("Can't link '%s' to '%s': %s" % (old_file_path, self.path_helper.abs_dst_filepath, err))
                log.info("Mark %r with 'no link source'.", old_backup_entry)
                old_backup_entry.no_link_source = True
                old_backup_entry.save()

                # do a normal copy backup
                self.deduplication_backup(process_bar)
                return

            hash_hexdigest = old_backup_entry.content_info.hash_hexdigest
            hash_file.write(hash_hexdigest)

        file_size = self.dir_path.stat.st_size
        if file_size > 0:
            # tqdm will not accept 0 bytes files ;)
            process_bar.update(file_size)

        BackupEntry.objects.create(
            backup_run=self.backup_run,
            backup_entry_path=self.path_helper.abs_dst_filepath,
            hash_hexdigest=hash_hexdigest,
        )

        if self._SIMULATE_SLOW_SPEED:
            log.error("Slow down speed for tests!")
            time.sleep(self._SIMULATE_SLOW_SPEED)

        self.fast_backup = True  # Was a fast backup used?
        self.file_linked = True
67368
def copy_files(src, ext, dst):
    
    src_path = os.path.join(os.path.dirname(__file__), src)
    dst_path = os.path.join(os.path.dirname(__file__), dst)
    file_list = os.listdir(src_path)
    for f in file_list:
        if f == '__init__.py':
            continue
        f_path = os.path.join(src_path, f)
        if os.path.isfile(f_path) and f.endswith(ext):
            shutil.copy(f_path, dst_path)