Converts GLFW modifier key flags into PlayN modifier key flags.
502818
private int toModifierFlags (int mods) {
    return modifierFlags((mods & GLFW_MOD_ALT) != 0,
                         (mods & GLFW_MOD_CONTROL) != 0,
                         (mods & GLFW_MOD_SUPER) != 0,
                         (mods & GLFW_MOD_SHIFT) != 0);
  }
1203409
def _convert_pflags(self, pflags):
        """"""
        if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE):
            flags = os.O_RDWR
        elif pflags & SFTP_FLAG_WRITE:
            flags = os.O_WRONLY
        else:
            flags = os.O_RDONLY
        if pflags & SFTP_FLAG_APPEND:
            flags |= os.O_APPEND
        if pflags & SFTP_FLAG_CREATE:
            flags |= os.O_CREAT
        if pflags & SFTP_FLAG_TRUNC:
            flags |= os.O_TRUNC
        if pflags & SFTP_FLAG_EXCL:
            flags |= os.O_EXCL
        return flags
1206052
function convertWindowsVersion(version) {
  const parts = version.split('-');
  const mainVersion = parts.shift();

  if (parts.length > 0) {
    return [mainVersion, parts.join('-').replace(/\./g, '')].join('-');
  }

  return mainVersion;
}
744406
private static Map<ColorRgba, Collection<TileRef>> convertToColorKey(Map<TileRef, ColorRgba> tiles)
    {
        final Map<ColorRgba, Collection<TileRef>> colors = new HashMap<>();

        for (final Map.Entry<TileRef, ColorRgba> entry : tiles.entrySet())
        {
            final Collection<TileRef> tilesRef = getTiles(colors, entry.getValue());
            tilesRef.add(entry.getKey());
        }

        return colors;
    }
1325080
def chmod_repr(flags):
  

  template = 'rwxrwxrwx'
  order = (_stat.S_IRUSR, _stat.S_IWUSR, _stat.S_IXUSR,
           _stat.S_IRGRP, _stat.S_IWGRP, _stat.S_IXGRP,
           _stat.S_IROTH, _stat.S_IWOTH, _stat.S_IXOTH)
  return ''.join(template[i] if flags&x else '-'
                 for i, x in enumerate(order))
1175684
def get_compiler_flags():
    """"""
    compiler = get_default_fcompiler()
    if compiler == 'absoft':
        flags = ['-m64', '-O3', '-YEXT_NAMES=LCS', '-YEXT_SFX=_',
                 '-fpic', '-speed_math=10']
    elif compiler == 'gnu95':
        flags = ['-m64', '-fPIC', '-O3', '-ffast-math']
    elif compiler == 'intel':
        flags = ['-m64', '-fpp', '-free', '-O3', '-Tf']
    elif compiler == 'g95':
        flags = ['-O3', '-fno-second-underscore']
    elif compiler == 'pg':
        flags = ['-fast']
    else:
        flags = ['-m64', '-O3']
    return flags
306090
def gwcalctyp(self):
        """"""
        dig0 = str(self._SIGMA_TYPES[self.type])
        dig1 = str(self._SC_MODES[self.sc_mode])
        return dig1.strip() + dig0.strip()
822465
def _fixup_cdef_enums(string, reg=re.compile(r"=\s*(\d+)\s*<<\s*(\d+)")):
    """"""

    def repl_shift(match):
        shift_by = int(match.group(2))
        value = int(match.group(1))
        int_value = ctypes.c_int(value << shift_by).value
        return "= %s" % str(int_value)
    return reg.sub(repl_shift, string)
227649
def to_s
      flags  = 0
      flags |= FLAG_COMPRESSED if compressed?
      flags |= FLAG_IV if iv
      flags |= FLAG_KEY if key
      flags |= FLAG_CIPHER_NAME if cipher_name
      flags |= FLAG_AUTH_TAG if auth_tag

      header = "#{MAGIC_HEADER}#{version.chr(SymmetricEncryption::BINARY_ENCODING)}#{flags.chr(SymmetricEncryption::BINARY_ENCODING)}"

      if iv
        header << [iv.length].pack('v')
        header << iv
      end

      if key
        encrypted = cipher.binary_encrypt(key, header: false)
        header << [encrypted.length].pack('v')
        header << encrypted
      end

      if cipher_name
        header << [cipher_name.length].pack('v')
        header << cipher_name
      end

      if auth_tag
        header << [auth_tag.length].pack('v')
        header << auth_tag
      end

      header
    end
1028435
def editflags(fd, add_flags=0, remove_flags=0):
    

    if add_flags & remove_flags != 0:
        raise ValueError(
            'Added and removed flags shouldn\'t overlap',
            add_flags, remove_flags)

    # The ext2progs code uses int or unsigned long,
    # the kernel uses an implicit int,
    # let's be explicit here.
    flags_ptr = ffi.new('uint64_t*')
    flags_buf = ffi.buffer(flags_ptr)
    fcntl.ioctl(fd, lib.FS_IOC_GETFLAGS, flags_buf)
    prev_flags = flags_ptr[0]
    flags_ptr[0] |= add_flags
    # Python represents negative numbers with an infinite number of
    # ones in bitops, so this will work correctly.
    flags_ptr[0] &= ~remove_flags
    fcntl.ioctl(fd, lib.FS_IOC_SETFLAGS, flags_buf)
    return prev_flags & (add_flags | remove_flags)
468280
def _create_flags(self, kw):
        

        flags = {}
        for k in kw.keys():
            flags[k] = kw[k]
            flags[k.lower()] = flags[k]
        return flags
347609
def GameTypeEnum(ctx):
    """"""
    return Enum(
        ctx,
        RM=0,
        Regicide=1,
        DM=2,
        Scenario=3,
        Campaign=4,
        KingOfTheHill=5,
        WonderRace=6,
        DefendTheWonder=7,
        TurboRandom=8
    )
572053
function G(iid, base, offset, flags) {
        var bFlags = decodeBitPattern(flags, 3); // [isComputed, isOpAssign, isMethodCall]

        var aret, skip = false, val;

        if (sandbox.analysis && sandbox.analysis.getFieldPre) {
            aret = sandbox.analysis.getFieldPre(iid, base, offset, bFlags[0], bFlags[1], bFlags[2]);
            if (aret) {
                base = aret.base;
                offset = aret.offset;
                skip = aret.skip;
            }
        }

        if (!skip) {
            val = base[offset];
        }
        if (sandbox.analysis && sandbox.analysis.getField) {
            aret = sandbox.analysis.getField(iid, base, offset, val, bFlags[0], bFlags[1], bFlags[2]);
            if (aret) {
                val = aret.result;
            }
        }
        return (lastComputedValue = val);
    }
91682
def _define_absl_flags(self, absl_flags):
    """"""
    key_flags = set(absl_flags.get_key_flags_for_module(sys.argv[0]))
    for name in absl_flags:
      if name in _BUILT_IN_FLAGS:
        # Do not inherit built-in flags.
        continue
      flag_instance = absl_flags[name]
      # Each flags with short_name appears in FLAGS twice, so only define
      # when the dictionary key is equal to the regular name.
      if name == flag_instance.name:
        # Suppress the flag in the help short message if it's not a main
        # module's key flag.
        suppress = flag_instance not in key_flags
        self._define_absl_flag(flag_instance, suppress)
614291
function createFlags( flags ) {
	var object = flagsCache[ flags ] = {},
		i, length;
	flags = flags.split( /\s+/ );
	for ( i = 0, length = flags.length; i < length; i++ ) {
		object[ flags[i] ] = true;
	}
	return object;
}
1060731
protected int convertMatchFlags(Element opts) {
		int flags = 0;

		String sopts = ((StringProperty) opts).getValue();

		for (int i = 0; i < sopts.length(); i++) {
			char c = sopts.charAt(i);
			switch (c) {
			case 'i':
				flags |= Pattern.CASE_INSENSITIVE;
				break;
			case 's':
				flags |= Pattern.DOTALL;
				break;
			case 'm':
				flags |= Pattern.MULTILINE;
				break;
			case 'u':
				flags |= Pattern.UNICODE_CASE;
				break;
			case 'x':
				flags |= Pattern.COMMENTS;
				break;
			default:
				throw EvaluationException.create(sourceRange,
						MSG_INVALID_REGEXP_FLAG, c);
			}
		}

		return flags;
	}
1358857
def GameActionModeEnum(ctx):
    """"""
    return Enum(
        ctx,
        diplomacy=0,
        speed=1,
        instant_build=2,
        quick_build=4,
        allied_victory=5,
        cheat=6,
        unk0=9,
        spy=10,
        unk1=11,
        farm_queue=13,
        farm_unqueue=14,
        default=Pass
    )