Writes a .gitignore file to ignore the generated data file.
768322
def add_ignore(self):
        
        path = self.lazy_folder + self.ignore_filename
        
        # If the file exists, return.
        if os.path.isfile(os.path.realpath(path)):
            return None

        sp, sf = os.path.split(self.data_file)

        #Write the file.
        try:
            handle = open(path,'w')
            handle.write(sf + '\n')
        except IOError as e:
            raise e

        # Close the handle and return.
        handle.close()
        return None
1155569
def _write_pidfile(self):
        """"""
        LOGGER.debug('Writing pidfile: %s', self.pidfile_path)
        with open(self.pidfile_path, "w") as handle:
            handle.write(str(os.getpid()))
729844
def write(settings_path, settings_data, **kwargs):
    """"""
    for key, value in settings_data.items():
        dotenv_cli.set_key(str(settings_path), key.upper(), str(value))
427355
def write(*args, **kwargs):
    """"""
    debug = kwargs.pop("debug", None)
    warning = kwargs.pop("warning", None)
    if _logger:
        kwargs.pop("end", None)
        kwargs.pop("file", None)
        if debug:
            _logger.debug(*args, **kwargs)
        elif warning:
            _logger.warning(*args, **kwargs)
        else:
            _logger.info(*args, **kwargs)
    else:
        print(*args, **kwargs)
551766
public static function removePackageLockJsonFromGitIgnore()
    {
        if (!file_exists(static::GIT_IGNORE_FILE)) {
            return;
        }

        $gitignore = file_get_contents(static::GIT_IGNORE_FILE);
        $gitignore = str_replace("package-lock.json\n", '', $gitignore);
        file_put_contents(static::GIT_IGNORE_FILE, $gitignore);
    }
607387
def rm(pattern):
    """"""
    paths = glob.glob(pattern)
    for path in paths:
        if path.startswith('.git/'):
            continue
        if os.path.isdir(path):
            def onerror(fun, path, excinfo):
                exc = excinfo[1]
                if exc.errno != errno.ENOENT:
                    raise

            safe_print("rmdir -f %s" % path)
            shutil.rmtree(path, onerror=onerror)
        else:
            safe_print("rm %s" % path)
            os.remove(path)
804094
def jshint_ignore(settings_data_key)
        return unless settings_data_key.is_a?(Hash) && settings_data_key.key?('jshintignore')

        jshintignore_file = []
        settings_data_key['jshintignore'].each { |i| jshintignore_file << "#{i}\n" }
        @settings[:jshintignore] = temp_it('jshintignore.json', jshintignore_file)
      end
463640
def write (self, s, **args):
        
        if self.filename is not None:
            self.start_fileoutput()
        if self.fd is None:
            # Happens when aborting threads times out
            log.warn(LOG_CHECK, "writing to unitialized or closed file")
        else:
            try:
                self.fd.write(s, **args)
            except IOError:
                msg = sys.exc_info()[1]
                log.warn(LOG_CHECK,
                    "Could not write to output file: %s\n"
                    "Disabling log output of %s", msg, self)
                self.close_fileoutput()
                self.fd = dummy.Dummy()
                self.is_active = False
188768
def write_unregistered_file(date=None):
    
    delete_registered_file()
    if date is None:
        date = get_time()
    for f in constants.unregistered_files:
        if os.path.lexists(f):
            if os.path.islink(f):
                # kill symlinks and regenerate
                os.remove(f)
                write_to_disk(f, content=str(date))
        else:
            write_to_disk(f, content=str(date))
1351588
function addGasIgnore(rootFolder) {

    // If no .gitignore files exists, add one
    const gasignore = path.join(rootFolder, constants.IGNORE_FILE);
    if (!fs.existsSync(gasignore)) {
        fs.writeFileSync(gasignore, gasignoreContent);
    }
}
1365954
def mod_git_ignore(directory, ignore_item, action):
    
    if not os.path.isdir(directory):
        return
    ignore_filepath = os.path.join(directory,".gitignore")
    if not os.path.exists(ignore_filepath):
        items = []
    else:
        with open(ignore_filepath) as ig_file:
            items = ig_file.readlines()
    # strip and clean the lines
    clean_items  = [line.strip("\n").strip() for line in items]
    clean_items = make_list(clean_items)
    if action == "add":
        if ignore_item not in clean_items:
            with open(ignore_filepath, "w") as ig_file:
                clean_items.append(ignore_item)
                ig_file.write("\n".join(clean_items) + "\n")
    elif action == "remove":
        with open(ignore_filepath, "w") as ig_file:
            for i, value in enumerate(clean_items):
                if value != ignore_item.lower():
                    ig_file.write(items[i])
737802
def _write_file_iface(iface, data, folder, pattern):
    '''
    
    '''
    filename = os.path.join(folder, pattern.format(iface))
    if not os.path.exists(folder):
        msg = '{0} cannot be written. {1} does not exist'
        msg = msg.format(filename, folder)
        log.error(msg)
        raise AttributeError(msg)
    with salt.utils.files.fopen(filename, 'w') as fp_:
        fp_.write(salt.utils.stringutils.to_str(data))
361658
protected void writeFileTop(OutputStream o) throws Util.Exit {
        PrintWriter pw = wrapWriter(o);
        pw.println("/* DO NOT EDIT THIS FILE - it is machine generated */" + lineSep +
                   getIncludes());
    }
638814
function writeFile(config, isJson, callback) {
  try {
    fs.writeFile('./.nplintrc', isJson ? JSON.stringify(config, null, 4) : yaml.safeDump(config), callback);
  } catch (e) {
    return callback(e);
  }
}
392776
def ignore():
    # type: () -> List[str]
    

    def parse_line(line):   # pylint: disable=missing-docstring
        # Decode if necessary
        if not isinstance(line, string_types):
            line = line.decode('utf-8')

        # Strip comment
        line = line.split('#', 1)[0].strip()

        return line

    ignore_files = [
        conf.proj_path('.gitignore'),
        conf.proj_path('.git/info/exclude'),
        config().get('core.excludesfile')
    ]

    result = []
    for ignore_file in ignore_files:
        if not (ignore_file and os.path.exists(ignore_file)):
            continue

        with open(ignore_file) as fp:
            parsed = (parse_line(l) for l in fp.readlines())
            result += [x for x in parsed if x]

    return result
200837
private void writeUnixCleanup(File file, BufferedWriter bw) throws IOException {
        bw.write("echo begin delete" + "\n");
        bw.write("n=0" + "\n");
        bw.write("while [ $n -ne 1 ]; do" + "\n");
        bw.write("  sleep 3" + "\n");
        bw.write("  if [ -e " + dir.replace('\\', '/') + " ]; then" + "\n");
        bw.write("    rm -rf " + dir.replace('\\', '/') + "\n");
        bw.write("  else" + "\n");
        bw.write("    echo file not found - n=$n" + "\n");
        bw.write("    n=1" + "\n");
        bw.write("  fi" + "\n");
        bw.write("done" + "\n");
        bw.write("echo end delete" + "\n");
        bw.write("rm " + file.getAbsolutePath().replace('\\', '/') + "\n");
    }
342087
def write(self, output=None):
        
        if not output:
            outfile = self['output']+'_asn.fits'
            output = self['output']
        else:
            outfile = output

        # Delete the file if it exists.
        if os.path.exists(outfile):
            warningmsg =  "\n#########################################\n"
            warningmsg += "#                                       #\n"
            warningmsg += "# WARNING:                              #\n"
            warningmsg += "#  The existing association table,      #\n"
            warningmsg += "           " + str(outfile) + '\n'
            warningmsg += "#  is being replaced.                   #\n"
            warningmsg += "#                                       #\n"
            warningmsg += "#########################################\n\n"
        fasn = fits.HDUList()

        # Compute maximum length of MEMNAME for table column definition
        _maxlen = 0
        for _fname in self['order']:
            if len(_fname) > _maxlen: _maxlen = len(_fname)
        # Enforce a mimimum size of 24
        if _maxlen < 24: _maxlen = 24
        namelen_str = str(_maxlen+2)+'A'
        self.buildPrimary(fasn, output=output)

        mname = self['order'][:]
        mname.append(output)
        mtype = ['EXP-DTH' for l in self['order']]
        mtype.append('PROD-DTH')
        mprsn = [True for l in self['order']]
        mprsn.append(False)
        xoff = [self['members'][l]['xoff'] for l in self['order']]
        xoff.append(0.0)
        yoff = [self['members'][l]['yoff'] for l in self['order']]
        yoff.append(0.0)
        xsh = [self['members'][l]['xshift'] for l in self['order']]
        xsh.append(0.0)
        ysh = [self['members'][l]['yshift'] for l in self['order']]
        ysh.append(0.0)
        rot = [self['members'][l]['rot'] for l in self['order']]
        rot.append(0.0)
        scl = [self['members'][l]['scale'] for l in self['order']]
        scl.append(1.0)

        memname = fits.Column(name='MEMNAME',format=namelen_str,array=N.char.array(mname))
        memtype = fits.Column(name='MEMTYPE',format='14A',array=N.char.array(mtype))
        memprsn = fits.Column(name='MEMPRSNT', format='L', array=N.array(mprsn).astype(N.uint8))
        xoffset = fits.Column(name='XOFFSET', format='E', array=N.array(xoff))
        yoffset = fits.Column(name='YOFFSET', format='E', array=N.array(yoff))
        xdelta = fits.Column(name='XDELTA', format='E', array=N.array(xsh))
        ydelta = fits.Column(name='YDELTA', format='E', array=N.array(ysh))
        rotation = fits.Column(name='ROTATION', format='E', array=N.array(rot))
        scale = fits.Column(name='SCALE', format='E', array=N.array(scl))
        cols = fits.ColDefs([memname,memtype,memprsn,xoffset,yoffset,xdelta,ydelta,rotation,scale])
        hdu = fits.BinTableHDU.from_columns(cols)
        fasn.append(hdu)
        if ASTROPY_VER_GE13:
            fasn.writeto(outfile, overwrite=True)
        else:
            fasn.writeto(outfile, clobber=True)
        fasn.close()
        mem0 = self['order'][0]
        refimg = self['members'][mem0]['refimage']
        if refimg is not None:
            whdu = wcsutil.WCSObject(refimg)
            whdu.createReferenceWCS(outfile,overwrite=False)
            ftab = fits.open(outfile)
            ftab['primary'].header['refimage'] = outfile+"[wcs]"
            ftab.close()
        del whdu