This moves the read files and renames the glob, outputs a new
        ConfigParse object with updated values
425298
def sym_reads_new_config(self, newDir, sym=False, mv=False):
        """"""
        newParams = copy.copy(self)
        for i in range(0,len(self.params["lib_seq"])):
            lib_seq = self.params["lib_seq"][i]
            #update the glob
            newParams.params["lib_seq"][i]["globs"] = [os.path.join(
                newDir,os.path.basename(x)) for x in lib_seq["globs"]]
            #now update the file paths and move/symlink if necessary
            for j in range(0, len(lib_seq["pairs"])):
                forward, reverse = lib_seq["pairs"][j]
                new_forward = os.path.join(newDir, os.path.basename(forward))
                new_reverse = os.path.join(newDir, os.path.basename(reverse))
                #move or symlink the files
                if sym:
                    for each in [new_forward, new_reverse]:
                        if os.path.exists(each):
                            raise ValueError("""Attempted to make a symlink for
                            a reads file, but it already exists. Chances are
                            that you used the same reads for two lines in the
                            Meraculous config file""")
                    os.symlink(forward, new_forward)
                    os.symlink(reverse, new_reverse)
                #update the reads in the new config
                newParams.params["lib_seq"][i]["pairs"][j] = [new_forward, new_reverse]
        return newParams
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
921649
def _update(self, kwargs):
        """"""
        from pygal.util import merge
        dir_self_set = set(dir(self))
        merge(
            self.__dict__,
            dict([(k, v) for (k, v) in kwargs.items()
                  if not k.startswith('_') and k in dir_self_set])
        )
48355
def _update_from_standard_locations():
    ''' 
    '''
    locs = [
        join(expanduser('~'), _config_name),
        join('.', _config_name)
    ]
    if 'PLIERS_CONFIG' in os.environ:
        locs.insert(1, os.environ['PLIERS_CONFIG'])

    from_file(locs, False)
1008883
def atexit_rmglob(path,
                  glob=glob.glob,
                  isdir=os.path.isdir,
                  isfile=os.path.isfile,
                  remove=os.remove,
                  rmtree=shutil.rmtree):  # pragma: no cover
    """"""
    for p in glob(path):
        if isfile(p):
            remove(p)
        elif isdir(p):
            rmtree(p)
757981
def rename_file(self, old_path, new_path):
        
        self.log.debug("S3contents.GenericManager: Init rename of '%s' to '%s'", old_path, new_path)
        if self.file_exists(new_path) or self.dir_exists(new_path):
            self.already_exists(new_path)
        elif self.file_exists(old_path) or self.dir_exists(old_path):
            self.log.debug("S3contents.GenericManager: Actually renaming '%s' to '%s'", old_path,
                           new_path)
            self.fs.mv(old_path, new_path)
        else:
            self.no_such_entity(old_path)
471994
def _do_readme_update(self):
        """"""
        import codecs
        import glob

        # read in,
        data_in = codecs.open(
            os.path.join(HERE, 'README.rst'), 'r', 'utf8').read()

        # search for beginning and end positions,
        pos_begin = data_in.find(self.README_PATCH_FROM)
        assert pos_begin != -1, (pos_begin, self.README_PATCH_FROM)
        pos_begin += len(self.README_PATCH_FROM)

        pos_end = data_in.find(self.README_PATCH_TO)
        assert pos_end != -1, (pos_end, self.README_PATCH_TO)

        glob_pattern = os.path.join(HERE, 'data', '*.txt')
        file_descriptions = [
            self._describe_file_header(fpath)
            for fpath in glob.glob(glob_pattern)]

        # patch,
        data_out = (
            data_in[:pos_begin] +
            '\n\n' +
            '\n'.join(file_descriptions) +
            '\n\n' +
            data_in[pos_end:]
        )

        # write.
        print("patching {} ..".format(self.README_RST))
        codecs.open(
            self.README_RST, 'w', 'utf8').write(data_out)
131386
def move(self, filename, target):
        '''
        
        '''
        self.copy(filename, target)
        self.delete(filename)
1163672
def update(config):
    

    def write_to(out):
        engine.output(out)

    config_file = Path(config.config_file)
    if not config_file.is_file():
        click.echo('No file {} '.format(config_file), err=True)
        sys.exit()

    library = KeyLibrary(config.key_directory)
    with config_file.open() as fd:
        engine = SedgeEngine(library, fd, not config.no_verify, url=config.config_file)

    if config.output_file == '-':
        write_to(ConfigOutput(sys.stdout))
        return

    if not check_or_confirm_overwrite(config.output_file):
        click.echo('Aborting.', err=True)
        sys.exit(1)

    tmp_file = NamedTemporaryFile(mode='w', dir=os.path.dirname(config.output_file), delete=False)
    try:
        tmp_file.file.write(sedge_config_header.format(config.config_file))
        write_to(ConfigOutput(tmp_file.file))
        tmp_file.close()
        if config.verbose:
            diff_config_changes(config.output_file, tmp_file.name)
        os.rename(tmp_file.name, config.output_file)
    except:
        os.unlink(tmp_file.name)
        raise
1310419
def adapt_files(solver):
    

    print("adapting {0}'s files".format(solver))
    root = os.path.join('solvers', solver)

    for arch in to_extract[solver]:
        arch = os.path.join(root, arch)
        extract_archive(arch, solver, put_inside=True)

    for fnames in to_move[solver]:
        old = os.path.join(root, fnames[0])
        new = os.path.join(root, fnames[1])
        os.rename(old, new)

    for f in to_remove[solver]:
        f = os.path.join(root, f)
        if os.path.isdir(f):
            shutil.rmtree(f)
        else:
            os.remove(f)
1060812
def config_altered(self, persistGlobal):
        
        _logger.info("Configuration changed - rebuilding in-memory structures")
        
        self.lock.acquire()
        # Rebuild root folder list
        #rootFolders = self.folders
        #self.folders = []
        #for folder in rootFolders:
        #    self.folders.append(folder)
        
        self.hotKeyFolders = []
        self.hotKeys = []
        
        self.abbreviations = []
        
        self.allFolders = []
        self.allItems = []
        
        for folder in self.folders:
            if model.TriggerMode.HOTKEY in folder.modes:
                self.hotKeyFolders.append(folder)
            self.allFolders.append(folder)
            
            if not self.app.monitor.has_watch(folder.path):
                self.app.monitor.add_watch(folder.path)
            
            self.__processFolder(folder)
        
        self.globalHotkeys = []
        self.globalHotkeys.append(self.configHotkey)
        self.globalHotkeys.append(self.toggleServiceHotkey)
        #_logger.debug("Global hotkeys: %s", self.globalHotkeys)
        
        #_logger.debug("Hotkey folders: %s", self.hotKeyFolders)
        #_logger.debug("Hotkey phrases: %s", self.hotKeys)
        #_logger.debug("Abbreviation phrases: %s", self.abbreviations)
        #_logger.debug("All folders: %s", self.allFolders)
        #_logger.debug("All phrases: %s", self.allItems)
        
        if persistGlobal:
            save_config(self)

        self.lock.release()
476610
def move_to(name):
    
    datapath = path.join(path.dirname(path.realpath(__file__)), path.pardir)
    datapath = path.join(datapath, '../gzoo_data', 'images', name)
    print path.normpath(datapath)
    return path.normpath(datapath)
430761
function copyReadmeFiles() {
    const resolvedSrcReadmePaths = path.resolve(rootDir, srcReadmePaths);

    glob(resolvedSrcReadmePaths, void(0), function(error, files) {
        files.forEach((filePath) => {
        const destReadmePath = filePath.replace(/(\bsrc\b)(?!.*\1)/, destDir);
            fs.copyFileSync(filePath, destReadmePath);
        });
    });
}
848501
def move(self, path, raise_if_exists=False):
        
        self.rename(path, raise_if_exists=raise_if_exists)
926671
def update_safe(filename: str, **kw: Any) -> Generator[IO, None, None]:
    
    with tempfile.NamedTemporaryFile(
        dir=os.path.dirname(filename),
        delete=False,
        prefix=f"{os.path.basename(filename)}.",
        **kw,
    ) as tf:
        if os.path.exists(filename):
            os.chmod(tf.name, os.stat(filename).st_mode & 0o7777)
        tf.has_changed = False  # type: ignore
        yield tf
        if not os.path.exists(tf.name):
            return
        filename_tmp = tf.name
    if os.path.exists(filename) and filecmp.cmp(filename, filename_tmp, shallow=False):
        os.unlink(filename_tmp)
    else:
        os.rename(filename_tmp, filename)
        tf.has_changed = True
1359941
def rename(self, old_key, new_key):
        
        assert new_key not in self
        assert old_key != new_key

        file_ = self[old_key]
        old_data = self.filesmap[old_key]

        # Create a new version with the new name
        obj = ObjectVersion.create(
            bucket=self.bucket, key=new_key,
            _file_id=file_.obj.file_id
        )

        # Delete old key
        self.filesmap[new_key] = self.file_cls(obj, old_data).dumps()
        del self[old_key]

        return obj
939331
function renameFile (oldFile, newFile) {
    if (!isFileRegistered(oldFile) || isFileRegistered(newFile)) { return undefined; }

    let item = fileRegistry[oldFile];

    item.file = newFile;

    fileRegistry[newFile] = item;

    delete fileRegistry[oldFile];
}