Set the exectuable bit on the given filename
960933
def set_executable(filename):
    """"""
    st = os.stat(filename)
    os.chmod(filename, st.st_mode | stat.S_IEXEC)
350119
def open_with_encoding(filename,
                       encoding=None, mode='r', limit_byte_check=-1):
    """"""
    if not encoding:
        encoding = detect_encoding(filename, limit_byte_check=limit_byte_check)

    return io.open(filename, mode=mode, encoding=encoding,
                   newline='')
238029
def read(filename, binary=True):
    
    with open(filename, 'rb' if binary else 'r') as f:
        return f.read()
111304
def _setauto(self, s, length, offset):
        """"""
        # As s can be so many different things it's important to do the checks
        # in the correct order, as some types are also other allowed types.
        # So basestring must be checked before Iterable
        # and bytes/bytearray before Iterable but after basestring!
        if isinstance(s, Bits):
            if length is None:
                length = s.len - offset
            self._setbytes_unsafe(s._datastore.rawbytes, length, s._offset + offset)
            return
        if isinstance(s, file):
            if offset is None:
                offset = 0
            if length is None:
                length = os.path.getsize(s.name) * 8 - offset
            byteoffset, offset = divmod(offset, 8)
            bytelength = (length + byteoffset * 8 + offset + 7) // 8 - byteoffset
            m = MmapByteArray(s, bytelength, byteoffset)
            if length + byteoffset * 8 + offset > m.filelength * 8:
                raise CreationError("File is not long enough for specified "
                                    "length and offset.")
            self._datastore = ConstByteStore(m, length, offset)
            return
        if length is not None:
            raise CreationError("The length keyword isn't applicable to this initialiser.")
        if offset:
            raise CreationError("The offset keyword isn't applicable to this initialiser.")
        if isinstance(s, basestring):
            bs = self._converttobitstring(s)
            assert bs._offset == 0
            self._setbytes_unsafe(bs._datastore.rawbytes, bs.length, 0)
            return
        if isinstance(s, (bytes, bytearray)):
            self._setbytes_unsafe(bytearray(s), len(s) * 8, 0)
            return
        if isinstance(s, array.array):
            b = s.tostring()
            self._setbytes_unsafe(bytearray(b), len(b) * 8, 0)
            return
        if isinstance(s, numbers.Integral):
            # Initialise with s zero bits.
            if s < 0:
                msg = "Can't create bitstring of negative length {0}."
                raise CreationError(msg, s)
            data = bytearray((s + 7) // 8)
            self._datastore = ByteStore(data, s, 0)
            return
        if isinstance(s, collections.Iterable):
            # Evaluate each item as True or False and set bits to 1 or 0.
            self._setbin_unsafe(''.join(str(int(bool(x))) for x in s))
            return
        raise TypeError("Cannot initialise bitstring from {0}.".format(type(s)))
425751
private int setBit(final int mem, final int mask, final boolean value) {

		final int result;
		if (value) {
			result = mem | mask;  // set bit by using OR
		} else {
			result = mem & ~mask; // clear bit by using AND with the inverted mask
		}
		return result;

	}
779831
def _set_file_encoding_utf8(filename):
    """"""
    with open(filename, 'r+') as f:
        content = f.read()
        f.seek(0, 0)
        f.write("# -*- coding: utf-8 -*-\n" + content)
341264
def make_tmpname(basename, n)
      extension = File.extname(basename)
      sprintf("%s,%d,%d%s", File.basename(basename, extension), $$, n.to_i, extension)
    end
1135914
protected function setFilenameOption($filename): void
    {
        if (is_string($filename)) {
            $filename = new BasicFilename($filename);
        }

        if (!is_callable($filename)) {
            throw new TypeError("Filename should be a string or callable");
        }

        $this->filename = $filename;
    }
1051385
def _set_attribute(self, attribute, name, value):
        """"""
        try:
            if attribute is None:
                attribute = self._attribute_file_open( name )
            else:
                attribute.seek(0)

            if isinstance(value, str):
                value = value.encode()
            attribute.write(value)
            attribute.flush()
        except Exception as ex:
            self._raise_friendly_access_error(ex, name)
        return attribute
650903
public static void setEnableFileLog(boolean enable, String path, String fileName) {
        sEnableFileLog = enable;

        if (enable && path != null && fileName != null) {
            sLogFilePath = path.trim();
            sLogFileName = fileName.trim();

            if (!sLogFilePath.endsWith("/")) {
                sLogFilePath = sLogFilePath + "/";
            }
        }
    }
360615
def set_current_filename(self, filename, focus=True):
        """"""
        index = self.has_filename(filename)
        if index is not None:
            if focus:
                self.set_stack_index(index)
            editor = self.data[index].editor
            if focus:
                editor.setFocus()
            else:
                self.stack_history.remove_and_append(index)

            return editor
782787
def load(self, filename):
        ''''''
        try:
            f = open(filename, mode='r')
        except Exception:
            return False
        while True:
            line = f.readline()
            if not line:
                break
            line = line.rstrip()
            eq = line.find('=')
            if eq == -1:
                continue
            name = line[:eq]
            value = line[eq+1:]
            self.set(name, value)
        f.close()
        return True
81388
def bitop_xor(self, dest, key, *keys):
        """"""
        return self.execute(b'BITOP', b'XOR', dest, key, *keys)
115262
def write_binary(filename, data):
    """"""
    dir = os.path.dirname(filename)
    if not os.path.exists(dir):
        os.makedirs(dir)
    with open(filename, 'wb') as f:
        f.write(data)
286093
def save(self, filename):
        
        clibrebound.reb_output_binary(byref(self), c_char_p(filename.encode("ascii")))
545074
def set_file(self, filename):
        
        # Use the file name as prefix if none is given
        if self.output_prefix is None:
            _, self.output_prefix = os.path.split(filename)
        # Check if the file is present, since rdpcap will not do that
        if not (os.path.isfile(filename) and os.access(filename, os.R_OK)):
            print 'The file \'{0}\' is either not present or not readable. '\
                  'Exiting!'.format(filename)
            sys.exit(1)
        try:
            packets = rdpcap(filename)
        except NameError:
            # Due probably to a bug in rdpcap, this kind of error raises a
            # NameError, because the exception that is tried to raise, is not
            # defined
            print 'The file \'{}\' is not a pcap capture file. Exiting!'\
                .format(filename)
            sys.exit(2)

        for number, packet in enumerate(packets):
            # See if there is a field called load
            self._debug('\nNUMBER {0}'.format(number), no_prefix=True)
            try:
                # Will cause AttributeError if there is no load
                packet.getfieldval('load')
                # Get the full load
                load = packet.sprintf('%TCP.payload%')
                self._debug('PAYLOAD LENGTH {0}'.format(len(load)),
                            no_prefix=True)
                self._debug(load, load=True)
                self._parse_load(load)
            except AttributeError:
                self._debug('LOAD EXCEPTION', no_prefix=True)
        if len(self.messages) > 0 and not self.messages[-1].write_closed:
            self._debug('DELETE LAST OPEN FILE')
            del self.messages[-1]

        if self.args.debug_analysis:
            sys.exit(0)
311125
def set_from_bits(self, value: int):
        
        if self.signed:
            value = -(value & self.tcmask) + (value & ~self.tcmask)
        self.set(value)