renames git special files to 'disable' them
969250
def disable_special_files(path)
      Dir.chdir(File.join(@directory, path)) do
        Find.find(".") do |file|
          next unless file =~ /\.git(ignore)?$/

          FileUtils.mv(file, "#{file}_disabled_by_tetra")
        end
      end
    end
836388
def removeDuplicates(inFileName, outFileName) :
	"""'"""
	f = open(inFileName)
	legend = f.readline()
	
	data = ''
	h = {}
	h[legend] = 0
	
	lines = f.readlines()
	for l in lines :
		if not h.has_key(l) :
			h[l] = 0
			data += l
			
	f.flush()
	f.close()
	f = open(outFileName, 'w')
	f.write(legend+data)
	f.flush()
	f.close()
747984
def add_general_options!(opt)
        opt.separator 'General Options:'

        opt.on('-h', '--help', 'Show this help message and quit.') { |v| options[:help] = v }
        opt.on('-p', '--pretend', 'Run but do not make any changes.') { |v| options[:pretend] = v }
        opt.on('-f', '--force', 'Overwrite files that already exist.') { options[:collision] = :force }
        opt.on('-s', '--skip', 'Skip files that already exist.') { options[:collision] = :skip }
        opt.on('-q', '--quiet', 'Suppress normal output.') { |v| options[:quiet] = v }
        opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |v| options[:backtrace] = v }
        opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') do
          options[:svn] = `svn status`.inject({}) do |opt, e|
            opt[e.chomp[7..-1]] = true
            opt
          end
        end
        opt.on('-g', '--git', 'Modify files with git. (Note: git must be in path)') do
          options[:git] = `git status`.inject({:new => {}, :modified => {}}) do |opt, e|
            opt[:new][e.chomp[14..-1]] = true if e =~ /new file:/
            opt[:modified][e.chomp[14..-1]] = true if e =~ /modified:/
            opt
          end
        end
      end
81503
def remove(ctx, client, sources):
    """"""
    from renku.api._git import _expand_directories

    def fmt_path(path):
        """Format path as relative to the client path."""
        return str(Path(path).absolute().relative_to(client.path))

    files = {
        fmt_path(source): fmt_path(file_or_dir)
        for file_or_dir in sources
        for source in _expand_directories((file_or_dir, ))
    }

    # 1. Update dataset metadata files.
    with progressbar(
        client.datasets.values(),
        item_show_func=lambda item: str(item.short_id) if item else '',
        label='Updating dataset metadata',
        width=0,
    ) as bar:
        for dataset in bar:
            remove = []
            for key, file_ in dataset.files.items():
                filepath = fmt_path(file_.full_path)
                if filepath in files:
                    remove.append(key)

            if remove:
                for key in remove:
                    dataset.unlink_file(key)

                dataset.to_yaml()

    # 2. Manage .gitattributes for external storage.
    tracked = tuple(
        path for path, attr in client.find_attr(*files).items()
        if attr.get('filter') == 'lfs'
    )
    client.untrack_paths_from_storage(*tracked)
    existing = client.find_attr(*tracked)
    if existing:
        click.echo(WARNING + 'There are custom .gitattributes.\n')
        if click.confirm(
            'Do you want to edit ".gitattributes" now?', default=False
        ):
            click.edit(filename=str(client.path / '.gitattributes'))

    # Finally remove the files.
    final_sources = list(set(files.values()))
    if final_sources:
        run(['git', 'rm', '-rf'] + final_sources, check=True)
830920
def sdk_normalize(filename):
    
    if filename.startswith('/Developer/SDKs/'):
        pathcomp = filename.split('/')
        del pathcomp[1:4]
        filename = '/'.join(pathcomp)
    return filename
833355
def undo(self, hard=False):
        """"""

        if not self.fake:
            return self.repo.git.reset('HEAD^', working_tree=hard)
        else:
            click.echo(crayons.red('Faked! >>> git reset {}{}'
                                   .format('--hard ' if hard else '', 'HEAD^')))
            return 0
554833
def reduce_filename(f):
    
    '''

    f = os.path.basename(f).split('.')
    return keep_only_digits(f[-3])
252655
def _cleanup(self):
        """"""
        self._expkg = None
        self._extmp = None
        self._flag_e = True
        self._ifile.close()
1090803
def cleanup(self):
        """"""
        shutil.rmtree(self.name, onerror=lambda *a: os.chmod(a[1], __import__('stat').S_IWRITE) or os.unlink(a[1]))
        if os.path.exists(self.name):
            raise IOError(17, "File exists: '{}'".format(self.name))
360618
def cleanup():
        """"""
        for install_dir in linters.INSTALL_DIRS:
            try:
                shutil.rmtree(install_dir, ignore_errors=True)
            except Exception:
                print(
                    "{0}\nFailed to delete {1}".format(
                        traceback.format_exc(), install_dir
                    )
                )
                sys.stdout.flush()
167967
def disable(name, **kwargs):
    '''
    
    '''
    cmd = '/usr/sbin/svcadm disable {0}'.format(name)
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
1293916
public static function cleanup(): void
    {
        $releaseName = sprintf("%s/%s", Utilities::getBasePath(), Utilities::getReleaseName());
        if (is_file($releaseName . '.tar.gz')) {
            unlink($releaseName . '.tar.gz');
        }

        if (is_file($releaseName . '.tar')) {
            unlink($releaseName . '.tar');
        }
    }
1303605
def _cleanup(self, domains):
        """"""
        for option in domains.values():
            try:
                os.remove(option['pot'])
            except (IOError, OSError):
                # It is not a problem if we can't actually remove the temporary file
                pass
1134809
def dotperu_exclude_case_insensitive_git_globs():
    """"""
    globs = []
    for capitalization in DOTPERU_CAPITALIZATIONS:
        globs.append(capitalization + '/**')
        globs.append('**/' + capitalization + '/**')
    return globs
855209
def rename(src, dst):
    '''
    
    '''
    try:
        os.rename(src, dst)
    except OSError as exc:
        if exc.errno != errno.EEXIST:
            raise
        try:
            os.remove(dst)
        except OSError as exc:
            if exc.errno != errno.ENOENT:
                raise MinionError(
                    'Error: Unable to remove {0}: {1}'.format(
                        dst,
                        exc.strerror
                    )
                )
        os.rename(src, dst)
1317716
function(cb) {
            git(repoDir, ['status'], function(err, stdout, stderr) {
                if (err) {
                    log.warn('git status failed on ' + repoDir + ":", err.msg);
                    var indexFile = path.join(repoDir, '.git', 'index');
                    path.exists(indexFile, function(exists) {
                        if (exists) {
                            fs.unlink(indexFile, function(err) {
                                if (err) {
                                    log.warn('removing file ' + indexFile + ' failed with:', err);
                                }
                                else {
                                    log.info('removed index file: ' + indexFile);
                                }
                                cb(err, {status: {stdout: stdout, stderr: stderr}, removeIndex: 'remove git index ' + indexFile + ', result ' + err});
                            });
                            return;
                        }
                        log.warn('No index file ' + indexFile);
                        cb(err, {status: {stdout: stdout, stderr: stderr}, removeIndex: 'no index present'});
                    });
                    return;
                }
                cb(null, {status: {stdout: stdout, stderr: stderr}});
            });
        }
1054120
def del_repo(repo, **kwargs):
    '''
    
    '''

    try:
        _locate_repo_files(repo, rewrite=True)
    except IOError:
        return False
    else:
        return True