max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
1,125
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.common.settings; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.index.IndexFormatTooNewException; import org.apache.lucene.index.IndexFormatTooOldException; import org.apache.lucene.store.BufferedChecksumIndexInput; import org.apache.lucene.store.ChecksumIndexInput; import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.store.SimpleFSDirectory; import org.apache.lucene.util.SetOnce; import org.elasticsearch.cli.ExitCodes; import org.elasticsearch.cli.UserException; import org.elasticsearch.common.Randomness; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.GCMParameterSpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.AccessDeniedException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.PosixFileAttributeView; import java.nio.file.attribute.PosixFilePermissions; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.SecureRandom; import java.util.Arrays; import java.util.Base64; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.regex.Pattern; /** * A disk based container for sensitive settings in Elasticsearch. * * Loading a keystore has 2 phases. First, call {@link #load(Path)}. Then call * {@link #decrypt(char[])} with the keystore password, or an empty char array if * {@link #hasPassword()} is {@code false}. Loading and decrypting should happen * in a single thread. Once decrypted, settings may be read in multiple threads. */ public class KeyStoreWrapper implements SecureSettings { /** An identifier for the type of data that may be stored in a keystore entry. */ private enum EntryType { STRING, FILE } /** * A regex for the valid characters that a setting name in the keystore may use. */ private static final Pattern ALLOWED_SETTING_NAME = Pattern.compile("[a-z0-9_\\-.]+"); public static final Setting<SecureString> SEED_SETTING = SecureSetting.secureString("keystore.seed", null); /** Characters that may be used in the bootstrap seed setting added to all keystores. */ private static final char[] SEED_CHARS = ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + "~!@#$%^&*-_=+?").toCharArray(); /** The name of the keystore file to read and write. */ private static final String KEYSTORE_FILENAME = "elasticsearch.keystore"; /** The version of the metadata written before the keystore data. */ static final int FORMAT_VERSION = 4; /** The oldest metadata format version that can be read. */ private static final int MIN_FORMAT_VERSION = 1; /** The algorithm used to derive the cipher key from a password. */ private static final String KDF_ALGO = "PBKDF2WithHmacSHA512"; /** The number of iterations to derive the cipher key. */ private static final int KDF_ITERS = 10000; /** * The number of bits for the cipher key. * * Note: The Oracle JDK 8 ships with a limited JCE policy that restricts key length for AES to 128 bits. * This can be increased to 256 bits once minimum java 9 is the minimum java version. * See http://www.oracle.com/technetwork/java/javase/terms/readme/jdk9-readme-3852447.html#jce * */ private static final int CIPHER_KEY_BITS = 128; /** The number of bits for the GCM tag. */ private static final int GCM_TAG_BITS = 128; /** The cipher used to encrypt the keystore data. */ private static final String CIPHER_ALGO = "AES"; /** The mode used with the cipher algorithm. */ private static final String CIPHER_MODE = "GCM"; /** The padding used with the cipher algorithm. */ private static final String CIPHER_PADDING = "NoPadding"; // format version changelog: // 1: initial version, ES 5.3 // 2: file setting, ES 5.4 // 3: FIPS compliant algos, ES 6.3 // 4: remove distinction between string/files, ES 6.8/7.1 /** The metadata format version used to read the current keystore wrapper. */ private final int formatVersion; /** True iff the keystore has a password needed to read. */ private final boolean hasPassword; /** The raw bytes of the encrypted keystore. */ private final byte[] dataBytes; /** The decrypted secret data. See {@link #decrypt(char[])}. */ private final SetOnce<Map<String, byte[]>> entries = new SetOnce<>(); private volatile boolean closed; private KeyStoreWrapper(int formatVersion, boolean hasPassword, byte[] dataBytes) { this.formatVersion = formatVersion; this.hasPassword = hasPassword; this.dataBytes = dataBytes; } /** * Get the metadata format version for the keystore **/ public int getFormatVersion() { return formatVersion; } /** Returns a path representing the ES keystore in the given config dir. */ public static Path keystorePath(Path configDir) { return configDir.resolve(KEYSTORE_FILENAME); } /** Constructs a new keystore with the given password. */ public static KeyStoreWrapper create() { KeyStoreWrapper wrapper = new KeyStoreWrapper(FORMAT_VERSION, false, null); wrapper.entries.set(new HashMap<>()); addBootstrapSeed(wrapper); return wrapper; } /** Add the bootstrap seed setting, which may be used as a unique, secure, random value by the node */ public static void addBootstrapSeed(KeyStoreWrapper wrapper) { assert wrapper.getSettingNames().contains(SEED_SETTING.getKey()) == false; SecureRandom random = Randomness.createSecure(); int passwordLength = 20; // Generate 20 character passwords char[] characters = new char[passwordLength]; for (int i = 0; i < passwordLength; ++i) { characters[i] = SEED_CHARS[random.nextInt(SEED_CHARS.length)]; } wrapper.setString(SEED_SETTING.getKey(), characters); Arrays.fill(characters, (char)0); } /** * Loads information about the Elasticsearch keystore from the provided config directory. * * {@link #decrypt(char[])} must be called before reading or writing any entries. * Returns {@code null} if no keystore exists. */ public static KeyStoreWrapper load(Path configDir) throws IOException { Path keystoreFile = keystorePath(configDir); if (Files.exists(keystoreFile) == false) { return null; } SimpleFSDirectory directory = new SimpleFSDirectory(configDir); try (IndexInput indexInput = directory.openInput(KEYSTORE_FILENAME, IOContext.READONCE)) { ChecksumIndexInput input = new BufferedChecksumIndexInput(indexInput); final int formatVersion; try { formatVersion = CodecUtil.checkHeader(input, KEYSTORE_FILENAME, MIN_FORMAT_VERSION, FORMAT_VERSION); } catch (IndexFormatTooOldException e) { throw new IllegalStateException("The Elasticsearch keystore [" + keystoreFile + "] format is too old. " + "You should delete and recreate it in order to upgrade.", e); } catch (IndexFormatTooNewException e) { throw new IllegalStateException("The Elasticsearch keystore [" + keystoreFile + "] format is too new. " + "Are you trying to downgrade? You should delete and recreate it in order to downgrade.", e); } byte hasPasswordByte = input.readByte(); boolean hasPassword = hasPasswordByte == 1; if (hasPassword == false && hasPasswordByte != 0) { throw new IllegalStateException("hasPassword boolean is corrupt: " + String.format(Locale.ROOT, "%02x", hasPasswordByte)); } if (formatVersion <= 2) { String type = input.readString(); if (type.equals("PKCS12") == false) { throw new IllegalStateException("Corrupted legacy keystore string encryption algorithm"); } final String stringKeyAlgo = input.readString(); if (stringKeyAlgo.equals("PBE") == false) { throw new IllegalStateException("Corrupted legacy keystore string encryption algorithm"); } if (formatVersion == 2) { final String fileKeyAlgo = input.readString(); if (fileKeyAlgo.equals("PBE") == false) { throw new IllegalStateException("Corrupted legacy keystore file encryption algorithm"); } } } final byte[] dataBytes; if (formatVersion == 2) { // For v2 we had a map of strings containing the types for each setting. In v3 this map is now // part of the encrypted bytes. Unfortunately we cannot seek backwards with checksum input, so // we cannot just read the map and find out how long it is. So instead we read the map and // store it back using java's builtin DataOutput in a byte array, along with the actual keystore bytes Map<String, String> settingTypes = input.readMapOfStrings(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try (DataOutputStream output = new DataOutputStream(bytes)) { output.writeInt(settingTypes.size()); for (Map.Entry<String, String> entry : settingTypes.entrySet()) { output.writeUTF(entry.getKey()); output.writeUTF(entry.getValue()); } int keystoreLen = input.readInt(); byte[] keystoreBytes = new byte[keystoreLen]; input.readBytes(keystoreBytes, 0, keystoreLen); output.write(keystoreBytes); } dataBytes = bytes.toByteArray(); } else { int dataBytesLen = input.readInt(); dataBytes = new byte[dataBytesLen]; input.readBytes(dataBytes, 0, dataBytesLen); } CodecUtil.checkFooter(input); return new KeyStoreWrapper(formatVersion, hasPassword, dataBytes); } } /** Upgrades the format of the keystore, if necessary. */ public static void upgrade(KeyStoreWrapper wrapper, Path configDir, char[] password) throws Exception { if (wrapper.getFormatVersion() == FORMAT_VERSION && wrapper.getSettingNames().contains(SEED_SETTING.getKey())) { return; } // add keystore.seed if necessary if (wrapper.getSettingNames().contains(SEED_SETTING.getKey()) == false) { addBootstrapSeed(wrapper); } wrapper.save(configDir, password); } @Override public boolean isLoaded() { return entries.get() != null; } /** Return true iff calling {@link #decrypt(char[])} requires a non-empty password. */ public boolean hasPassword() { return hasPassword; } private Cipher createCipher(int opmode, char[] password, byte[] salt, byte[] iv) throws GeneralSecurityException { PBEKeySpec keySpec = new PBEKeySpec(password, salt, KDF_ITERS, CIPHER_KEY_BITS); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(KDF_ALGO); SecretKey secretKey = keyFactory.generateSecret(keySpec); SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), CIPHER_ALGO); GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_BITS, iv); Cipher cipher = Cipher.getInstance(CIPHER_ALGO + "/" + CIPHER_MODE + "/" + CIPHER_PADDING); cipher.init(opmode, secret, spec); cipher.updateAAD(salt); return cipher; } /** * Decrypts the underlying keystore data. * * This may only be called once. */ public void decrypt(char[] password) throws GeneralSecurityException, IOException { if (entries.get() != null) { throw new IllegalStateException("Keystore has already been decrypted"); } if (formatVersion <= 2) { decryptLegacyEntries(); if (password.length != 0) { throw new IllegalArgumentException("Keystore format does not accept non-empty passwords"); } return; } final byte[] salt; final byte[] iv; final byte[] encryptedBytes; try (ByteArrayInputStream bytesStream = new ByteArrayInputStream(dataBytes); DataInputStream input = new DataInputStream(bytesStream)) { int saltLen = input.readInt(); salt = new byte[saltLen]; input.readFully(salt); int ivLen = input.readInt(); iv = new byte[ivLen]; input.readFully(iv); int encryptedLen = input.readInt(); encryptedBytes = new byte[encryptedLen]; input.readFully(encryptedBytes); if (input.read() != -1) { throw new SecurityException("Keystore has been corrupted or tampered with"); } } catch (EOFException e) { throw new SecurityException("Keystore has been corrupted or tampered with", e); } Cipher cipher = createCipher(Cipher.DECRYPT_MODE, password, salt, iv); try (ByteArrayInputStream bytesStream = new ByteArrayInputStream(encryptedBytes); CipherInputStream cipherStream = new CipherInputStream(bytesStream, cipher); DataInputStream input = new DataInputStream(cipherStream)) { entries.set(new HashMap<>()); int numEntries = input.readInt(); while (numEntries-- > 0) { String setting = input.readUTF(); if (formatVersion == 3) { // legacy, the keystore format would previously store the entry type input.readUTF(); } int entrySize = input.readInt(); byte[] entryBytes = new byte[entrySize]; input.readFully(entryBytes); entries.get().put(setting, entryBytes); } if (input.read() != -1) { throw new SecurityException("Keystore has been corrupted or tampered with"); } } catch (IOException e) { throw new SecurityException("Keystore has been corrupted or tampered with", e); } } /** Encrypt the keystore entries and return the encrypted data. */ private byte[] encrypt(char[] password, byte[] salt, byte[] iv) throws GeneralSecurityException, IOException { assert isLoaded(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); Cipher cipher = createCipher(Cipher.ENCRYPT_MODE, password, salt, iv); try (CipherOutputStream cipherStream = new CipherOutputStream(bytes, cipher); DataOutputStream output = new DataOutputStream(cipherStream)) { output.writeInt(entries.get().size()); for (Map.Entry<String, byte[]> mapEntry : entries.get().entrySet()) { output.writeUTF(mapEntry.getKey()); byte[] entry = mapEntry.getValue(); output.writeInt(entry.length); output.write(entry); } } return bytes.toByteArray(); } private void decryptLegacyEntries() throws GeneralSecurityException, IOException { // v1 and v2 keystores never had passwords actually used, so we always use an empty password KeyStore keystore = KeyStore.getInstance("PKCS12"); Map<String, EntryType> settingTypes = new HashMap<>(); ByteArrayInputStream inputBytes = new ByteArrayInputStream(dataBytes); try (DataInputStream input = new DataInputStream(inputBytes)) { // first read the setting types map if (formatVersion == 2) { int numSettings = input.readInt(); for (int i = 0; i < numSettings; ++i) { String key = input.readUTF(); String value = input.readUTF(); settingTypes.put(key, EntryType.valueOf(value)); } } // then read the actual keystore keystore.load(input, "".toCharArray()); } // verify the settings metadata matches the keystore entries Enumeration<String> aliases = keystore.aliases(); if (formatVersion == 1) { while (aliases.hasMoreElements()) { settingTypes.put(aliases.nextElement(), EntryType.STRING); } } else { // verify integrity: keys in keystore match what the metadata thinks exist Set<String> expectedSettings = new HashSet<>(settingTypes.keySet()); while (aliases.hasMoreElements()) { String settingName = aliases.nextElement(); if (expectedSettings.remove(settingName) == false) { throw new SecurityException("Keystore has been corrupted or tampered with"); } } if (expectedSettings.isEmpty() == false) { throw new SecurityException("Keystore has been corrupted or tampered with"); } } // fill in the entries now that we know all the types to expect this.entries.set(new HashMap<>()); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBE"); KeyStore.PasswordProtection password = new KeyStore.PasswordProtection("".toCharArray()); for (Map.Entry<String, EntryType> settingEntry : settingTypes.entrySet()) { String setting = settingEntry.getKey(); EntryType settingType = settingEntry.getValue(); KeyStore.SecretKeyEntry keystoreEntry = (KeyStore.SecretKeyEntry) keystore.getEntry(setting, password); PBEKeySpec keySpec = (PBEKeySpec) keyFactory.getKeySpec(keystoreEntry.getSecretKey(), PBEKeySpec.class); char[] chars = keySpec.getPassword(); keySpec.clearPassword(); final byte[] bytes; if (settingType == EntryType.STRING) { ByteBuffer byteBuffer = StandardCharsets.UTF_8.encode(CharBuffer.wrap(chars)); bytes = Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit()); Arrays.fill(byteBuffer.array(), (byte)0); } else { assert settingType == EntryType.FILE; // The PBE keyspec gives us chars, we convert to bytes byte[] tmpBytes = new byte[chars.length]; for (int i = 0; i < tmpBytes.length; ++i) { tmpBytes[i] = (byte)chars[i]; // PBE only stores the lower 8 bits, so this narrowing is ok } bytes = Base64.getDecoder().decode(tmpBytes); Arrays.fill(tmpBytes, (byte)0); } Arrays.fill(chars, '\0'); entries.get().put(setting, bytes); } } /** Write the keystore to the given config directory. */ public synchronized void save(Path configDir, char[] password) throws Exception { ensureOpen(); SimpleFSDirectory directory = new SimpleFSDirectory(configDir); // write to tmp file first, then overwrite String tmpFile = KEYSTORE_FILENAME + ".tmp"; try (IndexOutput output = directory.createOutput(tmpFile, IOContext.DEFAULT)) { CodecUtil.writeHeader(output, KEYSTORE_FILENAME, FORMAT_VERSION); output.writeByte(password.length == 0 ? (byte)0 : (byte)1); // new cipher params SecureRandom random = Randomness.createSecure(); // use 64 bytes salt, which surpasses that recommended by OWASP // see https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet byte[] salt = new byte[64]; random.nextBytes(salt); // use 96 bits (12 bytes) for IV as recommended by NIST // see http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf section 5.2.1.1 byte[] iv = new byte[12]; random.nextBytes(iv); // encrypted data byte[] encryptedBytes = encrypt(password, salt, iv); // size of data block output.writeInt(4 + salt.length + 4 + iv.length + 4 + encryptedBytes.length); output.writeInt(salt.length); output.writeBytes(salt, salt.length); output.writeInt(iv.length); output.writeBytes(iv, iv.length); output.writeInt(encryptedBytes.length); output.writeBytes(encryptedBytes, encryptedBytes.length); CodecUtil.writeFooter(output); } catch (final AccessDeniedException e) { final String message = String.format( Locale.ROOT, "unable to create temporary keystore at [%s], please check filesystem permissions", configDir.resolve(tmpFile)); throw new UserException(ExitCodes.CONFIG, message, e); } Path keystoreFile = keystorePath(configDir); Files.move(configDir.resolve(tmpFile), keystoreFile, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); PosixFileAttributeView attrs = Files.getFileAttributeView(keystoreFile, PosixFileAttributeView.class); if (attrs != null) { // don't rely on umask: ensure the keystore has minimal permissions attrs.setPermissions(PosixFilePermissions.fromString("rw-rw----")); } } /** * It is possible to retrieve the setting names even if the keystore is closed. * This allows {@link SecureSetting} to correctly determine that a entry exists even though it cannot be read. Thus attempting to * read a secure setting after the keystore is closed will generate a "keystore is closed" exception rather than using the fallback * setting. */ @Override public Set<String> getSettingNames() { assert entries.get() != null : "Keystore is not loaded"; return entries.get().keySet(); } // TODO: make settings accessible only to code that registered the setting @Override public synchronized SecureString getString(String setting) { ensureOpen(); byte[] entry = entries.get().get(setting); ByteBuffer byteBuffer = ByteBuffer.wrap(entry); CharBuffer charBuffer = StandardCharsets.UTF_8.decode(byteBuffer); return new SecureString(charBuffer.array()); } @Override public synchronized InputStream getFile(String setting) { ensureOpen(); byte[] entry = entries.get().get(setting); return new ByteArrayInputStream(entry); } /** * Ensure the given setting name is allowed. * * @throws IllegalArgumentException if the setting name is not valid */ public static void validateSettingName(String setting) { if (ALLOWED_SETTING_NAME.matcher(setting).matches() == false) { throw new IllegalArgumentException("Setting name [" + setting + "] does not match the allowed setting name pattern [" + ALLOWED_SETTING_NAME.pattern() + "]"); } } /** Set a string setting. */ synchronized void setString(String setting, char[] value) { ensureOpen(); validateSettingName(setting); ByteBuffer byteBuffer = StandardCharsets.UTF_8.encode(CharBuffer.wrap(value)); byte[] bytes = Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit()); byte[] oldEntry = entries.get().put(setting, bytes); if (oldEntry != null) { Arrays.fill(oldEntry, (byte)0); } } /** Set a file setting. */ synchronized void setFile(String setting, byte[] bytes) { ensureOpen(); validateSettingName(setting); byte[] oldEntry = entries.get().put(setting, Arrays.copyOf(bytes, bytes.length)); if (oldEntry != null) { Arrays.fill(oldEntry, (byte)0); } } /** Remove the given setting from the keystore. */ void remove(String setting) { ensureOpen(); byte[] oldEntry = entries.get().remove(setting); if (oldEntry != null) { Arrays.fill(oldEntry, (byte)0); } } private void ensureOpen() { if (closed) { throw new IllegalStateException("Keystore is closed"); } assert isLoaded() : "Keystore is not loaded"; } @Override public synchronized void close() { this.closed = true; if (null != entries.get() && entries.get().isEmpty() == false) { for (byte[] entry : entries.get().values()) { Arrays.fill(entry, (byte) 0); } } } }
10,436
634
#pragma once #define VISIT_PROCS_VERSION(visit) \ visit(GetFileVersionInfoA, jmpaddr) \ visit(GetFileVersionInfoByHandle, jmpaddr) \ visit(GetFileVersionInfoExA, jmpaddr) \ visit(GetFileVersionInfoExW, jmpaddr) \ visit(GetFileVersionInfoSizeA, jmpaddr) \ visit(GetFileVersionInfoSizeExA, jmpaddr) \ visit(GetFileVersionInfoSizeExW, jmpaddr) \ visit(GetFileVersionInfoSizeW, jmpaddr) \ visit(GetFileVersionInfoW, jmpaddr) \ visit(VerFindFileA, jmpaddr) \ visit(VerFindFileW, jmpaddr) \ visit(VerInstallFileA, jmpaddr) \ visit(VerInstallFileW, jmpaddr) \ visit(VerLanguageNameA, jmpaddr) \ visit(VerLanguageNameW, jmpaddr) \ visit(VerQueryValueA, jmpaddr) \ visit(VerQueryValueW, jmpaddr) #ifdef PROC_CLASS PROC_CLASS(version, dll, VISIT_PROCS_VERSION, VISIT_PROCS_BLANK) #endif
336
12,710
{ "recurse": true, "properties": { "GomodMainOnly": true, "GomodExcludes": "_tests/|[-_]generators?$|^plugin/checker$", "NpmExcludes": "/e2e$", "GradlePath": "./gradlew:../gradlew" }, "filters": [ "release" ], "excludes": "/.git$|/node_modules$", "url": "https://deptrack.security.internal.mattermost.com/", "verbose": 3 }
164
1,858
<filename>soter-client-demo/app/src/main/java/com/tencent/soter/demo/model/SoterDemoData.java /* * Tencent is pleased to support the open source community by making TENCENT SOTER available. * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * https://opensource.org/licenses/BSD-3-Clause * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.tencent.soter.demo.model; import android.content.Context; import android.support.annotation.NonNull; import com.tencent.soter.core.model.ConstantsSoter; /** * Created by henryye on 2017/4/25. */ public class SoterDemoData { private static final String TAG = "SoterDemo.SoterDemoData"; private static final String DEMO_DISK_CACHE_SP = "DemoDiskCacheSp"; private static final String KEY_IS_FINGERPRINT_PAY_OPENED = "isFingerprintOpened"; private static final String KEY_IS_FACEID_PAY_OPENED = "isFaceidOpened"; private static SoterDemoData sInstance = null; private boolean isFingerprintPayOpened = false; private boolean isFaceidPayOpened = false; public static SoterDemoData getInstance() { if(sInstance == null) { synchronized (SoterDemoData.class) { if(sInstance == null) { sInstance = new SoterDemoData(); } return sInstance; } } else { return sInstance; } } public void init(@NonNull Context context) { isFingerprintPayOpened = context.getSharedPreferences(DEMO_DISK_CACHE_SP, Context.MODE_PRIVATE).getBoolean(KEY_IS_FINGERPRINT_PAY_OPENED, false); isFaceidPayOpened = context.getSharedPreferences(DEMO_DISK_CACHE_SP, Context.MODE_PRIVATE).getBoolean(KEY_IS_FACEID_PAY_OPENED, false); } public void setIsBiometricPayOpened(Context context, boolean isOpened, int biometricType) { switch (biometricType){ case ConstantsSoter.FINGERPRINT_AUTH:{ isFingerprintPayOpened = isOpened; context.getSharedPreferences(DEMO_DISK_CACHE_SP, Context.MODE_PRIVATE).edit(). putBoolean(KEY_IS_FINGERPRINT_PAY_OPENED, isOpened).apply(); break; } case ConstantsSoter.FACEID_AUTH:{ isFaceidPayOpened = isOpened; context.getSharedPreferences(DEMO_DISK_CACHE_SP, Context.MODE_PRIVATE).edit(). putBoolean(KEY_IS_FACEID_PAY_OPENED, isOpened).apply(); break; } } } public boolean getIsBiometricPayOpened(int biometricType) { switch (biometricType){ case ConstantsSoter.FINGERPRINT_AUTH: return isFingerprintPayOpened; case ConstantsSoter.FACEID_AUTH: return isFaceidPayOpened; } return false; } }
1,407
521
# Headers per version. headers = {} headers[4] = ( 'Qt/q3accel.h', 'Qt/q3action.h', 'Qt/q3asciicache.h', 'Qt/q3asciidict.h', 'Qt/q3boxlayout.h', 'Qt/q3buttongroup.h', 'Qt/q3button.h', 'Qt/q3cache.h', 'Qt/q3canvas.h', 'Qt/q3cleanuphandler.h', 'Qt/q3combobox.h', 'Qt/q3cstring.h', 'Qt/q3databrowser.h', 'Qt/q3datatable.h', 'Qt/q3dataview.h', 'Qt/q3datetimeedit.h', 'Qt/q3deepcopy.h', 'Qt/q3dict.h', 'Qt/q3dns.h', 'Qt/q3dockarea.h', 'Qt/q3dockwindow.h', 'Qt/q3dragobject.h', 'Qt/q3dropsite.h', 'Qt/q3editorfactory.h', 'Qt/q3filedialog.h', 'Qt/q3frame.h', 'Qt/q3ftp.h', 'Qt/q3garray.h', 'Qt/q3gcache.h', 'Qt/q3gdict.h', 'Qt/q3glist.h', 'Qt/q3grid.h', 'Qt/q3gridlayout.h', 'Qt/q3gridview.h', 'Qt/q3groupbox.h', 'Qt/q3gvector.h', 'Qt/q3hbox.h', 'Qt/q3header.h', 'Qt/q3hgroupbox.h', 'Qt/q3http.h', 'Qt/q3iconview.h', 'Qt/q3intcache.h', 'Qt/q3intdict.h', 'Qt/q3listbox.h', 'Qt/q3listview.h', 'Qt/q3localfs.h', 'Qt/q3mainwindow.h', 'Qt/q3memarray.h', 'Qt/q3mimefactory.h', 'Qt/q3multilineedit.h', 'Qt/q3network.h', 'Qt/q3networkprotocol.h', 'Qt/q3objectdict.h', 'Qt/q3paintdevicemetrics.h', 'Qt/q3painter.h', 'Qt/q3picture.h', 'Qt/q3pointarray.h', 'Qt/q3polygonscanner.h', 'Qt/q3popupmenu.h', 'Qt/q3process.h', 'Qt/q3progressbar.h', 'Qt/q3progressdialog.h', 'Qt/q3ptrcollection.h', 'Qt/q3ptrdict.h', 'Qt/q3ptrlist.h', 'Qt/q3ptrqueue.h', 'Qt/q3ptrstack.h', 'Qt/q3ptrvector.h', 'Qt/q3rangecontrol.h', 'Qt/q3scrollview.h', 'Qt/q3semaphore.h', 'Qt/q3serversocket.h', 'Qt/q3shared.h', 'Qt/q3signal.h', 'Qt/q3simplerichtext.h', 'Qt/q3socketdevice.h', 'Qt/q3socket.h', 'Qt/q3sortedlist.h', 'Qt/q3sqlcursor.h', 'Qt/q3sqleditorfactory.h', 'Qt/q3sqlfieldinfo.h', 'Qt/q3sqlform.h', 'Qt/q3sqlpropertymap.h', 'Qt/q3sqlrecordinfo.h', 'Qt/q3sqlselectcursor.h', 'Qt/q3strlist.h', 'Qt/q3strvec.h', 'Qt/q3stylesheet.h', 'Qt/q3syntaxhighlighter.h', 'Qt/q3tabdialog.h', 'Qt/q3table.h', 'Qt/q3textbrowser.h', 'Qt/q3textedit.h', 'Qt/q3textstream.h', 'Qt/q3textview.h', 'Qt/q3tl.h', 'Qt/q3toolbar.h', 'Qt/q3url.h', 'Qt/q3urloperator.h', 'Qt/q3valuelist.h', 'Qt/q3valuestack.h', 'Qt/q3valuevector.h', 'Qt/q3vbox.h', 'Qt/q3vgroupbox.h', 'Qt/q3whatsthis.h', 'Qt/q3widgetstack.h', 'Qt/q3wizard.h', 'Qt/qabstractanimation.h', 'Qt/qabstractbutton.h', 'Qt/qabstracteventdispatcher.h', 'Qt/qabstractfileengine.h', 'Qt/qabstractfontengine_qws.h', 'Qt/qabstractitemdelegate.h', 'Qt/qabstractitemmodel.h', 'Qt/qabstractitemview.h', 'Qt/qabstractmessagehandler.h', 'Qt/qabstractnetworkcache.h', 'Qt/qabstractpagesetupdialog.h', 'Qt/qabstractprintdialog.h', 'Qt/qabstractproxymodel.h', 'Qt/qabstractscrollarea.h', 'Qt/qabstractslider.h', 'Qt/qabstractsocket.h', 'Qt/qabstractspinbox.h', 'Qt/qabstractstate.h', 'Qt/qabstracttextdocumentlayout.h', 'Qt/qabstracttransition.h', 'Qt/qabstracturiresolver.h', 'Qt/qabstractvideobuffer.h', 'Qt/qabstractvideosurface.h', 'Qt/qabstractxmlnodemodel.h', 'Qt/qabstractxmlreceiver.h', 'Qt/qaccessible2.h', 'Qt/qaccessiblebridge.h', 'Qt/qaccessible.h', 'Qt/qaccessibleobject.h', 'Qt/qaccessibleplugin.h', 'Qt/qaccessiblewidget.h', 'Qt/qactiongroup.h', 'Qt/qaction.h', 'Qt/qalgorithms.h', 'Qt/qanimationgroup.h', 'Qt/qapplication.h', 'Qt/qatomic_alpha.h', 'Qt/qatomic_arch.h', 'Qt/qatomic_arm.h', 'Qt/qatomic_armv5.h', 'Qt/qatomic_armv6.h', 'Qt/qatomic_armv7.h', 'Qt/qatomic_avr32.h', 'Qt/qatomic_bfin.h', 'Qt/qatomic_bootstrap.h', 'Qt/qatomic_generic.h', 'Qt/qatomic.h', 'Qt/qatomic_i386.h', 'Qt/qatomic_ia64.h', 'Qt/qatomic_integrity.h', 'Qt/qatomic_m68k.h', 'Qt/qatomic_macosx.h', 'Qt/qatomic_mips.h', 'Qt/qatomic_parisc.h', 'Qt/qatomic_powerpc.h', 'Qt/qatomic_s390.h', 'Qt/qatomic_sh4a.h', 'Qt/qatomic_sh.h', 'Qt/qatomic_sparc.h', 'Qt/qatomic_symbian.h', 'Qt/qatomic_vxworks.h', 'Qt/qatomic_windowsce.h', 'Qt/qatomic_windows.h', 'Qt/qatomic_x86_64.h', 'Qt/qaudiodeviceinfo.h', 'Qt/qaudioengine.h', 'Qt/qaudioengineplugin.h', 'Qt/qaudioformat.h', 'Qt/qaudio.h', 'Qt/qaudioinput.h', 'Qt/qaudiooutput.h', 'Qt/qauthenticator.h', 'Qt/qbasicatomic.h', 'Qt/qbasictimer.h', 'Qt/qbenchmark.h', 'Qt/qbenchmarkmetric.h', 'Qt/qbitarray.h', 'Qt/qbitmap.h', 'Qt/qboxlayout.h', 'Qt/qbrush.h', 'Qt/qbuffer.h', 'Qt/qbuttongroup.h', 'Qt/qbytearray.h', 'Qt/qbytearraymatcher.h', 'Qt/qcache.h', 'Qt/qcalendarwidget.h', 'Qt/qcdestyle.h', 'Qt/qchar.h', 'Qt/qcheckbox.h', 'Qt/qcleanlooksstyle.h', 'Qt/qclipboard.h', 'Qt/qcolordialog.h', 'Qt/qcolor.h', 'Qt/qcolormap.h', 'Qt/qcolumnview.h', 'Qt/qcombobox.h', 'Qt/qcommandlinkbutton.h', 'Qt/qcommonstyle.h', 'Qt/qcompleter.h', 'Qt/qconfig-dist.h', 'Qt/qconfig.h', 'Qt/qconfig-large.h', 'Qt/qconfig-medium.h', 'Qt/qconfig-minimal.h', 'Qt/qconfig-nacl.h', 'Qt/qconfig-small.h', 'Qt/qcontainerfwd.h', 'Qt/qcontiguouscache.h', 'Qt/qcopchannel_qws.h', 'Qt/qcoreapplication.h', 'Qt/qcoreevent.h', 'Qt/qcryptographichash.h', 'Qt/qcursor.h', 'Qt/qdatastream.h', 'Qt/qdatawidgetmapper.h', 'Qt/qdatetimeedit.h', 'Qt/qdatetime.h', 'Qt/qdebug.h', 'Qt/qdeclarativecomponent.h', 'Qt/qdeclarativecontext.h', 'Qt/qdeclarativedebug.h', 'Qt/qdeclarativeengine.h', 'Qt/qdeclarativeerror.h', 'Qt/qdeclarativeexpression.h', 'Qt/qdeclarativeextensioninterface.h', 'Qt/qdeclarativeextensionplugin.h', 'Qt/qdeclarative.h', 'Qt/qdeclarativeimageprovider.h', 'Qt/qdeclarativeinfo.h', 'Qt/qdeclarativeitem.h', 'Qt/qdeclarativelist.h', 'Qt/qdeclarativenetworkaccessmanagerfactory.h', 'Qt/qdeclarativeparserstatus.h', 'Qt/qdeclarativeprivate.h', 'Qt/qdeclarativeproperty.h', 'Qt/qdeclarativepropertymap.h', 'Qt/qdeclarativepropertyvalueinterceptor.h', 'Qt/qdeclarativepropertyvaluesource.h', 'Qt/qdeclarativescriptstring.h', 'Qt/qdeclarativeview.h', 'Qt/qdecorationdefault_qws.h', 'Qt/qdecorationfactory_qws.h', 'Qt/qdecorationplugin_qws.h', 'Qt/qdecoration_qws.h', 'Qt/qdecorationstyled_qws.h', 'Qt/qdecorationwindows_qws.h', 'Qt/qdesktopservices.h', 'Qt/qdesktopwidget.h', 'Qt/qdial.h', 'Qt/qdialogbuttonbox.h', 'Qt/qdialog.h', 'Qt/qdirectpainter_qws.h', 'Qt/qdir.h', 'Qt/qdiriterator.h', 'Qt/qdirmodel.h', 'Qt/qdockwidget.h', 'Qt/qdom.h', 'Qt/qdrag.h', 'Qt/qdrawutil.h', 'Qt/qeasingcurve.h', 'Qt/qelapsedtimer.h', 'Qt/qendian.h', 'Qt/qerrormessage.h', 'Qt/qevent.h', 'Qt/qeventloop.h', 'Qt/qeventtransition.h', 'Qt/qfactoryinterface.h', 'Qt/qfeatures.h', 'Qt/qfiledialog.h', 'Qt/qfile.h', 'Qt/qfileiconprovider.h', 'Qt/qfileinfo.h', 'Qt/qfilesystemmodel.h', 'Qt/qfilesystemwatcher.h', 'Qt/qfinalstate.h', 'Qt/qfocusframe.h', 'Qt/qfontcombobox.h', 'Qt/qfontdatabase.h', 'Qt/qfontdialog.h', 'Qt/qfont.h', 'Qt/qfontinfo.h', 'Qt/qfontmetrics.h', 'Qt/qformlayout.h', 'Qt/qframe.h', 'Qt/qfsfileengine.h', 'Qt/qftp.h', 'Qt/qfunctions_nacl.h', 'Qt/qfunctions_vxworks.h', 'Qt/qfunctions_wince.h', 'Qt/qfuture.h', 'Qt/qfutureinterface.h', 'Qt/qfuturesynchronizer.h', 'Qt/qfuturewatcher.h', 'Qt/qgenericmatrix.h', 'Qt/qgenericpluginfactory_qpa.h', 'Qt/qgenericplugin_qpa.h', 'Qt/qgesture.h', 'Qt/qgesturerecognizer.h', 'Qt/qglobal.h', 'Qt/qglyphrun.h', 'Qt/qgraphicsanchorlayout.h', 'Qt/qgraphicseffect.h', 'Qt/qgraphicsgridlayout.h', 'Qt/qgraphicsitemanimation.h', 'Qt/qgraphicsitem.h', 'Qt/qgraphicslayout.h', 'Qt/qgraphicslayoutitem.h', 'Qt/qgraphicslinearlayout.h', 'Qt/qgraphicsproxywidget.h', 'Qt/qgraphicssceneevent.h', 'Qt/qgraphicsscene.h', 'Qt/qgraphicstransform.h', 'Qt/qgraphicsview.h', 'Qt/qgraphicswebview.h', 'Qt/qgraphicswidget.h', 'Qt/qgridlayout.h', 'Qt/qgroupbox.h', 'Qt/qgtkstyle.h', 'Qt/qguifunctions_wince.h', 'Qt/qhash.h', 'Qt/qheaderview.h', 'Qt/qhistorystate.h', 'Qt/qhostaddress.h', 'Qt/qhostinfo.h', 'Qt/qhttp.h', 'Qt/qhttpmultipart.h', 'Qt/qiconengine.h', 'Qt/qiconengineplugin.h', 'Qt/qicon.h', 'Qt/qiconset.h', 'Qt/qidentityproxymodel.h', 'Qt/qimage.h', 'Qt/qimageiohandler.h', 'Qt/qimagereader.h', 'Qt/qimagewriter.h', 'Qt/qinputcontextfactory.h', 'Qt/qinputcontext.h', 'Qt/qinputcontextplugin.h', 'Qt/qinputdialog.h', 'Qt/qiodevice.h', 'Qt/qitemdelegate.h', 'Qt/qitemeditorfactory.h', 'Qt/qitemselectionmodel.h', 'Qt/qiterator.h', 'Qt/qkbddriverfactory_qws.h', 'Qt/qkbddriverplugin_qws.h', 'Qt/qkbdintegrity_qws.h', 'Qt/qkbdqnx_qws.h', 'Qt/qkbd_qws.h', 'Qt/qkbdtty_qws.h', 'Qt/qkbdum_qws.h', 'Qt/qkbdvfb_qws.h', 'Qt/qkeyeventtransition.h', 'Qt/qkeysequence.h', 'Qt/qlabel.h', 'Qt/qlayout.h', 'Qt/qlayoutitem.h', 'Qt/qlcdnumber.h', 'Qt/qlibrary.h', 'Qt/qlibraryinfo.h', 'Qt/qlineedit.h', 'Qt/qline.h', 'Qt/qlinkedlist.h', 'Qt/qlist.h', 'Qt/qlistview.h', 'Qt/qlistwidget.h', 'Qt/qlocale_blackberry.h', 'Qt/qlocale.h', 'Qt/qlocalserver.h', 'Qt/qlocalsocket.h', 'Qt/qmaccocoaviewcontainer_mac.h', 'Qt/qmacdefines_mac.h', 'Qt/qmacnativewidget_mac.h', 'Qt/qmacstyle_mac.h', 'Qt/qmainwindow.h', 'Qt/qmap.h', 'Qt/qmargins.h', 'Qt/qmath.h', 'Qt/qmatrix4x4.h', 'Qt/qmatrix.h', 'Qt/qmdiarea.h', 'Qt/qmdisubwindow.h', 'Qt/qmenubar.h', 'Qt/qmenudata.h', 'Qt/qmenu.h', 'Qt/qmessagebox.h', 'Qt/qmetaobject.h', 'Qt/qmetatype.h', 'Qt/qmimedata.h', 'Qt/qmime.h', 'Qt/qmotifstyle.h', 'Qt/qmousedriverfactory_qws.h', 'Qt/qmousedriverplugin_qws.h', 'Qt/qmouseeventtransition.h', 'Qt/qmouseintegrity_qws.h', 'Qt/qmousepc_qws.h', 'Qt/qmouseqnx_qws.h', 'Qt/qmouse_qws.h', 'Qt/qmousetslib_qws.h', 'Qt/qmousevfb_qws.h', 'Qt/qmovie.h', 'Qt/qmutex.h', 'Qt/qnamespace.h', 'Qt/qnetworkaccessmanager.h', 'Qt/qnetworkconfigmanager.h', 'Qt/qnetworkconfiguration.h', 'Qt/qnetworkcookie.h', 'Qt/qnetworkcookiejar.h', 'Qt/qnetworkdiskcache.h', 'Qt/qnetworkfunctions_wince.h', 'Qt/qnetworkinterface.h', 'Qt/qnetworkproxy.h', 'Qt/qnetworkreply.h', 'Qt/qnetworkrequest.h', 'Qt/qnetworksession.h', 'Qt/qnumeric.h', 'Qt/qobjectcleanuphandler.h', 'Qt/qobjectdefs.h', 'Qt/qobject.h', 'Qt/qpagesetupdialog.h', 'Qt/qpaintdevice.h', 'Qt/qpaintengine.h', 'Qt/qpainter.h', 'Qt/qpainterpath.h', 'Qt/qpair.h', 'Qt/qpalette.h', 'Qt/qparallelanimationgroup.h', 'Qt/qpauseanimation.h', 'Qt/qpen.h', 'Qt/qpictureformatplugin.h', 'Qt/qpicture.h', 'Qt/qpixmapcache.h', 'Qt/qpixmap.h', 'Qt/qplaintextedit.h', 'Qt/qplastiquestyle.h', 'Qt/qplatformclipboard_qpa.h', 'Qt/qplatformcursor_qpa.h', 'Qt/qplatformeventloopintegration_qpa.h', 'Qt/qplatformfontdatabase_qpa.h', 'Qt/qplatformglcontext_qpa.h', 'Qt/qplatformintegrationplugin_qpa.h', 'Qt/qplatformintegration_qpa.h', 'Qt/qplatformnativeinterface_qpa.h', 'Qt/qplatformscreen_qpa.h', 'Qt/qplatformwindowformat_qpa.h', 'Qt/qplatformwindow_qpa.h', 'Qt/qplugin.h', 'Qt/qpluginloader.h', 'Qt/qpointer.h', 'Qt/qpoint.h', 'Qt/qpolygon.h', 'Qt/qprintdialog.h', 'Qt/qprintengine.h', 'Qt/qprinter.h', 'Qt/qprinterinfo.h', 'Qt/qprintpreviewdialog.h', 'Qt/qprintpreviewwidget.h', 'Qt/qprocess.h', 'Qt/qprogressbar.h', 'Qt/qprogressdialog.h', 'Qt/qpropertyanimation.h', 'Qt/qproxymodel.h', 'Qt/qproxystyle.h', 'Qt/qpushbutton.h', 'Qt/qquaternion.h', 'Qt/qqueue.h', 'Qt/qradiobutton.h', 'Qt/qrawfont.h', 'Qt/qreadwritelock.h', 'Qt/qrect.h', 'Qt/qregexp.h', 'Qt/qregion.h', 'Qt/qresource.h', 'Qt/qrgb.h', 'Qt/qrubberband.h', 'Qt/qrunnable.h', 'Qt/qs60mainapplication.h', 'Qt/qs60mainappui.h', 'Qt/qs60maindocument.h', 'Qt/qs60style.h', 'Qt/qscopedpointer.h', 'Qt/qscopedvaluerollback.h', 'Qt/qscreendriverfactory_qws.h', 'Qt/qscreendriverplugin_qws.h', 'Qt/qscreenintegrityfb_qws.h', 'Qt/qscreenproxy_qws.h', 'Qt/qscreenqnx_qws.h', 'Qt/qscreen_qws.h', 'Qt/qscreentransformed_qws.h', 'Qt/qscreenvfb_qws.h', 'Qt/qscriptable.h', 'Qt/qscriptclass.h', 'Qt/qscriptclasspropertyiterator.h', 'Qt/qscriptcontext.h', 'Qt/qscriptcontextinfo.h', 'Qt/qscriptengineagent.h', 'Qt/qscriptenginedebugger.h', 'Qt/qscriptengine.h', 'Qt/qscriptextensioninterface.h', 'Qt/qscriptextensionplugin.h', 'Qt/qscriptprogram.h', 'Qt/qscriptstring.h', 'Qt/qscriptvalue.h', 'Qt/qscriptvalueiterator.h', 'Qt/qscrollarea.h', 'Qt/qscrollbar.h', 'Qt/qsemaphore.h', 'Qt/qsequentialanimationgroup.h', 'Qt/qsessionmanager.h', 'Qt/qset.h', 'Qt/qsettings.h', 'Qt/qshareddata.h', 'Qt/qsharedmemory.h', 'Qt/qsharedpointer.h', 'Qt/qsharedpointer_impl.h', 'Qt/qshortcut.h', 'Qt/qsignalmapper.h', 'Qt/qsignalspy.h', 'Qt/qsignaltransition.h', 'Qt/qsimplexmlnodemodel.h', 'Qt/qsizegrip.h', 'Qt/qsize.h', 'Qt/qsizepolicy.h', 'Qt/qslider.h', 'Qt/qsocketnotifier.h', 'Qt/qsortfilterproxymodel.h', 'Qt/qsound.h', 'Qt/qsoundqss_qws.h', 'Qt/qsourcelocation.h', 'Qt/qspinbox.h', 'Qt/qsplashscreen.h', 'Qt/qsplitter.h', 'Qt/qsqldatabase.h', 'Qt/qsql_db2.h', 'Qt/qsqldriver.h', 'Qt/qsqldriverplugin.h', 'Qt/qsqlerror.h', 'Qt/qsqlfield.h', 'Qt/qsql.h', 'Qt/qsql_ibase.h', 'Qt/qsqlindex.h', 'Qt/qsql_mysql.h', 'Qt/qsql_oci.h', 'Qt/qsql_odbc.h', 'Qt/qsql_psql.h', 'Qt/qsqlquery.h', 'Qt/qsqlquerymodel.h', 'Qt/qsqlrecord.h', 'Qt/qsqlrelationaldelegate.h', 'Qt/qsqlrelationaltablemodel.h', 'Qt/qsqlresult.h', 'Qt/qsql_sqlite2.h', 'Qt/qsql_sqlite.h', 'Qt/qsql_symsql.h', 'Qt/qsqltablemodel.h', 'Qt/qsql_tds.h', 'Qt/qsslcertificate.h', 'Qt/qsslcipher.h', 'Qt/qsslconfiguration.h', 'Qt/qsslerror.h', 'Qt/qssl.h', 'Qt/qsslkey.h', 'Qt/qsslsocket.h', 'Qt/qstackedlayout.h', 'Qt/qstackedwidget.h', 'Qt/qstack.h', 'Qt/qstandarditemmodel.h', 'Qt/qstate.h', 'Qt/qstatemachine.h', 'Qt/qstatictext.h', 'Qt/qstatusbar.h', 'Qt/qstringbuilder.h', 'Qt/qstring.h', 'Qt/qstringlist.h', 'Qt/qstringlistmodel.h', 'Qt/qstringmatcher.h', 'Qt/qstyleditemdelegate.h', 'Qt/qstylefactory.h', 'Qt/qstyle.h', 'Qt/qstyleoption.h', 'Qt/qstylepainter.h', 'Qt/qstyleplugin.h', 'Qt/qsymbianevent.h', 'Qt/qsyntaxhighlighter.h', 'Qt/qsystemsemaphore.h', 'Qt/qsystemtrayicon.h', 'Qt/Qt3Support', 'Qt/qtabbar.h', 'Qt/qtableview.h', 'Qt/qtablewidget.h', 'Qt/qtabwidget.h', 'Qt/qtconcurrentcompilertest.h', 'Qt/qtconcurrentexception.h', 'Qt/qtconcurrentfilter.h', 'Qt/qtconcurrentfilterkernel.h', 'Qt/qtconcurrentfunctionwrappers.h', 'Qt/qtconcurrentiteratekernel.h', 'Qt/qtconcurrentmap.h', 'Qt/qtconcurrentmapkernel.h', 'Qt/qtconcurrentmedian.h', 'Qt/qtconcurrentreducekernel.h', 'Qt/qtconcurrentresultstore.h', 'Qt/qtconcurrentrunbase.h', 'Qt/qtconcurrentrun.h', 'Qt/qtconcurrentstoredfunctioncall.h', 'Qt/qtconcurrentthreadengine.h', 'Qt/QtCore', 'Qt/qtcpserver.h', 'Qt/qtcpsocket.h', 'Qt/QtDeclarative', 'Qt/qtemporaryfile.h', 'Qt/qtestaccessible.h', 'Qt/qtestassert.h', 'Qt/qtestbasicstreamer.h', 'Qt/qtestcase.h', 'Qt/qtestcoreelement.h', 'Qt/qtestcorelist.h', 'Qt/qtestdata.h', 'Qt/qtestelementattribute.h', 'Qt/qtestelement.h', 'Qt/qtestevent.h', 'Qt/qtesteventloop.h', 'Qt/qtestfilelogger.h', 'Qt/qtest_global.h', 'Qt/qtest_gui.h', 'Qt/qtest.h', 'Qt/qtestkeyboard.h', 'Qt/qtestlightxmlstreamer.h', 'Qt/qtestmouse.h', 'Qt/qtestspontaneevent.h', 'Qt/qtestsystem.h', 'Qt/qtesttouch.h', 'Qt/qtestxmlstreamer.h', 'Qt/qtestxunitstreamer.h', 'Qt/qtextboundaryfinder.h', 'Qt/qtextbrowser.h', 'Qt/qtextcodec.h', 'Qt/qtextcodecplugin.h', 'Qt/qtextcursor.h', 'Qt/qtextdocumentfragment.h', 'Qt/qtextdocument.h', 'Qt/qtextdocumentwriter.h', 'Qt/qtextedit.h', 'Qt/qtextformat.h', 'Qt/qtextlayout.h', 'Qt/qtextlist.h', 'Qt/qtextobject.h', 'Qt/qtextoption.h', 'Qt/qtextstream.h', 'Qt/qtexttable.h', 'Qt/qthread.h', 'Qt/qthreadpool.h', 'Qt/qthreadstorage.h', 'Qt/qtimeline.h', 'Qt/qtimer.h', 'Qt/QtMultimedia', 'Qt/QtNetwork', 'Qt/qtoolbar.h', 'Qt/qtoolbox.h', 'Qt/qtoolbutton.h', 'Qt/qtooltip.h', 'Qt/qtransform.h', 'Qt/qtranslator.h', 'Qt/qtransportauthdefs_qws.h', 'Qt/qtransportauth_qws.h', 'Qt/qtreeview.h', 'Qt/qtreewidget.h', 'Qt/qtreewidgetitemiterator.h', 'Qt/QtScript', 'Qt/QtScriptTools', 'Qt/QtSql', 'Qt/QtTest', 'Qt/QtWebKit', 'Qt/qt_windows.h', 'Qt/QtXml', 'Qt/QtXmlPatterns', 'Qt/qudpsocket.h', 'Qt/qundogroup.h', 'Qt/qundostack.h', 'Qt/qundoview.h', 'Qt/qurl.h', 'Qt/qurlinfo.h', 'Qt/quuid.h', 'Qt/qvalidator.h', 'Qt/qvariantanimation.h', 'Qt/qvariant.h', 'Qt/qvarlengtharray.h', 'Qt/qvector2d.h', 'Qt/qvector3d.h', 'Qt/qvector4d.h', 'Qt/qvector.h', 'Qt/qvfbhdr.h', 'Qt/qvideoframe.h', 'Qt/qvideosurfaceformat.h', 'Qt/qwaitcondition.h', 'Qt/qwebdatabase.h', 'Qt/qwebelement.h', 'Qt/qwebframe.h', 'Qt/qwebhistory.h', 'Qt/qwebhistoryinterface.h', 'Qt/qwebinspector.h', 'Qt/qwebkitglobal.h', 'Qt/qwebkitplatformplugin.h', 'Qt/qwebkitversion.h', 'Qt/qwebpage.h', 'Qt/qwebpluginfactory.h', 'Qt/qwebscriptworld.h', 'Qt/qwebsecurityorigin.h', 'Qt/qwebsettings.h', 'Qt/qwebview.h', 'Qt/qwhatsthis.h', 'Qt/qwidgetaction.h', 'Qt/qwidget.h', 'Qt/qwindowdefs.h', 'Qt/qwindowdefs_win.h', 'Qt/qwindowscestyle.h', 'Qt/qwindowsmobilestyle.h', 'Qt/qwindowsstyle.h', 'Qt/qwindowsvistastyle.h', 'Qt/qwindowsxpstyle.h', 'Qt/qwindowsysteminterface_qpa.h', 'Qt/qwindowsystem_qws.h', 'Qt/qwizard.h', 'Qt/qwmatrix.h', 'Qt/qworkspace.h', 'Qt/qwscursor_qws.h', 'Qt/qwsdisplay_qws.h', 'Qt/qwsembedwidget.h', 'Qt/qwsevent_qws.h', 'Qt/qwsmanager_qws.h', 'Qt/qwsproperty_qws.h', 'Qt/qwsprotocolitem_qws.h', 'Qt/qwssocket_qws.h', 'Qt/qwsutils_qws.h', 'Qt/qx11embed_x11.h', 'Qt/qx11info_x11.h', 'Qt/qxmlformatter.h', 'Qt/qxml.h', 'Qt/qxmlname.h', 'Qt/qxmlnamepool.h', 'Qt/qxmlquery.h', 'Qt/qxmlresultitems.h', 'Qt/qxmlschema.h', 'Qt/qxmlschemavalidator.h', 'Qt/qxmlserializer.h', 'Qt/qxmlstream.h', 'Qt3Support/Q3Accel', 'Qt3Support/q3accel.h', 'Qt3Support/Q3Action', 'Qt3Support/Q3ActionGroup', 'Qt3Support/q3action.h', 'Qt3Support/Q3AsciiBucket', 'Qt3Support/Q3AsciiCache', 'Qt3Support/q3asciicache.h', 'Qt3Support/Q3AsciiCacheIterator', 'Qt3Support/Q3AsciiDict', 'Qt3Support/q3asciidict.h', 'Qt3Support/Q3AsciiDictIterator', 'Qt3Support/Q3BaseBucket', 'Qt3Support/Q3BoxLayout', 'Qt3Support/q3boxlayout.h', 'Qt3Support/Q3Button', 'Qt3Support/Q3ButtonGroup', 'Qt3Support/q3buttongroup.h', 'Qt3Support/q3button.h', 'Qt3Support/Q3Cache', 'Qt3Support/q3cache.h', 'Qt3Support/Q3CacheIterator', 'Qt3Support/Q3Canvas', 'Qt3Support/Q3CanvasEllipse', 'Qt3Support/q3canvas.h', 'Qt3Support/Q3CanvasItem', 'Qt3Support/Q3CanvasItemList', 'Qt3Support/Q3CanvasLine', 'Qt3Support/Q3CanvasPixmap', 'Qt3Support/Q3CanvasPixmapArray', 'Qt3Support/Q3CanvasPolygon', 'Qt3Support/Q3CanvasPolygonalItem', 'Qt3Support/Q3CanvasRectangle', 'Qt3Support/Q3CanvasSpline', 'Qt3Support/Q3CanvasSprite', 'Qt3Support/Q3CanvasText', 'Qt3Support/Q3CanvasView', 'Qt3Support/Q3CheckListItem', 'Qt3Support/Q3CheckTableItem', 'Qt3Support/Q3CleanupHandler', 'Qt3Support/q3cleanuphandler.h', 'Qt3Support/Q3ColorDrag', 'Qt3Support/Q3ComboBox', 'Qt3Support/q3combobox.h', 'Qt3Support/Q3ComboTableItem', 'Qt3Support/Q3CString', 'Qt3Support/q3cstring.h', 'Qt3Support/Q3DataBrowser', 'Qt3Support/q3databrowser.h', 'Qt3Support/Q3DataTable', 'Qt3Support/q3datatable.h', 'Qt3Support/Q3DataView', 'Qt3Support/q3dataview.h', 'Qt3Support/Q3DateEdit', 'Qt3Support/Q3DateTimeEdit', 'Qt3Support/Q3DateTimeEditBase', 'Qt3Support/q3datetimeedit.h', 'Qt3Support/Q3DeepCopy', 'Qt3Support/q3deepcopy.h', 'Qt3Support/Q3Dict', 'Qt3Support/q3dict.h', 'Qt3Support/Q3DictIterator', 'Qt3Support/Q3Dns', 'Qt3Support/q3dns.h', 'Qt3Support/Q3DnsSocket', 'Qt3Support/Q3DockArea', 'Qt3Support/q3dockarea.h', 'Qt3Support/Q3DockAreaLayout', 'Qt3Support/Q3DockWindow', 'Qt3Support/q3dockwindow.h', 'Qt3Support/Q3DragObject', 'Qt3Support/q3dragobject.h', 'Qt3Support/Q3DropSite', 'Qt3Support/q3dropsite.h', 'Qt3Support/Q3EditorFactory', 'Qt3Support/q3editorfactory.h', 'Qt3Support/Q3FileDialog', 'Qt3Support/q3filedialog.h', 'Qt3Support/Q3FileIconProvider', 'Qt3Support/Q3FilePreview', 'Qt3Support/Q3Frame', 'Qt3Support/q3frame.h', 'Qt3Support/Q3Ftp', 'Qt3Support/q3ftp.h', 'Qt3Support/Q3GArray', 'Qt3Support/q3garray.h', 'Qt3Support/Q3GCache', 'Qt3Support/q3gcache.h', 'Qt3Support/Q3GCacheIterator', 'Qt3Support/Q3GDict', 'Qt3Support/q3gdict.h', 'Qt3Support/Q3GDictIterator', 'Qt3Support/Q3GList', 'Qt3Support/q3glist.h', 'Qt3Support/Q3GListIterator', 'Qt3Support/Q3GListStdIterator', 'Qt3Support/Q3Grid', 'Qt3Support/q3grid.h', 'Qt3Support/Q3GridLayout', 'Qt3Support/q3gridlayout.h', 'Qt3Support/Q3GridView', 'Qt3Support/q3gridview.h', 'Qt3Support/Q3GroupBox', 'Qt3Support/q3groupbox.h', 'Qt3Support/Q3GVector', 'Qt3Support/q3gvector.h', 'Qt3Support/Q3HBox', 'Qt3Support/q3hbox.h', 'Qt3Support/Q3HBoxLayout', 'Qt3Support/Q3HButtonGroup', 'Qt3Support/Q3Header', 'Qt3Support/q3header.h', 'Qt3Support/Q3HGroupBox', 'Qt3Support/q3hgroupbox.h', 'Qt3Support/Q3Http', 'Qt3Support/q3http.h', 'Qt3Support/Q3HttpHeader', 'Qt3Support/Q3HttpRequestHeader', 'Qt3Support/Q3HttpResponseHeader', 'Qt3Support/Q3IconDrag', 'Qt3Support/Q3IconDragItem', 'Qt3Support/Q3IconView', 'Qt3Support/q3iconview.h', 'Qt3Support/Q3IconViewItem', 'Qt3Support/Q3ImageDrag', 'Qt3Support/Q3IntBucket', 'Qt3Support/Q3IntCache', 'Qt3Support/q3intcache.h', 'Qt3Support/Q3IntCacheIterator', 'Qt3Support/Q3IntDict', 'Qt3Support/q3intdict.h', 'Qt3Support/Q3IntDictIterator', 'Qt3Support/Q3ListBox', 'Qt3Support/q3listbox.h', 'Qt3Support/Q3ListBoxItem', 'Qt3Support/Q3ListBoxPixmap', 'Qt3Support/Q3ListBoxText', 'Qt3Support/Q3ListView', 'Qt3Support/q3listview.h', 'Qt3Support/Q3ListViewItem', 'Qt3Support/Q3ListViewItemIterator', 'Qt3Support/Q3LNode', 'Qt3Support/Q3LocalFs', 'Qt3Support/q3localfs.h', 'Qt3Support/Q3MainWindow', 'Qt3Support/q3mainwindow.h', 'Qt3Support/Q3MemArray', 'Qt3Support/q3memarray.h', 'Qt3Support/q3mimefactory.h', 'Qt3Support/Q3MimeSourceFactory', 'Qt3Support/Q3MultiLineEdit', 'Qt3Support/q3multilineedit.h', 'Qt3Support/q3network.h', 'Qt3Support/Q3NetworkOperation', 'Qt3Support/Q3NetworkProtocol', 'Qt3Support/Q3NetworkProtocolDict', 'Qt3Support/Q3NetworkProtocolFactory', 'Qt3Support/Q3NetworkProtocolFactoryBase', 'Qt3Support/q3networkprotocol.h', 'Qt3Support/q3objectdict.h', 'Qt3Support/Q3ObjectDictionary', 'Qt3Support/Q3PaintDeviceMetrics', 'Qt3Support/q3paintdevicemetrics.h', 'Qt3Support/Q3Painter', 'Qt3Support/q3painter.h', 'Qt3Support/Q3Picture', 'Qt3Support/q3picture.h', 'Qt3Support/Q3PointArray', 'Qt3Support/q3pointarray.h', 'Qt3Support/Q3PolygonScanner', 'Qt3Support/q3polygonscanner.h', 'Qt3Support/Q3PopupMenu', 'Qt3Support/q3popupmenu.h', 'Qt3Support/Q3Process', 'Qt3Support/q3process.h', 'Qt3Support/Q3ProgressBar', 'Qt3Support/q3progressbar.h', 'Qt3Support/Q3ProgressDialog', 'Qt3Support/q3progressdialog.h', 'Qt3Support/Q3PtrBucket', 'Qt3Support/Q3PtrCollection', 'Qt3Support/q3ptrcollection.h', 'Qt3Support/Q3PtrDict', 'Qt3Support/q3ptrdict.h', 'Qt3Support/Q3PtrDictIterator', 'Qt3Support/Q3PtrList', 'Qt3Support/q3ptrlist.h', 'Qt3Support/Q3PtrListIterator', 'Qt3Support/Q3PtrListStdIterator', 'Qt3Support/Q3PtrQueue', 'Qt3Support/q3ptrqueue.h', 'Qt3Support/Q3PtrStack', 'Qt3Support/q3ptrstack.h', 'Qt3Support/Q3PtrVector', 'Qt3Support/q3ptrvector.h', 'Qt3Support/Q3RangeControl', 'Qt3Support/q3rangecontrol.h', 'Qt3Support/Q3ScrollView', 'Qt3Support/q3scrollview.h', 'Qt3Support/Q3Semaphore', 'Qt3Support/q3semaphore.h', 'Qt3Support/Q3ServerSocket', 'Qt3Support/q3serversocket.h', 'Qt3Support/Q3Shared', 'Qt3Support/q3shared.h', 'Qt3Support/Q3Signal', 'Qt3Support/q3signal.h', 'Qt3Support/Q3SimpleRichText', 'Qt3Support/q3simplerichtext.h', 'Qt3Support/Q3SingleCleanupHandler', 'Qt3Support/Q3Socket', 'Qt3Support/Q3SocketDevice', 'Qt3Support/q3socketdevice.h', 'Qt3Support/q3socket.h', 'Qt3Support/Q3SortedList', 'Qt3Support/q3sortedlist.h', 'Qt3Support/Q3SpinWidget', 'Qt3Support/Q3SqlCursor', 'Qt3Support/q3sqlcursor.h', 'Qt3Support/Q3SqlEditorFactory', 'Qt3Support/q3sqleditorfactory.h', 'Qt3Support/Q3SqlFieldInfo', 'Qt3Support/q3sqlfieldinfo.h', 'Qt3Support/Q3SqlFieldInfoList', 'Qt3Support/Q3SqlForm', 'Qt3Support/q3sqlform.h', 'Qt3Support/Q3SqlPropertyMap', 'Qt3Support/q3sqlpropertymap.h', 'Qt3Support/Q3SqlRecordInfo', 'Qt3Support/q3sqlrecordinfo.h', 'Qt3Support/Q3SqlSelectCursor', 'Qt3Support/q3sqlselectcursor.h', 'Qt3Support/Q3StoredDrag', 'Qt3Support/Q3StrIList', 'Qt3Support/Q3StringBucket', 'Qt3Support/Q3StrIVec', 'Qt3Support/Q3StrList', 'Qt3Support/q3strlist.h', 'Qt3Support/Q3StrListIterator', 'Qt3Support/Q3StrVec', 'Qt3Support/q3strvec.h', 'Qt3Support/Q3StyleSheet', 'Qt3Support/q3stylesheet.h', 'Qt3Support/Q3StyleSheetItem', 'Qt3Support/Q3SyntaxHighlighter', 'Qt3Support/q3syntaxhighlighter.h', 'Qt3Support/Q3TabDialog', 'Qt3Support/q3tabdialog.h', 'Qt3Support/Q3Table', 'Qt3Support/q3table.h', 'Qt3Support/Q3TableItem', 'Qt3Support/Q3TableSelection', 'Qt3Support/Q3TextBrowser', 'Qt3Support/q3textbrowser.h', 'Qt3Support/Q3TextDrag', 'Qt3Support/Q3TextEdit', 'Qt3Support/q3textedit.h', 'Qt3Support/Q3TextEditOptimPrivate', 'Qt3Support/Q3TextStream', 'Qt3Support/q3textstream.h', 'Qt3Support/Q3TextView', 'Qt3Support/q3textview.h', 'Qt3Support/Q3TimeEdit', 'Qt3Support/q3tl.h', 'Qt3Support/Q3ToolBar', 'Qt3Support/q3toolbar.h', 'Qt3Support/Q3TSFUNC', 'Qt3Support/Q3UriDrag', 'Qt3Support/Q3Url', 'Qt3Support/q3url.h', 'Qt3Support/Q3UrlOperator', 'Qt3Support/q3urloperator.h', 'Qt3Support/Q3ValueList', 'Qt3Support/Q3ValueListConstIterator', 'Qt3Support/q3valuelist.h', 'Qt3Support/Q3ValueListIterator', 'Qt3Support/Q3ValueStack', 'Qt3Support/q3valuestack.h', 'Qt3Support/Q3ValueVector', 'Qt3Support/q3valuevector.h', 'Qt3Support/Q3VBox', 'Qt3Support/q3vbox.h', 'Qt3Support/Q3VBoxLayout', 'Qt3Support/Q3VButtonGroup', 'Qt3Support/Q3VGroupBox', 'Qt3Support/q3vgroupbox.h', 'Qt3Support/Q3WhatsThis', 'Qt3Support/q3whatsthis.h', 'Qt3Support/Q3WidgetStack', 'Qt3Support/q3widgetstack.h', 'Qt3Support/Q3Wizard', 'Qt3Support/q3wizard.h', 'Qt3Support/qiconset.h', 'Qt3Support/Qt3Support', 'QtCore/QAbstractAnimation', 'QtCore/qabstractanimation.h', 'QtCore/QAbstractConcatenable', 'QtCore/QAbstractEventDispatcher', 'QtCore/qabstracteventdispatcher.h', 'QtCore/QAbstractFileEngine', 'QtCore/qabstractfileengine.h', 'QtCore/QAbstractFileEngineHandler', 'QtCore/QAbstractFileEngineIterator', 'QtCore/QAbstractItemModel', 'QtCore/qabstractitemmodel.h', 'QtCore/QAbstractListModel', 'QtCore/QAbstractState', 'QtCore/qabstractstate.h', 'QtCore/QAbstractTableModel', 'QtCore/QAbstractTransition', 'QtCore/qabstracttransition.h', 'QtCore/qalgorithms.h', 'QtCore/QAnimationDriver', 'QtCore/QAnimationGroup', 'QtCore/qanimationgroup.h', 'QtCore/QArgument', 'QtCore/qatomic_alpha.h', 'QtCore/qatomic_arch.h', 'QtCore/qatomic_arm.h', 'QtCore/qatomic_armv5.h', 'QtCore/qatomic_armv6.h', 'QtCore/qatomic_armv7.h', 'QtCore/qatomic_avr32.h', 'QtCore/qatomic_bfin.h', 'QtCore/qatomic_bootstrap.h', 'QtCore/qatomic_generic.h', 'QtCore/qatomic.h', 'QtCore/qatomic_i386.h', 'QtCore/qatomic_ia64.h', 'QtCore/QAtomicInt', 'QtCore/qatomic_integrity.h', 'QtCore/qatomic_m68k.h', 'QtCore/qatomic_macosx.h', 'QtCore/qatomic_mips.h', 'QtCore/qatomic_parisc.h', 'QtCore/QAtomicPointer', 'QtCore/qatomic_powerpc.h', 'QtCore/qatomic_s390.h', 'QtCore/qatomic_sh4a.h', 'QtCore/qatomic_sh.h', 'QtCore/qatomic_sparc.h', 'QtCore/qatomic_symbian.h', 'QtCore/qatomic_vxworks.h', 'QtCore/qatomic_windowsce.h', 'QtCore/qatomic_windows.h', 'QtCore/qatomic_x86_64.h', 'QtCore/qbasicatomic.h', 'QtCore/QBasicAtomicInt', 'QtCore/QBasicAtomicPointer', 'QtCore/QBasicTimer', 'QtCore/qbasictimer.h', 'QtCore/QBBSystemLocaleData', 'QtCore/QBitArray', 'QtCore/qbitarray.h', 'QtCore/QBitRef', 'QtCore/QBool', 'QtCore/QBuffer', 'QtCore/qbuffer.h', 'QtCore/QByteArray', 'QtCore/qbytearray.h', 'QtCore/QByteArrayMatcher', 'QtCore/qbytearraymatcher.h', 'QtCore/QByteRef', 'QtCore/QCache', 'QtCore/qcache.h', 'QtCore/QChar', 'QtCore/qchar.h', 'QtCore/QCharRef', 'QtCore/QChildEvent', 'QtCore/QConcatenable', 'QtCore/qconfig-dist.h', 'QtCore/qconfig.h', 'QtCore/qconfig-large.h', 'QtCore/qconfig-medium.h', 'QtCore/qconfig-minimal.h', 'QtCore/qconfig-nacl.h', 'QtCore/qconfig-small.h', 'QtCore/QConstString', 'QtCore/qcontainerfwd.h', 'QtCore/QContiguousCache', 'QtCore/QContiguousCacheData', 'QtCore/qcontiguouscache.h', 'QtCore/QContiguousCacheTypedData', 'QtCore/QCOORD', 'QtCore/QCoreApplication', 'QtCore/qcoreapplication.h', 'QtCore/qcoreevent.h', 'QtCore/QCryptographicHash', 'QtCore/qcryptographichash.h', 'QtCore/QCustomEvent', 'QtCore/QDataStream', 'QtCore/qdatastream.h', 'QtCore/QDate', 'QtCore/QDateTime', 'QtCore/qdatetime.h', 'QtCore/QDebug', 'QtCore/qdebug.h', 'QtCore/QDir', 'QtCore/qdir.h', 'QtCore/QDirIterator', 'QtCore/qdiriterator.h', 'QtCore/QDynamicPropertyChangeEvent', 'QtCore/QEasingCurve', 'QtCore/qeasingcurve.h', 'QtCore/QElapsedTimer', 'QtCore/qelapsedtimer.h', 'QtCore/qendian.h', 'QtCore/QEvent', 'QtCore/QEventLoop', 'QtCore/qeventloop.h', 'QtCore/QEventTransition', 'QtCore/qeventtransition.h', 'QtCore/QExplicitlySharedDataPointer', 'QtCore/QFactoryInterface', 'QtCore/qfactoryinterface.h', 'QtCore/qfeatures.h', 'QtCore/QFile', 'QtCore/qfile.h', 'QtCore/QFileInfo', 'QtCore/qfileinfo.h', 'QtCore/QFileInfoList', 'QtCore/QFileInfoListIterator', 'QtCore/QFileSystemWatcher', 'QtCore/qfilesystemwatcher.h', 'QtCore/QFinalState', 'QtCore/qfinalstate.h', 'QtCore/QFlag', 'QtCore/QFlags', 'QtCore/QForeachContainer', 'QtCore/QForeachContainerBase', 'QtCore/QFSFileEngine', 'QtCore/qfsfileengine.h', 'QtCore/qfunctions_nacl.h', 'QtCore/qfunctions_vxworks.h', 'QtCore/qfunctions_wince.h', 'QtCore/QFuture', 'QtCore/qfuture.h', 'QtCore/QFutureInterface', 'QtCore/QFutureInterfaceBase', 'QtCore/qfutureinterface.h', 'QtCore/QFutureIterator', 'QtCore/QFutureSynchronizer', 'QtCore/qfuturesynchronizer.h', 'QtCore/QFutureWatcher', 'QtCore/QFutureWatcherBase', 'QtCore/qfuturewatcher.h', 'QtCore/QGenericArgument', 'QtCore/QGenericReturnArgument', 'QtCore/qglobal.h', 'QtCore/QGlobalStatic', 'QtCore/QGlobalStaticDeleter', 'QtCore/QHash', 'QtCore/QHashData', 'QtCore/QHashDummyNode', 'QtCore/QHashDummyValue', 'QtCore/qhash.h', 'QtCore/QHashIterator', 'QtCore/QHashNode', 'QtCore/QHistoryState', 'QtCore/qhistorystate.h', 'QtCore/QIncompatibleFlag', 'QtCore/Q_INT16', 'QtCore/Q_INT32', 'QtCore/Q_INT64', 'QtCore/Q_INT8', 'QtCore/QIntegerForSize', 'QtCore/QInternal', 'QtCore/QIODevice', 'QtCore/qiodevice.h', 'QtCore/qiterator.h', 'QtCore/QLatin1Char', 'QtCore/QLatin1Literal', 'QtCore/QLatin1String', 'QtCore/QLibrary', 'QtCore/qlibrary.h', 'QtCore/QLibraryInfo', 'QtCore/qlibraryinfo.h', 'QtCore/QLine', 'QtCore/QLineF', 'QtCore/qline.h', 'QtCore/QLinkedList', 'QtCore/QLinkedListData', 'QtCore/qlinkedlist.h', 'QtCore/QLinkedListIterator', 'QtCore/QLinkedListNode', 'QtCore/QList', 'QtCore/QListData', 'QtCore/qlist.h', 'QtCore/QListIterator', 'QtCore/Q_LLONG', 'QtCore/QLocale', 'QtCore/qlocale_blackberry.h', 'QtCore/qlocale.h', 'QtCore/Q_LONG', 'QtCore/QMap', 'QtCore/QMapData', 'QtCore/qmap.h', 'QtCore/QMapIterator', 'QtCore/QMapNode', 'QtCore/QMapPayloadNode', 'QtCore/QMargins', 'QtCore/qmargins.h', 'QtCore/qmath.h', 'QtCore/QMetaClassInfo', 'QtCore/QMetaEnum', 'QtCore/QMetaMethod', 'QtCore/QMetaObject', 'QtCore/QMetaObjectAccessor', 'QtCore/QMetaObjectExtraData', 'QtCore/qmetaobject.h', 'QtCore/QMetaProperty', 'QtCore/QMetaType', 'QtCore/qmetatype.h', 'QtCore/QMetaTypeId', 'QtCore/QMetaTypeId2', 'QtCore/QMimeData', 'QtCore/qmimedata.h', 'QtCore/QModelIndex', 'QtCore/QModelIndexList', 'QtCore/QMultiHash', 'QtCore/QMultiMap', 'QtCore/QMutableFutureIterator', 'QtCore/QMutableHashIterator', 'QtCore/QMutableLinkedListIterator', 'QtCore/QMutableListIterator', 'QtCore/QMutableMapIterator', 'QtCore/QMutableSetIterator', 'QtCore/QMutableStringListIterator', 'QtCore/QMutableVectorIterator', 'QtCore/QMutex', 'QtCore/QMutexData', 'QtCore/qmutex.h', 'QtCore/QMutexLocker', 'QtCore/qnamespace.h', 'QtCore/QNoDebug', 'QtCore/QNoImplicitBoolCast', 'QtCore/qnumeric.h', 'QtCore/QObject', 'QtCore/QObjectCleanupHandler', 'QtCore/qobjectcleanuphandler.h', 'QtCore/QObjectData', 'QtCore/qobjectdefs.h', 'QtCore/qobject.h', 'QtCore/QObjectList', 'QtCore/QObjectUserData', 'QtCore/QPair', 'QtCore/qpair.h', 'QtCore/QParallelAnimationGroup', 'QtCore/qparallelanimationgroup.h', 'QtCore/QPauseAnimation', 'QtCore/qpauseanimation.h', 'QtCore/QPersistentModelIndex', 'QtCore/Q_PID', 'QtCore/qplugin.h', 'QtCore/QPluginLoader', 'QtCore/qpluginloader.h', 'QtCore/QPoint', 'QtCore/QPointer', 'QtCore/qpointer.h', 'QtCore/QPointF', 'QtCore/qpoint.h', 'QtCore/QProcess', 'QtCore/QProcessEnvironment', 'QtCore/qprocess.h', 'QtCore/QPropertyAnimation', 'QtCore/qpropertyanimation.h', 'QtCore/QQueue', 'QtCore/qqueue.h', 'QtCore/QReadLocker', 'QtCore/QReadWriteLock', 'QtCore/qreadwritelock.h', 'QtCore/QRect', 'QtCore/QRectF', 'QtCore/qrect.h', 'QtCore/QRegExp', 'QtCore/qregexp.h', 'QtCore/QResource', 'QtCore/qresource.h', 'QtCore/QReturnArgument', 'QtCore/QRunnable', 'QtCore/qrunnable.h', 'QtCore/QScopedArrayPointer', 'QtCore/QScopedPointer', 'QtCore/QScopedPointerArrayDeleter', 'QtCore/QScopedPointerDeleter', 'QtCore/qscopedpointer.h', 'QtCore/QScopedPointerPodDeleter', 'QtCore/QScopedValueRollback', 'QtCore/qscopedvaluerollback.h', 'QtCore/QSemaphore', 'QtCore/qsemaphore.h', 'QtCore/QSequentialAnimationGroup', 'QtCore/qsequentialanimationgroup.h', 'QtCore/QSet', 'QtCore/qset.h', 'QtCore/QSetIterator', 'QtCore/QSettings', 'QtCore/qsettings.h', 'QtCore/QSharedData', 'QtCore/qshareddata.h', 'QtCore/QSharedDataPointer', 'QtCore/QSharedMemory', 'QtCore/qsharedmemory.h', 'QtCore/QSharedPointer', 'QtCore/qsharedpointer.h', 'QtCore/qsharedpointer_impl.h', 'QtCore/QSignalMapper', 'QtCore/qsignalmapper.h', 'QtCore/QSignalTransition', 'QtCore/qsignaltransition.h', 'QtCore/QSize', 'QtCore/QSizeF', 'QtCore/qsize.h', 'QtCore/QSocketNotifier', 'QtCore/qsocketnotifier.h', 'QtCore/QStack', 'QtCore/qstack.h', 'QtCore/QState', 'QtCore/qstate.h', 'QtCore/QStateMachine', 'QtCore/qstatemachine.h', 'QtCore/QStdWString', 'QtCore/QString', 'QtCore/QStringBuilder', 'QtCore/qstringbuilder.h', 'QtCore/qstring.h', 'QtCore/QStringList', 'QtCore/qstringlist.h', 'QtCore/QStringListIterator', 'QtCore/QStringMatcher', 'QtCore/qstringmatcher.h', 'QtCore/QStringRef', 'QtCore/QSysInfo', 'QtCore/QSystemLocale', 'QtCore/QSystemSemaphore', 'QtCore/qsystemsemaphore.h', 'QtCore/Qt', 'QtCore/QtAlgorithms', 'QtCore/QtCleanUpFunction', 'QtCore/qtconcurrentcompilertest.h', 'QtCore/qtconcurrentexception.h', 'QtCore/QtConcurrentFilter', 'QtCore/qtconcurrentfilter.h', 'QtCore/qtconcurrentfilterkernel.h', 'QtCore/qtconcurrentfunctionwrappers.h', 'QtCore/qtconcurrentiteratekernel.h', 'QtCore/QtConcurrentMap', 'QtCore/qtconcurrentmap.h', 'QtCore/qtconcurrentmapkernel.h', 'QtCore/qtconcurrentmedian.h', 'QtCore/qtconcurrentreducekernel.h', 'QtCore/qtconcurrentresultstore.h', 'QtCore/QtConcurrentRun', 'QtCore/qtconcurrentrunbase.h', 'QtCore/qtconcurrentrun.h', 'QtCore/qtconcurrentstoredfunctioncall.h', 'QtCore/qtconcurrentthreadengine.h', 'QtCore/QtConfig', 'QtCore/QtContainerFwd', 'QtCore/QtCore', 'QtCore/QtDebug', 'QtCore/QTemporaryFile', 'QtCore/qtemporaryfile.h', 'QtCore/QtEndian', 'QtCore/QTextBoundaryFinder', 'QtCore/qtextboundaryfinder.h', 'QtCore/QTextCodec', 'QtCore/QTextCodecFactoryInterface', 'QtCore/qtextcodec.h', 'QtCore/QTextCodecPlugin', 'QtCore/qtextcodecplugin.h', 'QtCore/QTextDecoder', 'QtCore/QTextEncoder', 'QtCore/QTextIStream', 'QtCore/QTextOStream', 'QtCore/QTextStream', 'QtCore/QTextStreamFunction', 'QtCore/qtextstream.h', 'QtCore/QTextStreamManipulator', 'QtCore/QtGlobal', 'QtCore/QThread', 'QtCore/qthread.h', 'QtCore/QThreadPool', 'QtCore/qthreadpool.h', 'QtCore/QThreadStorage', 'QtCore/QThreadStorageData', 'QtCore/qthreadstorage.h', 'QtCore/QTime', 'QtCore/QTimeLine', 'QtCore/qtimeline.h', 'QtCore/QTimer', 'QtCore/QTimerEvent', 'QtCore/qtimer.h', 'QtCore/QtMsgHandler', 'QtCore/QtPlugin', 'QtCore/QtPluginInstanceFunction', 'QtCore/QTranslator', 'QtCore/qtranslator.h', 'QtCore/QTS', 'QtCore/qt_windows.h', 'QtCore/QTypeInfo', 'QtCore/Q_UINT16', 'QtCore/Q_UINT32', 'QtCore/Q_UINT64', 'QtCore/Q_UINT8', 'QtCore/Q_ULLONG', 'QtCore/Q_ULONG', 'QtCore/QUrl', 'QtCore/qurl.h', 'QtCore/QUuid', 'QtCore/quuid.h', 'QtCore/QVariant', 'QtCore/QVariantAnimation', 'QtCore/qvariantanimation.h', 'QtCore/qvariant.h', 'QtCore/QVariantHash', 'QtCore/QVariantList', 'QtCore/QVariantMap', 'QtCore/QVarLengthArray', 'QtCore/qvarlengtharray.h', 'QtCore/QVector', 'QtCore/QVectorData', 'QtCore/qvector.h', 'QtCore/QVectorIterator', 'QtCore/QVectorTypedData', 'QtCore/QWaitCondition', 'QtCore/qwaitcondition.h', 'QtCore/QWeakPointer', 'QtCore/QWriteLocker', 'QtCore/QXmlStreamAttribute', 'QtCore/QXmlStreamAttributes', 'QtCore/QXmlStreamEntityDeclaration', 'QtCore/QXmlStreamEntityDeclarations', 'QtCore/QXmlStreamEntityResolver', 'QtCore/qxmlstream.h', 'QtCore/QXmlStreamNamespaceDeclaration', 'QtCore/QXmlStreamNamespaceDeclarations', 'QtCore/QXmlStreamNotationDeclaration', 'QtCore/QXmlStreamNotationDeclarations', 'QtCore/QXmlStreamReader', 'QtCore/QXmlStreamStringRef', 'QtCore/QXmlStreamWriter', 'QtDeclarative/QDeclarativeAttachedPropertiesFunc', 'QtDeclarative/QDeclarativeComponent', 'QtDeclarative/qdeclarativecomponent.h', 'QtDeclarative/QDeclarativeContext', 'QtDeclarative/qdeclarativecontext.h', 'QtDeclarative/QDeclarativeDebuggingEnabler', 'QtDeclarative/qdeclarativedebug.h', 'QtDeclarative/QDeclarativeEngine', 'QtDeclarative/qdeclarativeengine.h', 'QtDeclarative/QDeclarativeError', 'QtDeclarative/qdeclarativeerror.h', 'QtDeclarative/QDeclarativeExpression', 'QtDeclarative/qdeclarativeexpression.h', 'QtDeclarative/QDeclarativeExtensionInterface', 'QtDeclarative/qdeclarativeextensioninterface.h', 'QtDeclarative/QDeclarativeExtensionPlugin', 'QtDeclarative/qdeclarativeextensionplugin.h', 'QtDeclarative/qdeclarative.h', 'QtDeclarative/QDeclarativeImageProvider', 'QtDeclarative/qdeclarativeimageprovider.h', 'QtDeclarative/QDeclarativeInfo', 'QtDeclarative/qdeclarativeinfo.h', 'QtDeclarative/QDeclarativeItem', 'QtDeclarative/qdeclarativeitem.h', 'QtDeclarative/qdeclarativelist.h', 'QtDeclarative/QDeclarativeListProperty', 'QtDeclarative/QDeclarativeListReference', 'QtDeclarative/QDeclarativeNetworkAccessManagerFactory', 'QtDeclarative/qdeclarativenetworkaccessmanagerfactory.h', 'QtDeclarative/QDeclarativeParserStatus', 'QtDeclarative/qdeclarativeparserstatus.h', 'QtDeclarative/qdeclarativeprivate.h', 'QtDeclarative/QDeclarativeProperties', 'QtDeclarative/QDeclarativeProperty', 'QtDeclarative/qdeclarativeproperty.h', 'QtDeclarative/QDeclarativePropertyMap', 'QtDeclarative/qdeclarativepropertymap.h', 'QtDeclarative/QDeclarativePropertyValueInterceptor', 'QtDeclarative/qdeclarativepropertyvalueinterceptor.h', 'QtDeclarative/QDeclarativePropertyValueSource', 'QtDeclarative/qdeclarativepropertyvaluesource.h', 'QtDeclarative/QDeclarativeScriptString', 'QtDeclarative/qdeclarativescriptstring.h', 'QtDeclarative/QDeclarativeTypeInfo', 'QtDeclarative/QDeclarativeView', 'QtDeclarative/qdeclarativeview.h', 'QtDeclarative/QtDeclarative', 'QtGui/QAbstractButton', 'QtGui/qabstractbutton.h', 'QtGui/QAbstractFontEngine', 'QtGui/qabstractfontengine_qws.h', 'QtGui/QAbstractGraphicsShapeItem', 'QtGui/QAbstractItemDelegate', 'QtGui/qabstractitemdelegate.h', 'QtGui/QAbstractItemView', 'QtGui/qabstractitemview.h', 'QtGui/QAbstractPageSetupDialog', 'QtGui/qabstractpagesetupdialog.h', 'QtGui/QAbstractPrintDialog', 'QtGui/qabstractprintdialog.h', 'QtGui/QAbstractProxyModel', 'QtGui/qabstractproxymodel.h', 'QtGui/QAbstractScrollArea', 'QtGui/qabstractscrollarea.h', 'QtGui/QAbstractSlider', 'QtGui/qabstractslider.h', 'QtGui/QAbstractSpinBox', 'QtGui/qabstractspinbox.h', 'QtGui/QAbstractTextDocumentLayout', 'QtGui/qabstracttextdocumentlayout.h', 'QtGui/QAbstractUndoItem', 'QtGui/QAccessible', 'QtGui/qaccessible2.h', 'QtGui/QAccessible2Interface', 'QtGui/QAccessibleActionInterface', 'QtGui/QAccessibleApplication', 'QtGui/QAccessibleBridge', 'QtGui/QAccessibleBridgeFactoryInterface', 'QtGui/qaccessiblebridge.h', 'QtGui/QAccessibleBridgePlugin', 'QtGui/QAccessibleEditableTextInterface', 'QtGui/QAccessibleEvent', 'QtGui/QAccessibleFactoryInterface', 'QtGui/qaccessible.h', 'QtGui/QAccessibleImageInterface', 'QtGui/QAccessibleInterface', 'QtGui/QAccessibleInterfaceEx', 'QtGui/QAccessibleObject', 'QtGui/QAccessibleObjectEx', 'QtGui/qaccessibleobject.h', 'QtGui/QAccessiblePlugin', 'QtGui/qaccessibleplugin.h', 'QtGui/QAccessibleSimpleEditableTextInterface', 'QtGui/QAccessibleTable2CellInterface', 'QtGui/QAccessibleTable2Interface', 'QtGui/QAccessibleTableInterface', 'QtGui/QAccessibleTextInterface', 'QtGui/QAccessibleValueInterface', 'QtGui/QAccessibleWidget', 'QtGui/QAccessibleWidgetEx', 'QtGui/qaccessiblewidget.h', 'QtGui/QAction', 'QtGui/QActionEvent', 'QtGui/QActionGroup', 'QtGui/qactiongroup.h', 'QtGui/qaction.h', 'QtGui/QApplication', 'QtGui/qapplication.h', 'QtGui/QAuthDevice', 'QtGui/QBitmap', 'QtGui/qbitmap.h', 'QtGui/QBoxLayout', 'QtGui/qboxlayout.h', 'QtGui/QBrush', 'QtGui/QBrushData', 'QtGui/qbrush.h', 'QtGui/QButtonGroup', 'QtGui/qbuttongroup.h', 'QtGui/QCalendarWidget', 'QtGui/qcalendarwidget.h', 'QtGui/QCDEStyle', 'QtGui/qcdestyle.h', 'QtGui/QCheckBox', 'QtGui/qcheckbox.h', 'QtGui/QCleanlooksStyle', 'QtGui/qcleanlooksstyle.h', 'QtGui/QClipboard', 'QtGui/QClipboardEvent', 'QtGui/qclipboard.h', 'QtGui/QCloseEvent', 'QtGui/QColor', 'QtGui/QColorDialog', 'QtGui/qcolordialog.h', 'QtGui/QColorGroup', 'QtGui/qcolor.h', 'QtGui/QColormap', 'QtGui/qcolormap.h', 'QtGui/QColumnView', 'QtGui/qcolumnview.h', 'QtGui/QComboBox', 'QtGui/qcombobox.h', 'QtGui/QCommandLinkButton', 'QtGui/qcommandlinkbutton.h', 'QtGui/QCommonStyle', 'QtGui/qcommonstyle.h', 'QtGui/QCompleter', 'QtGui/qcompleter.h', 'QtGui/QConicalGradient', 'QtGui/QContextMenuEvent', 'QtGui/QCopChannel', 'QtGui/qcopchannel_qws.h', 'QtGui/QCursor', 'QtGui/qcursor.h', 'QtGui/QCursorShape', 'QtGui/QDataWidgetMapper', 'QtGui/qdatawidgetmapper.h', 'QtGui/QDateEdit', 'QtGui/QDateTimeEdit', 'QtGui/qdatetimeedit.h', 'QtGui/QDecoration', 'QtGui/QDecorationAction', 'QtGui/QDecorationDefault', 'QtGui/qdecorationdefault_qws.h', 'QtGui/QDecorationFactory', 'QtGui/QDecorationFactoryInterface', 'QtGui/qdecorationfactory_qws.h', 'QtGui/QDecorationPlugin', 'QtGui/qdecorationplugin_qws.h', 'QtGui/qdecoration_qws.h', 'QtGui/QDecorationStyled', 'QtGui/qdecorationstyled_qws.h', 'QtGui/QDecorationWindows', 'QtGui/qdecorationwindows_qws.h', 'QtGui/QDesktopServices', 'QtGui/qdesktopservices.h', 'QtGui/QDesktopWidget', 'QtGui/qdesktopwidget.h', 'QtGui/QDial', 'QtGui/qdial.h', 'QtGui/QDialog', 'QtGui/QDialogButtonBox', 'QtGui/qdialogbuttonbox.h', 'QtGui/qdialog.h', 'QtGui/QDirectPainter', 'QtGui/qdirectpainter_qws.h', 'QtGui/QDirModel', 'QtGui/qdirmodel.h', 'QtGui/QDockWidget', 'QtGui/qdockwidget.h', 'QtGui/QDoubleSpinBox', 'QtGui/QDoubleValidator', 'QtGui/QDrag', 'QtGui/QDragEnterEvent', 'QtGui/qdrag.h', 'QtGui/QDragLeaveEvent', 'QtGui/QDragMoveEvent', 'QtGui/QDragResponseEvent', 'QtGui/qdrawutil.h', 'QtGui/QDropEvent', 'QtGui/QErrorMessage', 'QtGui/qerrormessage.h', 'QtGui/qevent.h', 'QtGui/QFileDialog', 'QtGui/qfiledialog.h', 'QtGui/QFileIconProvider', 'QtGui/qfileiconprovider.h', 'QtGui/QFileOpenEvent', 'QtGui/QFileSystemModel', 'QtGui/qfilesystemmodel.h', 'QtGui/QFocusEvent', 'QtGui/QFocusFrame', 'QtGui/qfocusframe.h', 'QtGui/QFont', 'QtGui/QFontComboBox', 'QtGui/qfontcombobox.h', 'QtGui/QFontDatabase', 'QtGui/qfontdatabase.h', 'QtGui/QFontDialog', 'QtGui/qfontdialog.h', 'QtGui/QFontEngineFactoryInterface', 'QtGui/QFontEngineInfo', 'QtGui/QFontEnginePlugin', 'QtGui/qfont.h', 'QtGui/QFontInfo', 'QtGui/qfontinfo.h', 'QtGui/QFontMetrics', 'QtGui/QFontMetricsF', 'QtGui/qfontmetrics.h', 'QtGui/QFormLayout', 'QtGui/qformlayout.h', 'QtGui/QFrame', 'QtGui/qframe.h', 'QtGui/QGenericMatrix', 'QtGui/qgenericmatrix.h', 'QtGui/QGenericPlugin', 'QtGui/QGenericPluginFactory', 'QtGui/QGenericPluginFactoryInterface', 'QtGui/qgenericpluginfactory_qpa.h', 'QtGui/qgenericplugin_qpa.h', 'QtGui/QGesture', 'QtGui/QGestureEvent', 'QtGui/qgesture.h', 'QtGui/QGestureRecognizer', 'QtGui/qgesturerecognizer.h', 'QtGui/QGlyphRun', 'QtGui/qglyphrun.h', 'QtGui/QGradient', 'QtGui/QGradientStop', 'QtGui/QGradientStops', 'QtGui/QGraphicsAnchor', 'QtGui/QGraphicsAnchorLayout', 'QtGui/qgraphicsanchorlayout.h', 'QtGui/QGraphicsBlurEffect', 'QtGui/QGraphicsColorizeEffect', 'QtGui/QGraphicsDropShadowEffect', 'QtGui/QGraphicsEffect', 'QtGui/qgraphicseffect.h', 'QtGui/QGraphicsEllipseItem', 'QtGui/QGraphicsGridLayout', 'QtGui/qgraphicsgridlayout.h', 'QtGui/QGraphicsItem', 'QtGui/QGraphicsItemAnimation', 'QtGui/qgraphicsitemanimation.h', 'QtGui/QGraphicsItemGroup', 'QtGui/qgraphicsitem.h', 'QtGui/QGraphicsLayout', 'QtGui/qgraphicslayout.h', 'QtGui/QGraphicsLayoutItem', 'QtGui/qgraphicslayoutitem.h', 'QtGui/QGraphicsLinearLayout', 'QtGui/qgraphicslinearlayout.h', 'QtGui/QGraphicsLineItem', 'QtGui/QGraphicsObject', 'QtGui/QGraphicsOpacityEffect', 'QtGui/QGraphicsPathItem', 'QtGui/QGraphicsPixmapItem', 'QtGui/QGraphicsPolygonItem', 'QtGui/QGraphicsProxyWidget', 'QtGui/qgraphicsproxywidget.h', 'QtGui/QGraphicsRectItem', 'QtGui/QGraphicsRotation', 'QtGui/QGraphicsScale', 'QtGui/QGraphicsScene', 'QtGui/QGraphicsSceneContextMenuEvent', 'QtGui/QGraphicsSceneDragDropEvent', 'QtGui/QGraphicsSceneEvent', 'QtGui/qgraphicssceneevent.h', 'QtGui/qgraphicsscene.h', 'QtGui/QGraphicsSceneHoverEvent', 'QtGui/QGraphicsSceneMouseEvent', 'QtGui/QGraphicsSceneMoveEvent', 'QtGui/QGraphicsSceneResizeEvent', 'QtGui/QGraphicsSceneWheelEvent', 'QtGui/QGraphicsSimpleTextItem', 'QtGui/QGraphicsTextItem', 'QtGui/QGraphicsTransform', 'QtGui/qgraphicstransform.h', 'QtGui/QGraphicsView', 'QtGui/qgraphicsview.h', 'QtGui/QGraphicsWidget', 'QtGui/qgraphicswidget.h', 'QtGui/QGridLayout', 'QtGui/qgridlayout.h', 'QtGui/QGroupBox', 'QtGui/qgroupbox.h', 'QtGui/QGtkStyle', 'QtGui/qgtkstyle.h', 'QtGui/qguifunctions_wince.h', 'QtGui/QHBoxLayout', 'QtGui/QHeaderView', 'QtGui/qheaderview.h', 'QtGui/QHideEvent', 'QtGui/QHoverEvent', 'QtGui/QIcon', 'QtGui/QIconDragEvent', 'QtGui/QIconEngine', 'QtGui/QIconEngineFactoryInterface', 'QtGui/QIconEngineFactoryInterfaceV2', 'QtGui/qiconengine.h', 'QtGui/QIconEnginePlugin', 'QtGui/qiconengineplugin.h', 'QtGui/QIconEnginePluginV2', 'QtGui/QIconEngineV2', 'QtGui/qicon.h', 'QtGui/QIconSet', 'QtGui/QIdentityProxyModel', 'QtGui/qidentityproxymodel.h', 'QtGui/QImage', 'QtGui/qimage.h', 'QtGui/QImageIOHandler', 'QtGui/QImageIOHandlerFactoryInterface', 'QtGui/qimageiohandler.h', 'QtGui/QImageIOPlugin', 'QtGui/QImageReader', 'QtGui/qimagereader.h', 'QtGui/QImageTextKeyLang', 'QtGui/QImageWriter', 'QtGui/qimagewriter.h', 'QtGui/QInputContext', 'QtGui/QInputContextFactory', 'QtGui/qinputcontextfactory.h', 'QtGui/QInputContextFactoryInterface', 'QtGui/qinputcontext.h', 'QtGui/QInputContextPlugin', 'QtGui/qinputcontextplugin.h', 'QtGui/QInputDialog', 'QtGui/qinputdialog.h', 'QtGui/QInputEvent', 'QtGui/QInputMethodEvent', 'QtGui/QIntfbScreen', 'QtGui/QIntMouseHandler', 'QtGui/QIntValidator', 'QtGui/QItemDelegate', 'QtGui/qitemdelegate.h', 'QtGui/QItemEditorCreator', 'QtGui/QItemEditorCreatorBase', 'QtGui/QItemEditorFactory', 'QtGui/qitemeditorfactory.h', 'QtGui/QItemSelection', 'QtGui/QItemSelectionModel', 'QtGui/qitemselectionmodel.h', 'QtGui/QItemSelectionRange', 'QtGui/QKbdDriverFactory', 'QtGui/qkbddriverfactory_qws.h', 'QtGui/QKbdDriverPlugin', 'QtGui/qkbddriverplugin_qws.h', 'QtGui/qkbdintegrity_qws.h', 'QtGui/qkbdqnx_qws.h', 'QtGui/qkbd_qws.h', 'QtGui/qkbdtty_qws.h', 'QtGui/qkbdum_qws.h', 'QtGui/qkbdvfb_qws.h', 'QtGui/QKeyEvent', 'QtGui/QKeyEventTransition', 'QtGui/qkeyeventtransition.h', 'QtGui/QKeySequence', 'QtGui/qkeysequence.h', 'QtGui/QLabel', 'QtGui/qlabel.h', 'QtGui/QLayout', 'QtGui/qlayout.h', 'QtGui/QLayoutItem', 'QtGui/qlayoutitem.h', 'QtGui/QLayoutIterator', 'QtGui/QLCDNumber', 'QtGui/qlcdnumber.h', 'QtGui/QLinearGradient', 'QtGui/QLineEdit', 'QtGui/qlineedit.h', 'QtGui/QListView', 'QtGui/qlistview.h', 'QtGui/QListWidget', 'QtGui/qlistwidget.h', 'QtGui/QListWidgetItem', 'QtGui/QMacCocoaViewContainer', 'QtGui/qmaccocoaviewcontainer_mac.h', 'QtGui/qmacdefines_mac.h', 'QtGui/QMacMime', 'QtGui/QMacNativeWidget', 'QtGui/qmacnativewidget_mac.h', 'QtGui/QMacPasteboardMime', 'QtGui/QMacStyle', 'QtGui/qmacstyle_mac.h', 'QtGui/QMainWindow', 'QtGui/qmainwindow.h', 'QtGui/QMatrix', 'QtGui/QMatrix2x2', 'QtGui/QMatrix2x3', 'QtGui/QMatrix2x4', 'QtGui/QMatrix3x2', 'QtGui/QMatrix3x3', 'QtGui/QMatrix3x4', 'QtGui/QMatrix4x2', 'QtGui/QMatrix4x3', 'QtGui/QMatrix4x4', 'QtGui/qmatrix4x4.h', 'QtGui/qmatrix.h', 'QtGui/QMdiArea', 'QtGui/qmdiarea.h', 'QtGui/QMdiSubWindow', 'QtGui/qmdisubwindow.h', 'QtGui/QMenu', 'QtGui/QMenuBar', 'QtGui/qmenubar.h', 'QtGui/QMenubarUpdatedEvent', 'QtGui/qmenudata.h', 'QtGui/qmenu.h', 'QtGui/QMenuItem', 'QtGui/QMessageBox', 'QtGui/qmessagebox.h', 'QtGui/qmime.h', 'QtGui/QMimeSource', 'QtGui/QMotifStyle', 'QtGui/qmotifstyle.h', 'QtGui/QMouseDriverFactory', 'QtGui/qmousedriverfactory_qws.h', 'QtGui/QMouseDriverPlugin', 'QtGui/qmousedriverplugin_qws.h', 'QtGui/QMouseEvent', 'QtGui/QMouseEventTransition', 'QtGui/qmouseeventtransition.h', 'QtGui/qmouseintegrity_qws.h', 'QtGui/qmousepc_qws.h', 'QtGui/qmouseqnx_qws.h', 'QtGui/qmouse_qws.h', 'QtGui/qmousetslib_qws.h', 'QtGui/qmousevfb_qws.h', 'QtGui/QMoveEvent', 'QtGui/QMovie', 'QtGui/qmovie.h', 'QtGui/QPageSetupDialog', 'QtGui/qpagesetupdialog.h', 'QtGui/QPaintDevice', 'QtGui/qpaintdevice.h', 'QtGui/QPaintEngine', 'QtGui/qpaintengine.h', 'QtGui/QPaintEngineState', 'QtGui/QPainter', 'QtGui/qpainter.h', 'QtGui/QPainterPath', 'QtGui/qpainterpath.h', 'QtGui/QPainterPathPrivate', 'QtGui/QPainterPathStroker', 'QtGui/QPaintEvent', 'QtGui/QPalette', 'QtGui/qpalette.h', 'QtGui/QPanGesture', 'QtGui/QPen', 'QtGui/qpen.h', 'QtGui/QPicture', 'QtGui/QPictureFormatInterface', 'QtGui/QPictureFormatPlugin', 'QtGui/qpictureformatplugin.h', 'QtGui/qpicture.h', 'QtGui/QPictureIO', 'QtGui/QPinchGesture', 'QtGui/QPixmap', 'QtGui/QPixmapCache', 'QtGui/qpixmapcache.h', 'QtGui/qpixmap.h', 'QtGui/QPlainTextDocumentLayout', 'QtGui/QPlainTextEdit', 'QtGui/qplaintextedit.h', 'QtGui/QPlastiqueStyle', 'QtGui/qplastiquestyle.h', 'QtGui/QPlatformClipboard', 'QtGui/qplatformclipboard_qpa.h', 'QtGui/QPlatformCursor', 'QtGui/QPlatformCursorImage', 'QtGui/QPlatformCursorPrivate', 'QtGui/qplatformcursor_qpa.h', 'QtGui/QPlatformEventLoopIntegration', 'QtGui/qplatformeventloopintegration_qpa.h', 'QtGui/QPlatformFontDatabase', 'QtGui/qplatformfontdatabase_qpa.h', 'QtGui/QPlatformGLContext', 'QtGui/qplatformglcontext_qpa.h', 'QtGui/QPlatformIntegration', 'QtGui/QPlatformIntegrationFactoryInterface', 'QtGui/QPlatformIntegrationPlugin', 'QtGui/qplatformintegrationplugin_qpa.h', 'QtGui/qplatformintegration_qpa.h', 'QtGui/QPlatformNativeInterface', 'QtGui/qplatformnativeinterface_qpa.h', 'QtGui/QPlatformScreen', 'QtGui/qplatformscreen_qpa.h', 'QtGui/QPlatformWindow', 'QtGui/QPlatformWindowFormat', 'QtGui/qplatformwindowformat_qpa.h', 'QtGui/qplatformwindow_qpa.h', 'QtGui/QPolygon', 'QtGui/QPolygonF', 'QtGui/qpolygon.h', 'QtGui/QPoolEntry', 'QtGui/QPrintDialog', 'QtGui/qprintdialog.h', 'QtGui/QPrintEngine', 'QtGui/qprintengine.h', 'QtGui/QPrinter', 'QtGui/qprinter.h', 'QtGui/QPrinterInfo', 'QtGui/qprinterinfo.h', 'QtGui/QPrintPreviewDialog', 'QtGui/qprintpreviewdialog.h', 'QtGui/QPrintPreviewWidget', 'QtGui/qprintpreviewwidget.h', 'QtGui/QProgressBar', 'QtGui/qprogressbar.h', 'QtGui/QProgressDialog', 'QtGui/qprogressdialog.h', 'QtGui/QProxyModel', 'QtGui/qproxymodel.h', 'QtGui/QProxyScreen', 'QtGui/QProxyScreenCursor', 'QtGui/QProxyStyle', 'QtGui/qproxystyle.h', 'QtGui/QPushButton', 'QtGui/qpushbutton.h', 'QtGui/QQnxMouseHandler', 'QtGui/QQnxScreen', 'QtGui/QQuaternion', 'QtGui/qquaternion.h', 'QtGui/QRadialGradient', 'QtGui/QRadioButton', 'QtGui/qradiobutton.h', 'QtGui/QRawFont', 'QtGui/qrawfont.h', 'QtGui/QRegExpValidator', 'QtGui/QRegion', 'QtGui/qregion.h', 'QtGui/QResizeEvent', 'QtGui/QRgb', 'QtGui/qrgb.h', 'QtGui/QRubberBand', 'QtGui/qrubberband.h', 'QtGui/QS60MainApplication', 'QtGui/QS60MainApplicationBase', 'QtGui/qs60mainapplication.h', 'QtGui/QS60MainAppUi', 'QtGui/QS60MainAppUiBase', 'QtGui/qs60mainappui.h', 'QtGui/QS60MainDocument', 'QtGui/QS60MainDocumentBase', 'QtGui/qs60maindocument.h', 'QtGui/QS60StubAknAppUi', 'QtGui/QS60StubAknAppUiBase', 'QtGui/QS60StubMAknTouchPaneObserver', 'QtGui/QS60StubMEikStatusPaneObserver', 'QtGui/QS60Style', 'QtGui/qs60style.h', 'QtGui/QScreen', 'QtGui/QScreenCursor', 'QtGui/QScreenDriverFactory', 'QtGui/QScreenDriverFactoryInterface', 'QtGui/qscreendriverfactory_qws.h', 'QtGui/QScreenDriverPlugin', 'QtGui/qscreendriverplugin_qws.h', 'QtGui/qscreenintegrityfb_qws.h', 'QtGui/qscreenproxy_qws.h', 'QtGui/qscreenqnx_qws.h', 'QtGui/qscreen_qws.h', 'QtGui/qscreentransformed_qws.h', 'QtGui/qscreenvfb_qws.h', 'QtGui/QScrollArea', 'QtGui/qscrollarea.h', 'QtGui/QScrollBar', 'QtGui/qscrollbar.h', 'QtGui/QSessionManager', 'QtGui/qsessionmanager.h', 'QtGui/QShortcut', 'QtGui/QShortcutEvent', 'QtGui/qshortcut.h', 'QtGui/QShowEvent', 'QtGui/QSizeGrip', 'QtGui/qsizegrip.h', 'QtGui/QSizePolicy', 'QtGui/qsizepolicy.h', 'QtGui/QSlider', 'QtGui/qslider.h', 'QtGui/QSortFilterProxyModel', 'QtGui/qsortfilterproxymodel.h', 'QtGui/QSound', 'QtGui/qsound.h', 'QtGui/qsoundqss_qws.h', 'QtGui/QSpacerItem', 'QtGui/QSpinBox', 'QtGui/qspinbox.h', 'QtGui/QSplashScreen', 'QtGui/qsplashscreen.h', 'QtGui/QSplitter', 'QtGui/qsplitter.h', 'QtGui/QSplitterHandle', 'QtGui/QStackedLayout', 'QtGui/qstackedlayout.h', 'QtGui/QStackedWidget', 'QtGui/qstackedwidget.h', 'QtGui/QStandardItem', 'QtGui/QStandardItemEditorCreator', 'QtGui/QStandardItemModel', 'QtGui/qstandarditemmodel.h', 'QtGui/QStaticText', 'QtGui/qstatictext.h', 'QtGui/QStatusBar', 'QtGui/qstatusbar.h', 'QtGui/QStatusTipEvent', 'QtGui/QStringListModel', 'QtGui/qstringlistmodel.h', 'QtGui/QStyle', 'QtGui/QStyledItemDelegate', 'QtGui/qstyleditemdelegate.h', 'QtGui/QStyleFactory', 'QtGui/qstylefactory.h', 'QtGui/QStyleFactoryInterface', 'QtGui/qstyle.h', 'QtGui/QStyleHintReturn', 'QtGui/QStyleHintReturnMask', 'QtGui/QStyleHintReturnVariant', 'QtGui/QStyleOption', 'QtGui/QStyleOptionButton', 'QtGui/QStyleOptionComboBox', 'QtGui/QStyleOptionComplex', 'QtGui/QStyleOptionDockWidget', 'QtGui/QStyleOptionDockWidgetV2', 'QtGui/QStyleOptionFocusRect', 'QtGui/QStyleOptionFrame', 'QtGui/QStyleOptionFrameV2', 'QtGui/QStyleOptionFrameV3', 'QtGui/QStyleOptionGraphicsItem', 'QtGui/QStyleOptionGroupBox', 'QtGui/qstyleoption.h', 'QtGui/QStyleOptionHeader', 'QtGui/QStyleOptionMenuItem', 'QtGui/QStyleOptionProgressBar', 'QtGui/QStyleOptionProgressBarV2', 'QtGui/QStyleOptionQ3DockWindow', 'QtGui/QStyleOptionQ3ListView', 'QtGui/QStyleOptionQ3ListViewItem', 'QtGui/QStyleOptionRubberBand', 'QtGui/QStyleOptionSizeGrip', 'QtGui/QStyleOptionSlider', 'QtGui/QStyleOptionSpinBox', 'QtGui/QStyleOptionTab', 'QtGui/QStyleOptionTabBarBase', 'QtGui/QStyleOptionTabBarBaseV2', 'QtGui/QStyleOptionTabV2', 'QtGui/QStyleOptionTabV3', 'QtGui/QStyleOptionTabWidgetFrame', 'QtGui/QStyleOptionTabWidgetFrameV2', 'QtGui/QStyleOptionTitleBar', 'QtGui/QStyleOptionToolBar', 'QtGui/QStyleOptionToolBox', 'QtGui/QStyleOptionToolBoxV2', 'QtGui/QStyleOptionToolButton', 'QtGui/QStyleOptionViewItem', 'QtGui/QStyleOptionViewItemV2', 'QtGui/QStyleOptionViewItemV3', 'QtGui/QStyleOptionViewItemV4', 'QtGui/QStylePainter', 'QtGui/qstylepainter.h', 'QtGui/QStylePlugin', 'QtGui/qstyleplugin.h', 'QtGui/QSupportedWritingSystems', 'QtGui/QSwipeGesture', 'QtGui/QSymbianEvent', 'QtGui/qsymbianevent.h', 'QtGui/QSyntaxHighlighter', 'QtGui/qsyntaxhighlighter.h', 'QtGui/QSystemTrayIcon', 'QtGui/qsystemtrayicon.h', 'QtGui/QTabBar', 'QtGui/qtabbar.h', 'QtGui/QTabletEvent', 'QtGui/QTableView', 'QtGui/qtableview.h', 'QtGui/QTableWidget', 'QtGui/qtablewidget.h', 'QtGui/QTableWidgetItem', 'QtGui/QTableWidgetSelectionRange', 'QtGui/QTabWidget', 'QtGui/qtabwidget.h', 'QtGui/QTapAndHoldGesture', 'QtGui/QTapGesture', 'QtGui/QtEvents', 'QtGui/QTextBlock', 'QtGui/QTextBlockFormat', 'QtGui/QTextBlockGroup', 'QtGui/QTextBlockUserData', 'QtGui/QTextBrowser', 'QtGui/qtextbrowser.h', 'QtGui/QTextCharFormat', 'QtGui/QTextCursor', 'QtGui/qtextcursor.h', 'QtGui/QTextDocument', 'QtGui/QTextDocumentFragment', 'QtGui/qtextdocumentfragment.h', 'QtGui/qtextdocument.h', 'QtGui/QTextDocumentWriter', 'QtGui/qtextdocumentwriter.h', 'QtGui/QTextEdit', 'QtGui/qtextedit.h', 'QtGui/QTextFormat', 'QtGui/qtextformat.h', 'QtGui/QTextFragment', 'QtGui/QTextFrame', 'QtGui/QTextFrameFormat', 'QtGui/QTextFrameLayoutData', 'QtGui/QTextImageFormat', 'QtGui/QTextInlineObject', 'QtGui/QTextItem', 'QtGui/QTextLayout', 'QtGui/qtextlayout.h', 'QtGui/QTextLength', 'QtGui/QTextLine', 'QtGui/QTextList', 'QtGui/QTextListFormat', 'QtGui/qtextlist.h', 'QtGui/QTextObject', 'QtGui/qtextobject.h', 'QtGui/QTextObjectInterface', 'QtGui/QTextOption', 'QtGui/qtextoption.h', 'QtGui/QTextTable', 'QtGui/QTextTableCell', 'QtGui/QTextTableCellFormat', 'QtGui/QTextTableFormat', 'QtGui/qtexttable.h', 'QtGui/QtGui', 'QtGui/QTileRules', 'QtGui/QTimeEdit', 'QtGui/QToolBar', 'QtGui/QToolBarChangeEvent', 'QtGui/qtoolbar.h', 'QtGui/QToolBox', 'QtGui/qtoolbox.h', 'QtGui/QToolButton', 'QtGui/qtoolbutton.h', 'QtGui/QToolTip', 'QtGui/qtooltip.h', 'QtGui/QTouchEvent', 'QtGui/QTransform', 'QtGui/QTransformedScreen', 'QtGui/qtransform.h', 'QtGui/QTransportAuth', 'QtGui/qtransportauthdefs_qws.h', 'QtGui/qtransportauth_qws.h', 'QtGui/QTreeView', 'QtGui/qtreeview.h', 'QtGui/QTreeWidget', 'QtGui/qtreewidget.h', 'QtGui/QTreeWidgetItem', 'QtGui/QTreeWidgetItemIterator', 'QtGui/qtreewidgetitemiterator.h', 'QtGui/QUndoCommand', 'QtGui/QUndoGroup', 'QtGui/qundogroup.h', 'QtGui/QUndoStack', 'QtGui/qundostack.h', 'QtGui/QUndoView', 'QtGui/qundoview.h', 'QtGui/QUnixPrintWidget', 'QtGui/QUpdateLaterEvent', 'QtGui/QValidator', 'QtGui/qvalidator.h', 'QtGui/QVBoxLayout', 'QtGui/QVector2D', 'QtGui/qvector2d.h', 'QtGui/QVector3D', 'QtGui/qvector3d.h', 'QtGui/QVector4D', 'QtGui/qvector4d.h', 'QtGui/qvfbhdr.h', 'QtGui/QVFbHeader', 'QtGui/QVFbKeyboardHandler', 'QtGui/QVFbKeyData', 'QtGui/QVFbMouseHandler', 'QtGui/QVFbScreen', 'QtGui/QWhatsThis', 'QtGui/QWhatsThisClickedEvent', 'QtGui/qwhatsthis.h', 'QtGui/QWheelEvent', 'QtGui/QWidget', 'QtGui/QWidgetAction', 'QtGui/qwidgetaction.h', 'QtGui/QWidgetData', 'QtGui/qwidget.h', 'QtGui/QWidgetItem', 'QtGui/QWidgetItemV2', 'QtGui/QWidgetList', 'QtGui/QWidgetMapper', 'QtGui/QWidgetSet', 'QtGui/qwindowdefs.h', 'QtGui/qwindowdefs_win.h', 'QtGui/QWindowsCEStyle', 'QtGui/qwindowscestyle.h', 'QtGui/QWindowsMime', 'QtGui/QWindowsMobileStyle', 'QtGui/qwindowsmobilestyle.h', 'QtGui/QWindowsStyle', 'QtGui/qwindowsstyle.h', 'QtGui/QWindowStateChangeEvent', 'QtGui/QWindowsVistaStyle', 'QtGui/qwindowsvistastyle.h', 'QtGui/QWindowsXPStyle', 'QtGui/qwindowsxpstyle.h', 'QtGui/QWindowSystemInterface', 'QtGui/qwindowsysteminterface_qpa.h', 'QtGui/qwindowsystem_qws.h', 'QtGui/QWizard', 'QtGui/qwizard.h', 'QtGui/QWizardPage', 'QtGui/QWMatrix', 'QtGui/qwmatrix.h', 'QtGui/QWorkspace', 'QtGui/qworkspace.h', 'QtGui/QWSCalibratedMouseHandler', 'QtGui/QWSClient', 'QtGui/QWSCursor', 'QtGui/QWSCursorMap', 'QtGui/qwscursor_qws.h', 'QtGui/QWSDisplay', 'QtGui/qwsdisplay_qws.h', 'QtGui/QWSEmbedWidget', 'QtGui/qwsembedwidget.h', 'QtGui/QWSEvent', 'QtGui/qwsevent_qws.h', 'QtGui/QWSInputMethod', 'QtGui/QWSInternalWindowInfo', 'QtGui/QWSIntKeyboardHandler', 'QtGui/QWSKeyboardHandler', 'QtGui/QWSKeyboardHandlerFactoryInterface', 'QtGui/QWSManager', 'QtGui/qwsmanager_qws.h', 'QtGui/QWSMouseHandler', 'QtGui/QWSMouseHandlerFactoryInterface', 'QtGui/QWSPcMouseHandler', 'QtGui/QWSPointerCalibrationData', 'QtGui/QWSPropertyManager', 'QtGui/qwsproperty_qws.h', 'QtGui/QWSProtocolItem', 'QtGui/qwsprotocolitem_qws.h', 'QtGui/QWSQnxKeyboardHandler', 'QtGui/QWSScreenSaver', 'QtGui/QWSServer', 'QtGui/QWSServerSocket', 'QtGui/QWSSocket', 'QtGui/qwssocket_qws.h', 'QtGui/QWSSoundClient', 'QtGui/QWSSoundServer', 'QtGui/QWSSoundServerSocket', 'QtGui/QWSTslibMouseHandler', 'QtGui/QWSTtyKeyboardHandler', 'QtGui/QWSUmKeyboardHandler', 'QtGui/qwsutils_qws.h', 'QtGui/QWSWindow', 'QtGui/QWSWindowInfo', 'QtGui/QX11EmbedContainer', 'QtGui/QX11EmbedWidget', 'QtGui/qx11embed_x11.h', 'QtGui/QX11Info', 'QtGui/qx11info_x11.h', 'QtMultimedia/QAbstractAudioDeviceInfo', 'QtMultimedia/QAbstractAudioInput', 'QtMultimedia/QAbstractAudioOutput', 'QtMultimedia/QAbstractVideoBuffer', 'QtMultimedia/qabstractvideobuffer.h', 'QtMultimedia/QAbstractVideoSurface', 'QtMultimedia/qabstractvideosurface.h', 'QtMultimedia/QAudio', 'QtMultimedia/QAudioDeviceInfo', 'QtMultimedia/qaudiodeviceinfo.h', 'QtMultimedia/QAudioEngineFactoryInterface', 'QtMultimedia/qaudioengine.h', 'QtMultimedia/QAudioEnginePlugin', 'QtMultimedia/qaudioengineplugin.h', 'QtMultimedia/QAudioFormat', 'QtMultimedia/qaudioformat.h', 'QtMultimedia/qaudio.h', 'QtMultimedia/QAudioInput', 'QtMultimedia/qaudioinput.h', 'QtMultimedia/QAudioOutput', 'QtMultimedia/qaudiooutput.h', 'QtMultimedia/QtMultimedia', 'QtMultimedia/QVideoFrame', 'QtMultimedia/qvideoframe.h', 'QtMultimedia/QVideoSurfaceFormat', 'QtMultimedia/qvideosurfaceformat.h', 'QtNetwork/QAbstractNetworkCache', 'QtNetwork/qabstractnetworkcache.h', 'QtNetwork/QAbstractSocket', 'QtNetwork/qabstractsocket.h', 'QtNetwork/QAuthenticator', 'QtNetwork/qauthenticator.h', 'QtNetwork/QFtp', 'QtNetwork/qftp.h', 'QtNetwork/QHostAddress', 'QtNetwork/qhostaddress.h', 'QtNetwork/QHostInfo', 'QtNetwork/qhostinfo.h', 'QtNetwork/QHttp', 'QtNetwork/qhttp.h', 'QtNetwork/QHttpHeader', 'QtNetwork/QHttpMultiPart', 'QtNetwork/qhttpmultipart.h', 'QtNetwork/QHttpPart', 'QtNetwork/QHttpRequestHeader', 'QtNetwork/QHttpResponseHeader', 'QtNetwork/Q_IPV6ADDR', 'QtNetwork/QIPv6Address', 'QtNetwork/QLocalServer', 'QtNetwork/qlocalserver.h', 'QtNetwork/QLocalSocket', 'QtNetwork/qlocalsocket.h', 'QtNetwork/QNetworkAccessManager', 'QtNetwork/qnetworkaccessmanager.h', 'QtNetwork/QNetworkAddressEntry', 'QtNetwork/QNetworkCacheMetaData', 'QtNetwork/qnetworkconfigmanager.h', 'QtNetwork/QNetworkConfiguration', 'QtNetwork/qnetworkconfiguration.h', 'QtNetwork/QNetworkConfigurationManager', 'QtNetwork/QNetworkCookie', 'QtNetwork/qnetworkcookie.h', 'QtNetwork/QNetworkCookieJar', 'QtNetwork/qnetworkcookiejar.h', 'QtNetwork/QNetworkDiskCache', 'QtNetwork/qnetworkdiskcache.h', 'QtNetwork/qnetworkfunctions_wince.h', 'QtNetwork/QNetworkInterface', 'QtNetwork/qnetworkinterface.h', 'QtNetwork/QNetworkProxy', 'QtNetwork/QNetworkProxyFactory', 'QtNetwork/qnetworkproxy.h', 'QtNetwork/QNetworkProxyQuery', 'QtNetwork/QNetworkReply', 'QtNetwork/qnetworkreply.h', 'QtNetwork/QNetworkRequest', 'QtNetwork/qnetworkrequest.h', 'QtNetwork/QNetworkSession', 'QtNetwork/qnetworksession.h', 'QtNetwork/QSsl', 'QtNetwork/QSslCertificate', 'QtNetwork/qsslcertificate.h', 'QtNetwork/QSslCipher', 'QtNetwork/qsslcipher.h', 'QtNetwork/QSslConfiguration', 'QtNetwork/qsslconfiguration.h', 'QtNetwork/QSslError', 'QtNetwork/qsslerror.h', 'QtNetwork/qssl.h', 'QtNetwork/QSslKey', 'QtNetwork/qsslkey.h', 'QtNetwork/QSslSocket', 'QtNetwork/qsslsocket.h', 'QtNetwork/QTcpServer', 'QtNetwork/qtcpserver.h', 'QtNetwork/QTcpSocket', 'QtNetwork/qtcpsocket.h', 'QtNetwork/QtNetwork', 'QtNetwork/QUdpSocket', 'QtNetwork/qudpsocket.h', 'QtNetwork/QUrlInfo', 'QtNetwork/qurlinfo.h', 'QtScript/QScriptable', 'QtScript/qscriptable.h', 'QtScript/QScriptClass', 'QtScript/qscriptclass.h', 'QtScript/QScriptClassPropertyIterator', 'QtScript/qscriptclasspropertyiterator.h', 'QtScript/QScriptContext', 'QtScript/qscriptcontext.h', 'QtScript/QScriptContextInfo', 'QtScript/qscriptcontextinfo.h', 'QtScript/QScriptContextInfoList', 'QtScript/QScriptEngine', 'QtScript/QScriptEngineAgent', 'QtScript/qscriptengineagent.h', 'QtScript/qscriptengine.h', 'QtScript/QScriptExtensionInterface', 'QtScript/qscriptextensioninterface.h', 'QtScript/QScriptExtensionPlugin', 'QtScript/qscriptextensionplugin.h', 'QtScript/QScriptProgram', 'QtScript/qscriptprogram.h', 'QtScript/QScriptString', 'QtScript/qscriptstring.h', 'QtScript/QScriptSyntaxCheckResult', 'QtScript/QScriptValue', 'QtScript/qscriptvalue.h', 'QtScript/QScriptValueIterator', 'QtScript/qscriptvalueiterator.h', 'QtScript/QScriptValueList', 'QtScript/QtScript', 'QtScriptTools/QScriptEngineDebugger', 'QtScriptTools/qscriptenginedebugger.h', 'QtScriptTools/QtScriptTools', 'QtSql/QDB2Driver', 'QtSql/QDB2Result', 'QtSql/QIBaseDriver', 'QtSql/QIBaseResult', 'QtSql/QMYSQLDriver', 'QtSql/QMYSQLResult', 'QtSql/QOCIDriver', 'QtSql/QOCIResult', 'QtSql/QODBCDriver', 'QtSql/QODBCResult', 'QtSql/QPSQLDriver', 'QtSql/QPSQLResult', 'QtSql/QSqlDatabase', 'QtSql/qsqldatabase.h', 'QtSql/qsql_db2.h', 'QtSql/QSqlDriver', 'QtSql/QSqlDriverCreator', 'QtSql/QSqlDriverCreatorBase', 'QtSql/QSqlDriverFactoryInterface', 'QtSql/qsqldriver.h', 'QtSql/QSqlDriverPlugin', 'QtSql/qsqldriverplugin.h', 'QtSql/QSqlError', 'QtSql/qsqlerror.h', 'QtSql/QSqlField', 'QtSql/qsqlfield.h', 'QtSql/qsql.h', 'QtSql/qsql_ibase.h', 'QtSql/QSqlIndex', 'QtSql/qsqlindex.h', 'QtSql/QSQLite2Driver', 'QtSql/QSQLite2Result', 'QtSql/QSQLiteDriver', 'QtSql/QSQLiteResult', 'QtSql/qsql_mysql.h', 'QtSql/qsql_oci.h', 'QtSql/qsql_odbc.h', 'QtSql/qsql_psql.h', 'QtSql/QSqlQuery', 'QtSql/qsqlquery.h', 'QtSql/QSqlQueryModel', 'QtSql/qsqlquerymodel.h', 'QtSql/QSqlRecord', 'QtSql/qsqlrecord.h', 'QtSql/QSqlRelation', 'QtSql/QSqlRelationalDelegate', 'QtSql/qsqlrelationaldelegate.h', 'QtSql/QSqlRelationalTableModel', 'QtSql/qsqlrelationaltablemodel.h', 'QtSql/QSqlResult', 'QtSql/qsqlresult.h', 'QtSql/qsql_sqlite2.h', 'QtSql/qsql_sqlite.h', 'QtSql/qsql_symsql.h', 'QtSql/QSqlTableModel', 'QtSql/qsqltablemodel.h', 'QtSql/qsql_tds.h', 'QtSql/QSymSQLDriver', 'QtSql/QSymSQLResult', 'QtSql/QTDSDriver', 'QtSql/QTDSResult', 'QtSql/QtSql', 'QtTest/qbenchmark.h', 'QtTest/qbenchmarkmetric.h', 'QtTest/QEventSizeOfChecker', 'QtTest/QSignalSpy', 'QtTest/qsignalspy.h', 'QtTest/QSpontaneKeyEvent', 'QtTest/QTest', 'QtTest/QTestAccessibility', 'QtTest/QTestAccessibilityEvent', 'QtTest/qtestaccessible.h', 'QtTest/qtestassert.h', 'QtTest/QTestBasicStreamer', 'QtTest/qtestbasicstreamer.h', 'QtTest/qtestcase.h', 'QtTest/QTestCoreElement', 'QtTest/qtestcoreelement.h', 'QtTest/QTestCoreList', 'QtTest/qtestcorelist.h', 'QtTest/QTestData', 'QtTest/qtestdata.h', 'QtTest/QTestDelayEvent', 'QtTest/QTestElement', 'QtTest/QTestElementAttribute', 'QtTest/qtestelementattribute.h', 'QtTest/qtestelement.h', 'QtTest/QTestEvent', 'QtTest/qtestevent.h', 'QtTest/QTestEventList', 'QtTest/QTestEventLoop', 'QtTest/qtesteventloop.h', 'QtTest/QTestFileLogger', 'QtTest/qtestfilelogger.h', 'QtTest/qtest_global.h', 'QtTest/qtest_gui.h', 'QtTest/qtest.h', 'QtTest/qtestkeyboard.h', 'QtTest/QTestKeyClicksEvent', 'QtTest/QTestKeyEvent', 'QtTest/QTestLightXmlStreamer', 'QtTest/qtestlightxmlstreamer.h', 'QtTest/QTestMouseEvent', 'QtTest/qtestmouse.h', 'QtTest/qtestspontaneevent.h', 'QtTest/qtestsystem.h', 'QtTest/qtesttouch.h', 'QtTest/QTestXmlStreamer', 'QtTest/qtestxmlstreamer.h', 'QtTest/QTestXunitStreamer', 'QtTest/qtestxunitstreamer.h', 'QtTest/QtTest', 'QtTest/QtTestGui', 'QtWebKit/QGraphicsWebView', 'QtWebKit/qgraphicswebview.h', 'QtWebKit/QtWebKit', 'QtWebKit/QWebDatabase', 'QtWebKit/qwebdatabase.h', 'QtWebKit/QWebElement', 'QtWebKit/QWebElementCollection', 'QtWebKit/qwebelement.h', 'QtWebKit/QWebFrame', 'QtWebKit/qwebframe.h', 'QtWebKit/QWebFullScreenVideoHandler', 'QtWebKit/QWebHapticFeedbackPlayer', 'QtWebKit/QWebHistory', 'QtWebKit/qwebhistory.h', 'QtWebKit/QWebHistoryInterface', 'QtWebKit/qwebhistoryinterface.h', 'QtWebKit/QWebHistoryItem', 'QtWebKit/QWebHitTestResult', 'QtWebKit/QWebInspector', 'QtWebKit/qwebinspector.h', 'QtWebKit/qwebkitglobal.h', 'QtWebKit/QWebKitPlatformPlugin', 'QtWebKit/qwebkitplatformplugin.h', 'QtWebKit/qwebkitversion.h', 'QtWebKit/QWebNotificationData', 'QtWebKit/QWebNotificationPresenter', 'QtWebKit/QWebPage', 'QtWebKit/qwebpage.h', 'QtWebKit/QWebPluginFactory', 'QtWebKit/qwebpluginfactory.h', 'QtWebKit/QWebScriptWorld', 'QtWebKit/qwebscriptworld.h', 'QtWebKit/QWebSecurityOrigin', 'QtWebKit/qwebsecurityorigin.h', 'QtWebKit/QWebSelectData', 'QtWebKit/QWebSelectMethod', 'QtWebKit/QWebSettings', 'QtWebKit/qwebsettings.h', 'QtWebKit/QWebTouchModifier', 'QtWebKit/QWebView', 'QtWebKit/qwebview.h', 'QtXml/QDomAttr', 'QtXml/QDomCDATASection', 'QtXml/QDomCharacterData', 'QtXml/QDomComment', 'QtXml/QDomDocument', 'QtXml/QDomDocumentFragment', 'QtXml/QDomDocumentType', 'QtXml/QDomElement', 'QtXml/QDomEntity', 'QtXml/QDomEntityReference', 'QtXml/qdom.h', 'QtXml/QDomImplementation', 'QtXml/QDomNamedNodeMap', 'QtXml/QDomNode', 'QtXml/QDomNodeList', 'QtXml/QDomNotation', 'QtXml/QDomProcessingInstruction', 'QtXml/QDomText', 'QtXml/QtXml', 'QtXml/QXmlAttributes', 'QtXml/QXmlContentHandler', 'QtXml/QXmlDeclHandler', 'QtXml/QXmlDefaultHandler', 'QtXml/QXmlDTDHandler', 'QtXml/QXmlEntityResolver', 'QtXml/QXmlErrorHandler', 'QtXml/qxml.h', 'QtXml/QXmlInputSource', 'QtXml/QXmlLexicalHandler', 'QtXml/QXmlLocator', 'QtXml/QXmlNamespaceSupport', 'QtXml/QXmlParseException', 'QtXml/QXmlReader', 'QtXml/QXmlSimpleReader', 'QtXml/QXmlStreamAttribute', 'QtXml/QXmlStreamAttributes', 'QtXml/QXmlStreamEntityDeclaration', 'QtXml/QXmlStreamEntityDeclarations', 'QtXml/QXmlStreamEntityResolver', 'QtXml/qxmlstream.h', 'QtXml/QXmlStreamNamespaceDeclaration', 'QtXml/QXmlStreamNamespaceDeclarations', 'QtXml/QXmlStreamNotationDeclaration', 'QtXml/QXmlStreamNotationDeclarations', 'QtXml/QXmlStreamReader', 'QtXml/QXmlStreamStringRef', 'QtXml/QXmlStreamWriter', 'QtXmlPatterns/QAbstractMessageHandler', 'QtXmlPatterns/qabstractmessagehandler.h', 'QtXmlPatterns/QAbstractUriResolver', 'QtXmlPatterns/qabstracturiresolver.h', 'QtXmlPatterns/QAbstractXmlNodeModel', 'QtXmlPatterns/qabstractxmlnodemodel.h', 'QtXmlPatterns/QAbstractXmlReceiver', 'QtXmlPatterns/qabstractxmlreceiver.h', 'QtXmlPatterns/QSimpleXmlNodeModel', 'QtXmlPatterns/qsimplexmlnodemodel.h', 'QtXmlPatterns/QSourceLocation', 'QtXmlPatterns/qsourcelocation.h', 'QtXmlPatterns/QtXmlPatterns', 'QtXmlPatterns/QXmlFormatter', 'QtXmlPatterns/qxmlformatter.h', 'QtXmlPatterns/QXmlItem', 'QtXmlPatterns/QXmlName', 'QtXmlPatterns/qxmlname.h', 'QtXmlPatterns/QXmlNamePool', 'QtXmlPatterns/qxmlnamepool.h', 'QtXmlPatterns/QXmlNodeModelIndex', 'QtXmlPatterns/QXmlQuery', 'QtXmlPatterns/qxmlquery.h', 'QtXmlPatterns/QXmlResultItems', 'QtXmlPatterns/qxmlresultitems.h', 'QtXmlPatterns/QXmlSchema', 'QtXmlPatterns/qxmlschema.h', 'QtXmlPatterns/QXmlSchemaValidator', 'QtXmlPatterns/qxmlschemavalidator.h', 'QtXmlPatterns/QXmlSerializer', 'QtXmlPatterns/qxmlserializer.h', )
37,545
347
package org.ovirt.engine.ui.common.widget.table.column; /** * Interface implemented by cell table {@link com.google.gwt.user.cellview.client.Column columns} whose cells render * HTML content with DOM element ID for better accessibility. */ public interface ColumnWithElementId { /** * Configure column content element ID options. * * @param elementIdPrefix * DOM element ID prefix to use for the text container element (must not be {@code null}). * @param columnId * Column ID that will be part of the resulting DOM element ID, or {@code null} to use column index * value. */ void configureElementId(String elementIdPrefix, String columnId); }
246
482
package io.cattle.platform.configitem.context.impl; import static io.cattle.platform.core.model.tables.InstanceTable.*; import io.cattle.platform.archaius.util.ArchaiusUtil; import io.cattle.platform.configitem.context.ConfigItemContextFactory; import io.cattle.platform.configitem.model.Client; import io.cattle.platform.configitem.server.model.ConfigItem; import io.cattle.platform.configitem.server.model.Request; import io.cattle.platform.configitem.server.model.impl.ArchiveContext; import io.cattle.platform.core.model.Agent; import io.cattle.platform.core.model.Instance; import io.cattle.platform.object.ObjectManager; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class AbstractAgentBaseContextFactory implements ConfigItemContextFactory { private static final Logger log = LoggerFactory.getLogger(AbstractAgentBaseContextFactory.class); protected ObjectManager objectManager; String[] items; public AbstractAgentBaseContextFactory() { String name = getClass().getSimpleName().replaceAll("Factory", "").replaceAll("([a-z])([A-Z])", "$1.$2").toLowerCase(); List<String> items = ArchaiusUtil.getList(String.format("item.context.%s.items", name)).get(); this.items = items.toArray(new String[items.size()]); } @Override public String[] getItems() { return items; } @Override public String getContentHash(String hash) { return hash; } @Override public final void populateContext(Request req, ConfigItem item, ArchiveContext context) { Client client = req.getClient(); if (!Agent.class.equals(client.getResourceType())) { return; } Agent agent = objectManager.loadResource(Agent.class, client.getResourceId()); if (agent == null) { return; } List<Instance> instances = objectManager.find(Instance.class, INSTANCE.AGENT_ID, agent.getId(), INSTANCE.REMOVED, null); if (instances.size() > 1) { List<Long> ids = new ArrayList<Long>(); for (Instance instance : instances) { ids.add(instance.getId()); } log.error("Found more that one instance for Agent [{}], instances {}", agent.getId(), ids); } populateContext(agent, instances.size() > 0 ? instances.get(0) : null, item, context); } protected abstract void populateContext(Agent agent, Instance instance, ConfigItem item, ArchiveContext context); public ObjectManager getObjectManager() { return objectManager; } @Inject public void setObjectManager(ObjectManager objectManager) { this.objectManager = objectManager; } }
1,006
516
<filename>contrib/hooks/mypy-before-push.py #!/usr/bin/env python3 """ mypy-before-push.py: Git pre-push script to make sure that you know if something you push is going to fail MyPy linting. Install with: ln -rs ./contrib/hooks/mypy-before-push.py .git/hooks/pre-push """ import sys import subprocess import os from typing import Tuple, Optional from lib import complain, announce, in_acceptable_environment, write_cache, read_cache, check_to_cache, get_current_commit def check_can_run(local_object) -> bool: """ Make sure we would be able to run mypy on the given commit. """ if not in_acceptable_environment(): announce('Environment not set up for type checking.') return False try: current_object = get_current_commit() except: announce('Currently checked-out commit cannot be determined.') return False if current_object != local_object: announce(f'Commit being pushed is not currently checked out') return False return True def check_checked_out_commit(local_object) -> bool: """ If the checked-out commit does not type-check, return false. Else, return true. """ status, log = read_cache(local_object) if status is None: announce('Commit has not been type-checked. Checking now.') status, log, _ = check_to_cache(local_object) from_cache = False else: from_cache = True if status == False: complain('Commit failed type-checking:') sys.stderr.write(log) # Type-check again in the background in case something has actually # changed about the environment. if from_cache: if os.fork() == 0: check_to_cache(local_object) sys.exit(0) else: announce('Re-checking in the background in case something changed.') return False elif status == True: announce('Commit passed type-checking.') return True def main(argc, argv): for line in sys.stdin: line = line.strip() if line == '': continue parts = line.split() # Pushes will come from standard input as: # <local ref> SP <local object name> SP <remote ref> SP <remote object name> LF # See <https://www.git-scm.com/docs/githooks#_pre_push> local_ref = parts[0] local_object = parts[1] if local_ref == '(delete)': # Deleting a branch. Nothing to do continue if not check_can_run(local_object): announce('Cannot check the commit being pushed.') return 0 if not check_checked_out_commit(local_object): complain('You should not push this. CI would fail!') return 1 return 0 if __name__ == "__main__": sys.exit(main(len(sys.argv), sys.argv))
1,161
619
<reponame>ligurio/mull<filename>tests/Helpers/InMemoryCompiler.h #pragma once #include <memory> namespace llvm { class LLVMContext; class Module; } // namespace llvm namespace mull_test { class InMemoryCompiler { public: std::unique_ptr<llvm::Module> compile(const std::string &code, const std::string &inMemoryFileName, llvm::LLVMContext &context); }; } // namespace mull_test
132
556
<filename>tests/commit/vis/test__matplotlib_plots.py<gh_stars>100-1000 from unittest import TestCase from phi.field import CenteredGrid, StaggeredGrid, PointCloud, Noise from phi.geom import Sphere, Box from phi.math import extrapolation, wrap, instance, channel, batch from phi.vis._matplotlib._matplotlib_plots import plot from phi.vis import show import matplotlib.pyplot as plt class TestMatplotlibPlots(TestCase): def test_plot_scalar_grid(self): plt.close() grid = CenteredGrid(Noise(), extrapolation.ZERO, x=64, y=8, bounds=Box(0, [1, 1])) fig = plot(grid) assert isinstance(fig, plt.Figure) plt.show() def test_plot_scalar_batch(self): plt.close() grid = CenteredGrid(Noise(batch(b=2)), extrapolation.ZERO, bounds=Box[0:1, 0:1], x=10, y=10) fig = plot(grid) assert isinstance(fig, plt.Figure) show() def test_plot_vector_grid(self): plt.close() grid = CenteredGrid(Noise(vector=2), extrapolation.ZERO, x=64, y=8, bounds=Box(0, [1, 1])) * 0.1 fig = plot(grid) assert isinstance(fig, plt.Figure) plt.show() def test_plot_vector_batch(self): plt.close() grid = CenteredGrid(Noise(batch(b=2), vector=2), extrapolation.ZERO, bounds=Box[0:1, 0:1], x=10, y=10) fig = plot(grid * 0.1) assert isinstance(fig, plt.Figure) show() def test_plot_staggered_grid(self): plt.close() grid = StaggeredGrid(Noise(), extrapolation.ZERO, x=16, y=10, bounds=Box(0, [1, 1])) * 0.1 fig = plot(grid) assert isinstance(fig, plt.Figure) plt.show() def test_plot_point_cloud(self): plt.close() points = wrap([(.2, .4), (.9, .8)], instance('points'), channel('vector')) cloud = PointCloud(Sphere(points, radius=.1)) fig = plot(cloud) assert isinstance(fig, plt.Figure) plt.show() def test_plot_point_cloud_bounded(self): plt.close() points = wrap([(.2, .4), (.9, .8)], instance('points'), channel('vector')) cloud = PointCloud(Sphere(points, radius=0.1), bounds=Box(0, [1, 1])) fig = plot(cloud) assert isinstance(fig, plt.Figure) plt.show() def test_plot_multiple(self): plt.close() grid = CenteredGrid(Noise(), extrapolation.ZERO, Box[0:1, 0:1], x=50, y=10) grid2 = CenteredGrid(grid, extrapolation.ZERO, Box[0:2, 0:1], x=20, y=50) points = wrap([(.2, .4), (.9, .8)], instance('points'), channel('vector')) cloud = PointCloud(Sphere(points, radius=0.1), bounds=Box(0, [1, 1])) fig = plot([grid, grid2, cloud]) assert isinstance(fig, plt.Figure) plt.show()
1,261
320
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.jme3.gde.behaviortrees.nodes; import com.jme3.gde.behaviortrees.navigator.BTreeNavigatorPanel; import java.beans.PropertyVetoException; import org.openide.explorer.ExplorerManager; import org.openide.explorer.view.BeanTreeView; import org.openide.nodes.Node; /** * * @author MeFisto94 */ public class CustomBeanTreeView extends BeanTreeView { protected BTreeNavigatorPanel nav; public CustomBeanTreeView(BTreeNavigatorPanel nav) { this.nav = nav; } @Override protected void selectionChanged(Node[] nodes, ExplorerManager em) throws PropertyVetoException { super.selectionChanged(nodes, em); nav.selectionChanged(nodes, em); } }
308
3,673
// ---------------------------------------------------------------------------- // - Open3D: www.open3d.org - // ---------------------------------------------------------------------------- // The MIT License (MIT) // // Copyright (c) 2018-2021 www.open3d.org // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. // ---------------------------------------------------------------------------- // // Reference: // https://github.com/open-mmlab/OpenPCDet/blob/master/pcdet/ops/iou3d_nms/src/iou3d_nms_kernel.cu // // Reference: // https://github.com/open-mmlab/mmdetection3d/blob/master/mmdet3d/ops/iou3d/src/iou3d_kernel.cu // 3D IoU Calculation and Rotated NMS(modified from 2D NMS written by others) // Written by <NAME> // All Rights Reserved 2019-2020. #pragma once #include <cstdint> #include <vector> namespace open3d { namespace ml { namespace contrib { #ifdef BUILD_CUDA_MODULE /// \param boxes (n, 5) float32. /// \param scores (n,) float32. /// \param n Number of boxes. /// \param nms_overlap_thresh When a high-score box is selected, other remaining /// boxes with IoU > nms_overlap_thresh will be discarded. /// \return Selected box indices to keep. std::vector<int64_t> NmsCUDAKernel(const float *boxes, const float *scores, int n, double nms_overlap_thresh); #endif /// \param boxes (n, 5) float32. /// \param scores (n,) float32. /// \param n Number of boxes. /// \param nms_overlap_thresh When a high-score box is selected, other remaining /// boxes with IoU > nms_overlap_thresh will be discarded. /// \return Selected box indices to keep. std::vector<int64_t> NmsCPUKernel(const float *boxes, const float *scores, int n, double nms_overlap_thresh); } // namespace contrib } // namespace ml } // namespace open3d
1,062
317
<filename>cle/backends/externs/simdata/__init__.py<gh_stars>100-1000 from collections import defaultdict from typing import List from ...relocation import Relocation from ...symbol import Symbol, SymbolType # pylint: disable=unused-argument,no-self-use class SimData(Symbol): """ A SimData class is used to provide data when there is an unresolved data import symbol. To use it, subclass this class and implement the below attributes and methods. :cvar name: The name of the symbol to provide :cvar libname: The name of the library from which the symbol originally comes (currently unused). :cvar type: The type of the symbol, usually ``SymbolType.TYPE_OBJECT``. Use the below `register` method to register SimData subclasses with CLE. NOTE: SimData.type hides the Symbol.type instance property """ name = NotImplemented # type: str type = NotImplemented # type: SymbolType libname = NotImplemented # type: str @classmethod def static_size(cls, owner) -> int: """ Implement me: return the size of the symbol in bytes before it gets constructed :param owner: The ExternObject owning the symbol-to-be. Useful to get at ``owner.arch``. """ return NotImplemented def value(self) -> bytes: """ Implement me: the initial value of the bytes in memory for the symbol. Should return a bytestring of the same length as static_size returned. (owner is ``self.owner`` now) """ return NotImplemented def relocations(self) -> List[Relocation]: """ Maybe implement me: If you like, return a list of relocation objects to apply. To create new import symbols, use ``self.owner.make_extern_import``. """ return [] registered_data = defaultdict(list) def register(simdata_cls): """ Register the given SimData class with CLE so it may be used during loading """ if simdata_cls.name is None: return registered_data[simdata_cls.name].append(simdata_cls) def lookup(name, libname): weak_option = None for simdata_cls in registered_data[name]: if type(libname) is type(simdata_cls.libname) is str and simdata_cls.libname.startswith(libname): return simdata_cls elif simdata_cls is None or libname is None: weak_option = simdata_cls return weak_option # pylint: disable=unused-import from . import io_file from . import glibc_startup
890
762
#pragma once #include "InputTypes.hpp" #include "Callbacks/InputCallbacks.hpp" namespace flex { class GameObject; class Editor { public: Editor(); void Initialize(); void PostInitialize(); void Destroy(); void EarlyUpdate(); void LateUpdate(); void PreSceneChange(); void OnSceneChanged(); std::vector<GameObjectID> GetSelectedObjectIDs(bool bForceIncludeChildren = false) const; GameObjectID GetFirstSelectedObjectID() const; void SetSelectedObject(const GameObjectID& gameObjectID, bool bSelectChildren = false); void SetSelectedObjects(const std::vector<GameObjectID>& selectedObjects); bool HasSelectedObject() const; void ToggleSelectedObject(const GameObjectID& gameObjectID); void AddSelectedObject(const GameObjectID& gameObjectID); void SelectAll(); void DeselectObject(const GameObjectID& gameObjectID); bool IsObjectSelected(const GameObjectID& gameObjectID); glm::vec3 GetSelectedObjectsCenter(); void SelectNone(); real CalculateDeltaRotationFromGizmoDrag( const glm::vec3& axis, const glm::vec3& rayOrigin, const glm::vec3& rayEnd, glm::vec3* outIntersectionPoint); void UpdateGizmoVisibility(); void SetTransformState(TransformState state); bool GetWantRenameActiveElement() const; void ClearWantRenameActiveElement(); TransformState GetTransformState() const; void CalculateSelectedObjectsCenter(); bool IsDraggingGizmo() const; bool HandleGizmoHover(); void HandleGizmoClick(); void HandleGizmoMovement(); bool HandleObjectClick(); void OnDragDrop(i32 count, const char** paths); bool IsShowingGrid() const; void SetShowGrid(bool bShowGrid); // ImGui payload identifiers static const char* MaterialPayloadCStr; static const char* MeshPayloadCStr; static const char* PrefabPayloadCStr; static const char* GameObjectPayloadCStr; static const char* AudioFileNameSIDPayloadCStr; private: EventReply OnMouseButtonEvent(MouseButton button, KeyAction action); MouseButtonCallback<Editor> m_MouseButtonCallback; EventReply OnMouseMovedEvent(const glm::vec2& dMousePos); MouseMovedCallback<Editor> m_MouseMovedCallback; EventReply OnKeyEvent(KeyCode keyCode, KeyAction action, i32 modifiers); KeyEventCallback<Editor> m_KeyEventCallback; EventReply OnActionEvent(Action action, ActionEvent actionEvent); ActionCallback<Editor> m_ActionCallback; void CreateObjects(); void FadeOutHeadOnGizmos(); btVector3 GetAxisColour(i32 axisIndex) const; // Parent of translation, rotation, and scale gizmo objects GameObject* m_TransformGizmo = nullptr; // Children of m_TransformGizmo GameObject* m_TranslationGizmo = nullptr; GameObject* m_RotationGizmo = nullptr; GameObject* m_ScaleGizmo = nullptr; GameObject* m_TestShape = nullptr; GameObject* m_GridObject = nullptr; MaterialID m_TransformGizmoMatXID = InvalidMaterialID; MaterialID m_TransformGizmoMatYID = InvalidMaterialID; MaterialID m_TransformGizmoMatZID = InvalidMaterialID; MaterialID m_TransformGizmoMatAllID = InvalidMaterialID; TransformState m_CurrentTransformGizmoState = TransformState::TRANSLATE; const std::string m_TranslationGizmoTag = "translation-gizmo"; const std::string m_RotationGizmoTag = "rotation-gizmo"; const std::string m_ScaleGizmoTag = "scale-gizmo"; // True for one frame after the mouse has been released after being pressed at the same location glm::vec2i m_LMBDownPos; glm::vec3 m_SelectedObjectDragStartPos; glm::quat m_SelectedObjectDragStartRot; glm::vec3 m_DraggingGizmoScaleLast; real m_DraggingGizmoOffset = 0.0f; // How far along the axis the cursor was when pressed glm::vec3 m_PreviousIntersectionPoint; bool m_DraggingGizmoOffsetNeedsRecalculation = true; bool m_bFirstFrameDraggingRotationGizmo = false; glm::vec3 m_AxisProjectedOnto; glm::vec3 m_StartPointOnPlane; glm::vec3 m_LatestRayPlaneIntersection; i32 m_RotationGizmoWrapCount = 0; real m_LastAngle = -1.0f; glm::vec3 m_PlaneN; glm::vec3 m_AxisOfRotation; bool m_bLastDotPos = false; bool m_bShowGrid = false; // TODO: EZ: Define these in config file real m_ScaleDragSpeed = 0.05f; real m_ScaleSlowDragSpeedMultiplier = 0.2f; real m_ScaleFastDragSpeedMultiplier = 2.5f; bool m_bDraggingGizmo = false; i32 m_DraggingAxisIndex = -1; i32 m_HoveringAxisIndex = -1; std::vector<GameObjectID> m_CurrentlySelectedObjectIDs; glm::vec3 m_SelectedObjectsCenterPos; glm::quat m_SelectedObjectRotation; bool m_bWantRenameActiveElement = false; }; } // namespace flex
1,604
1,091
/* * Copyright 2018-present Open Networking Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onosproject.openstacknetworking.impl; import org.openstack4j.model.network.RouterInterface; /** * Test implementation class of router interface. */ public final class TestRouterInterface implements RouterInterface { private final String id; private final String subnetId; private final String portId; private final String tenantId; public TestRouterInterface(String id, String subnetId, String portId, String tenantId) { this.id = id; this.subnetId = subnetId; this.portId = portId; this.tenantId = tenantId; } @Override public String getId() { return id; } @Override public String getSubnetId() { return subnetId; } @Override public String getPortId() { return portId; } @Override public String getTenantId() { return tenantId; } }
522
330
// Copyright 2019-2021 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "string.h" #include "unity.h" #include "test_utils.h" #include "esp_usbh_cdc.h" #define IN_RINGBUF_SIZE (1024 * 16) #define OUT_RINGBUF_SIZE (1024 * 16) static usb_desc_ep_t bulk_out_ep_desc = { .bLength = sizeof(usb_desc_ep_t), .bDescriptorType = USB_B_DESCRIPTOR_TYPE_ENDPOINT, .bEndpointAddress = 0x01, //EP 1 OUT .bmAttributes = USB_BM_ATTRIBUTES_XFER_BULK, .wMaxPacketSize = 64, //MPS of 64 bytes .bInterval = 0, }; static usb_desc_ep_t bulk_in_ep_desc = { .bLength = sizeof(usb_desc_ep_t), .bDescriptorType = USB_B_DESCRIPTOR_TYPE_ENDPOINT, .bEndpointAddress = 0x81, //EP 2 IN .bmAttributes = USB_BM_ATTRIBUTES_XFER_BULK, .wMaxPacketSize = 64, //MPS of 64 bytes .bInterval = 0, }; static void uart_event_task_entry(void *param) { //ulTaskNotifyTake(pdTRUE, portMAX_DELAY); size_t data_len = 0; uint8_t buf[256]; while (1) { usbh_cdc_get_buffered_data_len(&data_len); if (data_len == 0 || data_len > 256) { vTaskDelay(1); continue; } usbh_cdc_read_bytes(buf, data_len, 10); ESP_LOGI(TAG, "RCV %d: %.*s", data_len, data_len, buf); } } TEST_CASE("usb cdc R/W", "[esp_usbh_cdc]") { static usbh_cdc_config_t config = { .bulk_in_ep = &bulk_in_ep_desc, .bulk_out_ep = &bulk_out_ep_desc, .rx_buffer_size = IN_RINGBUF_SIZE, .tx_buffer_size = OUT_RINGBUF_SIZE, }; esp_err_t ret = usbh_cdc_driver_install(&config); assert(ret == ESP_OK); ret = xTaskCreate(uart_event_task_entry, //Task Entry "uart_event", //Task Name 2048, //Task Stack Size(Bytes) NULL, //Task Parameter 2, //Task Priority NULL //Task Handler ); uint8_t buff[] = "AT\r\n"; while (1) { usbh_cdc_write_bytes(buff, 4); vTaskDelay(100); } }
1,361
623
/* * Zed Attack Proxy (ZAP) and its related class files. * * ZAP is an HTTP/HTTPS proxy for assessing web application security. * * Copyright 2015 The ZAP Development Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.zaproxy.zap.extension.fuzz.payloads.ui.processors; import javax.swing.ButtonGroup; import javax.swing.GroupLayout; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import org.parosproxy.paros.Constant; import org.zaproxy.zap.extension.fuzz.payloads.DefaultPayload; import org.zaproxy.zap.extension.fuzz.payloads.processor.ExpandStringProcessor; import org.zaproxy.zap.extension.fuzz.payloads.ui.processors.ExpandStringProcessorUIHandler.ExpandStringProcessorUI; import org.zaproxy.zap.model.MessageLocation; import org.zaproxy.zap.utils.ZapNumberSpinner; import org.zaproxy.zap.utils.ZapTextField; public class ExpandStringProcessorUIHandler implements PayloadProcessorUIHandler< DefaultPayload, ExpandStringProcessor, ExpandStringProcessorUI> { private static final String PROCESSOR_NAME = Constant.messages.getString("fuzz.payload.processor.expand.name"); @Override public String getName() { return PROCESSOR_NAME; } @Override public Class<ExpandStringProcessorUI> getPayloadProcessorUIClass() { return ExpandStringProcessorUI.class; } @Override public Class<ExpandStringProcessorUIPanel> getPayloadProcessorUIPanelClass() { return ExpandStringProcessorUIPanel.class; } @Override public ExpandStringProcessorUIPanel createPanel() { return new ExpandStringProcessorUIPanel(); } public static class ExpandStringProcessorUI implements PayloadProcessorUI<DefaultPayload, ExpandStringProcessor> { private final boolean begin; private final String value; private final int length; public ExpandStringProcessorUI(boolean begin, String value, int length) { this.begin = begin; this.value = value; this.length = length; } public boolean isBegin() { return begin; } public String getValue() { return value; } public int getLength() { return length; } @Override public Class<ExpandStringProcessor> getPayloadProcessorClass() { return ExpandStringProcessor.class; } @Override public String getName() { return PROCESSOR_NAME; } @Override public boolean isMutable() { return true; } @Override public String getDescription() { String positionMessage = begin ? Constant.messages.getString( "fuzz.payload.processor.expand.description.position.begin") : Constant.messages.getString( "fuzz.payload.processor.expand.description.position.end"); return Constant.messages.getString( "fuzz.payload.processor.expand.description", Integer.valueOf(getLength()), getValue(), positionMessage); } @Override public ExpandStringProcessor getPayloadProcessor() { ExpandStringProcessor.Position position = (isBegin() ? ExpandStringProcessor.Position.BEGIN : ExpandStringProcessor.Position.END); return new ExpandStringProcessor(position, getValue(), getLength()); } @Override public ExpandStringProcessorUI copy() { return this; } } public static class ExpandStringProcessorUIPanel implements PayloadProcessorUIPanel< DefaultPayload, ExpandStringProcessor, ExpandStringProcessorUI> { private static final String POSITION_FIELD_LABEL = Constant.messages.getString("fuzz.payload.processor.expand.position.label"); private static final String BEGIN_POSITION_FIELD_LABEL = Constant.messages.getString("fuzz.payload.processor.expand.position.begin.label"); private static final String END_POSITION_FIELD_LABEL = Constant.messages.getString("fuzz.payload.processor.expand.position.end.label"); private static final String VALUE_FIELD_LABEL = Constant.messages.getString("fuzz.payload.processor.expand.value.label"); private static final String LENGTH_FIELD_LABEL = Constant.messages.getString("fuzz.payload.processor.expand.length.label"); private JPanel fieldsPanel; private JRadioButton beginPositionRadioButton; private JRadioButton endPositionRadioButton; private ZapTextField valueTextField; private ZapNumberSpinner lengthNumberSpinner; public ExpandStringProcessorUIPanel() { fieldsPanel = new JPanel(); GroupLayout layout = new GroupLayout(fieldsPanel); fieldsPanel.setLayout(layout); layout.setAutoCreateGaps(true); ButtonGroup positionsButtonGroup = new ButtonGroup(); positionsButtonGroup.add(getBeginPositionRadioButton()); positionsButtonGroup.add(getEndPositionRadioButton()); getBeginPositionRadioButton().setSelected(true); JLabel positionLabel = new JLabel(POSITION_FIELD_LABEL); positionLabel.setLabelFor(getBeginPositionRadioButton()); JLabel valueLabel = new JLabel(VALUE_FIELD_LABEL); valueLabel.setLabelFor(getValueTextField()); JLabel lengthLabel = new JLabel(LENGTH_FIELD_LABEL); lengthLabel.setLabelFor(getLengthNumberSpinner()); layout.setHorizontalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(positionLabel) .addComponent(valueLabel) .addComponent(lengthLabel)) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING) .addComponent( getBeginPositionRadioButton()) .addComponent( getEndPositionRadioButton())) .addComponent(getValueTextField()) .addComponent(getLengthNumberSpinner()))); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(positionLabel) .addGroup( GroupLayout.Alignment.BASELINE, layout.createSequentialGroup() .addComponent( getBeginPositionRadioButton()) .addComponent( getEndPositionRadioButton()))) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(valueLabel) .addComponent(getValueTextField())) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lengthLabel) .addComponent(getLengthNumberSpinner()))); } @Override public JPanel getComponent() { return fieldsPanel; } private ZapTextField getValueTextField() { if (valueTextField == null) { valueTextField = new ZapTextField(); valueTextField.setColumns(25); } return valueTextField; } private JRadioButton getBeginPositionRadioButton() { if (beginPositionRadioButton == null) { beginPositionRadioButton = new JRadioButton(BEGIN_POSITION_FIELD_LABEL); } return beginPositionRadioButton; } private JRadioButton getEndPositionRadioButton() { if (endPositionRadioButton == null) { endPositionRadioButton = new JRadioButton(END_POSITION_FIELD_LABEL); } return endPositionRadioButton; } private ZapNumberSpinner getLengthNumberSpinner() { if (lengthNumberSpinner == null) { lengthNumberSpinner = new ZapNumberSpinner(1, 1, Integer.MAX_VALUE); } return lengthNumberSpinner; } @Override public void init(MessageLocation messageLocation) { getLengthNumberSpinner().setValue(Math.max(messageLocation.getValue().length(), 1)); } @Override public ExpandStringProcessorUI getPayloadProcessorUI() { return new ExpandStringProcessorUI( getBeginPositionRadioButton().isSelected(), getValueTextField().getText(), getLengthNumberSpinner().getValue().intValue()); } @Override public void setPayloadProcessorUI(ExpandStringProcessorUI payloadProcessorUI) { if (payloadProcessorUI.isBegin()) { getBeginPositionRadioButton().setSelected(true); } else { getEndPositionRadioButton().setSelected(true); } getValueTextField().setText(payloadProcessorUI.getValue()); getLengthNumberSpinner().setValue(payloadProcessorUI.getLength()); } @Override public void clear() { getValueTextField().setText(""); getValueTextField().discardAllEdits(); getBeginPositionRadioButton().setSelected(true); getLengthNumberSpinner().setValue(1); } @Override public boolean validate() { if (getValueTextField().getText().isEmpty()) { JOptionPane.showMessageDialog( null, Constant.messages.getString( "fuzz.payload.processor.expand.warnNoValue.message"), Constant.messages.getString( "fuzz.payload.processor.expand.warnNoValue.title"), JOptionPane.INFORMATION_MESSAGE); getValueTextField().requestFocusInWindow(); return false; } return true; } @Override public ExpandStringProcessor getPayloadProcessor() { if (!validate()) { return null; } ExpandStringProcessor.Position position = (getBeginPositionRadioButton().isSelected() ? ExpandStringProcessor.Position.BEGIN : ExpandStringProcessor.Position.END); return new ExpandStringProcessor( position, getValueTextField().getText(), getLengthNumberSpinner().getValue().intValue()); } @Override public String getHelpTarget() { return "addon.fuzzer.processors"; } } }
6,456
4,857
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hbase.master.balancer; import java.io.IOException; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.ClusterMetrics; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.master.RegionPlan; import org.apache.yetus.audience.InterfaceAudience; /** * a balancer which is only used in maintenance mode. */ @InterfaceAudience.Private public class MaintenanceLoadBalancer implements LoadBalancer { private volatile boolean stopped = false; @Override public void stop(String why) { stopped = true; } @Override public boolean isStopped() { return stopped; } @Override public void updateClusterMetrics(ClusterMetrics st) { } @Override public void setClusterInfoProvider(ClusterInfoProvider provider) { } @Override public List<RegionPlan> balanceCluster( Map<TableName, Map<ServerName, List<RegionInfo>>> loadOfAllTable) throws IOException { // do not need to balance in maintenance mode return Collections.emptyList(); } private Map<ServerName, List<RegionInfo>> assign(Collection<RegionInfo> regions, List<ServerName> servers) { // should only have 1 region server in maintenance mode assert servers.size() == 1; List<RegionInfo> systemRegions = regions.stream().filter(r -> r.getTable().isSystemTable()).collect(Collectors.toList()); if (!systemRegions.isEmpty()) { return Collections.singletonMap(servers.get(0), systemRegions); } else { return Collections.emptyMap(); } } @Override public Map<ServerName, List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) throws IOException { return assign(regions, servers); } @Override public Map<ServerName, List<RegionInfo>> retainAssignment(Map<RegionInfo, ServerName> regions, List<ServerName> servers) throws IOException { return assign(regions.keySet(), servers); } @Override public ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers) throws IOException { // should only have 1 region server in maintenance mode assert servers.size() == 1; return regionInfo.getTable().isSystemTable() ? servers.get(0) : null; } @Override public void initialize() { } @Override public void regionOnline(RegionInfo regionInfo, ServerName sn) { } @Override public void regionOffline(RegionInfo regionInfo) { } @Override public void onConfigurationChange(Configuration conf) { } @Override public void postMasterStartupInitialize() { } @Override public void updateBalancerStatus(boolean status) { } }
1,113
777
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/android/scoped_java_ref.h" #include "cc/layers/layer.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/android/overscroll_refresh.h" #include "ui/android/overscroll_refresh_handler.h" namespace ui { class OverscrollRefreshTest : public OverscrollRefreshHandler, public testing::Test { public: OverscrollRefreshTest() : OverscrollRefreshHandler(nullptr) {} // OverscrollRefreshHandler implementation. bool PullStart() override { started_ = true; return true; } void PullUpdate(float delta) override { delta_ += delta; } void PullRelease(bool allow_refresh) override { released_ = true; refresh_allowed_ = allow_refresh; } void PullReset() override { reset_ = true; } bool GetAndResetPullStarted() { bool result = started_; started_ = false; return result; } float GetAndResetPullDelta() { float result = delta_; delta_ = 0; return result; } bool GetAndResetPullReleased() { bool result = released_; released_ = false; return result; } bool GetAndResetRefreshAllowed() { bool result = refresh_allowed_; refresh_allowed_ = false; return result; } bool GetAndResetPullReset() { bool result = reset_; reset_ = false; return result; } private: float delta_ = 0; bool started_ = false; bool released_ = false; bool reset_ = false; bool refresh_allowed_ = false; }; TEST_F(OverscrollRefreshTest, Basic) { OverscrollRefresh effect(this); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); effect.OnScrollBegin(); EXPECT_FALSE(effect.IsActive()); EXPECT_TRUE(effect.IsAwaitingScrollUpdateAck()); // The initial scroll should not be consumed, as it should first be offered // to content. gfx::Vector2dF scroll_up(0, 10); EXPECT_FALSE(effect.WillHandleScrollUpdate(scroll_up)); EXPECT_FALSE(effect.IsActive()); EXPECT_TRUE(effect.IsAwaitingScrollUpdateAck()); // The unconsumed, overscrolling scroll will trigger the effect. effect.OnScrollUpdateAck(false); EXPECT_TRUE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); EXPECT_TRUE(GetAndResetPullStarted()); // Further scrolls will be consumed. EXPECT_TRUE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 50))); EXPECT_EQ(50.f, GetAndResetPullDelta()); EXPECT_TRUE(effect.IsActive()); // Even scrolls in the down direction should be consumed. EXPECT_TRUE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, -50))); EXPECT_EQ(-50.f, GetAndResetPullDelta()); EXPECT_TRUE(effect.IsActive()); // Ending the scroll while beyond the threshold should trigger a refresh. gfx::Vector2dF zero_velocity; EXPECT_FALSE(GetAndResetPullReleased()); effect.OnScrollEnd(zero_velocity); EXPECT_FALSE(effect.IsActive()); EXPECT_TRUE(GetAndResetPullReleased()); EXPECT_TRUE(GetAndResetRefreshAllowed()); } TEST_F(OverscrollRefreshTest, NotTriggeredIfInitialYOffsetIsNotZero) { OverscrollRefresh effect(this); // A positive y scroll offset at the start of scroll will prevent activation, // even if the subsequent scroll overscrolls upward. gfx::Vector2dF nonzero_offset(0, 10); bool overflow_y_hidden = false; effect.OnFrameUpdated(nonzero_offset, overflow_y_hidden); effect.OnScrollBegin(); effect.OnFrameUpdated(gfx::Vector2dF(), overflow_y_hidden); ASSERT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 10))); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); effect.OnScrollUpdateAck(false); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); EXPECT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 500))); effect.OnScrollEnd(gfx::Vector2dF()); EXPECT_FALSE(GetAndResetPullStarted()); EXPECT_FALSE(GetAndResetPullReleased()); } TEST_F(OverscrollRefreshTest, NotTriggeredIfOverflowYHidden) { OverscrollRefresh effect(this); // overflow-y:hidden at the start of scroll will prevent activation. gfx::Vector2dF zero_offset; bool overflow_y_hidden = true; effect.OnFrameUpdated(zero_offset, overflow_y_hidden); effect.OnScrollBegin(); ASSERT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 10))); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); effect.OnScrollUpdateAck(false); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); EXPECT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 500))); effect.OnScrollEnd(gfx::Vector2dF()); EXPECT_FALSE(GetAndResetPullStarted()); EXPECT_FALSE(GetAndResetPullReleased()); } TEST_F(OverscrollRefreshTest, NotTriggeredIfInitialScrollDownward) { OverscrollRefresh effect(this); effect.OnScrollBegin(); // A downward initial scroll will prevent activation, even if the subsequent // scroll overscrolls upward. ASSERT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, -10))); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); effect.OnScrollUpdateAck(false); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); EXPECT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 500))); effect.OnScrollEnd(gfx::Vector2dF()); EXPECT_FALSE(GetAndResetPullReleased()); } TEST_F(OverscrollRefreshTest, NotTriggeredIfInitialScrollOrTouchConsumed) { OverscrollRefresh effect(this); effect.OnScrollBegin(); ASSERT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 10))); ASSERT_TRUE(effect.IsAwaitingScrollUpdateAck()); // Consumption of the initial touchmove or scroll should prevent future // activation. effect.OnScrollUpdateAck(true); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); EXPECT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 500))); effect.OnScrollUpdateAck(false); EXPECT_FALSE(effect.IsActive()); EXPECT_FALSE(effect.IsAwaitingScrollUpdateAck()); EXPECT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 500))); effect.OnScrollEnd(gfx::Vector2dF()); EXPECT_FALSE(GetAndResetPullStarted()); EXPECT_FALSE(GetAndResetPullReleased()); } TEST_F(OverscrollRefreshTest, NotTriggeredIfFlungDownward) { OverscrollRefresh effect(this); effect.OnScrollBegin(); ASSERT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 10))); ASSERT_TRUE(effect.IsAwaitingScrollUpdateAck()); effect.OnScrollUpdateAck(false); ASSERT_TRUE(effect.IsActive()); EXPECT_TRUE(GetAndResetPullStarted()); // Terminating the pull with a down-directed fling should prevent triggering. effect.OnScrollEnd(gfx::Vector2dF(0, -1000)); EXPECT_TRUE(GetAndResetPullReleased()); EXPECT_FALSE(GetAndResetRefreshAllowed()); } TEST_F(OverscrollRefreshTest, NotTriggeredIfReleasedWithoutActivation) { OverscrollRefresh effect(this); effect.OnScrollBegin(); ASSERT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 10))); ASSERT_TRUE(effect.IsAwaitingScrollUpdateAck()); effect.OnScrollUpdateAck(false); ASSERT_TRUE(effect.IsActive()); EXPECT_TRUE(GetAndResetPullStarted()); // An early release should prevent the refresh action from firing. effect.ReleaseWithoutActivation(); effect.OnScrollEnd(gfx::Vector2dF()); EXPECT_TRUE(GetAndResetPullReleased()); EXPECT_FALSE(GetAndResetRefreshAllowed()); } TEST_F(OverscrollRefreshTest, NotTriggeredIfReset) { OverscrollRefresh effect(this); effect.OnScrollBegin(); ASSERT_FALSE(effect.WillHandleScrollUpdate(gfx::Vector2dF(0, 10))); ASSERT_TRUE(effect.IsAwaitingScrollUpdateAck()); effect.OnScrollUpdateAck(false); ASSERT_TRUE(effect.IsActive()); EXPECT_TRUE(GetAndResetPullStarted()); // An early reset should prevent the refresh action from firing. effect.Reset(); EXPECT_TRUE(GetAndResetPullReset()); effect.OnScrollEnd(gfx::Vector2dF()); EXPECT_FALSE(GetAndResetPullReleased()); } } // namespace ui
2,866
12,862
{ "authors": [ "<NAME> <<EMAIL>>", "<NAME> <<EMAIL>>" ], "license": "MIT", "description": "Ethereum Token Contracts", "keywords": [ "tokens", "consensys" ], "links": {}, "sources": [ "./contracts/Migrations.sol", "./contracts/eip20/EIP20.sol", "./contracts/eip20/EIP20Factory.sol", "./contracts/eip20/EIP20Interface.sol" ], "dependencies": {}, "manifest_version": 1, "package_name": "tokens", "version": "1.0.0" }
216
14,668
#!/usr/bin/env python3 # Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest import tempfile import textwrap import os import json_gn_editor class BuildFileTest(unittest.TestCase): def test_avoid_reformatting_gn_file_if_no_ast_changed(self): text = textwrap.dedent('''\ android_library("target_name") { deps =[":local_dep"]} #shouldn't change ''') with tempfile.NamedTemporaryFile(mode='w') as f: f.write(text) f.flush() with json_gn_editor.BuildFile(f.name, '/') as build_file: pass with open(f.name, 'r') as f_after: self.assertEqual(f_after.read(), text) def test_split_dep_works_for_full_relative_abs_deps(self): with tempfile.TemporaryDirectory() as rootdir: java_subdir = os.path.join(rootdir, 'java') os.mkdir(java_subdir) build_gn_path = os.path.join(java_subdir, 'BUILD.gn') with open(build_gn_path, 'w') as f: f.write( textwrap.dedent('''\ android_library("java") { } android_library("target1") { deps = [ "//java:java" ] } android_library("target2") { deps += [ ":java" ] } android_library("target3") { public_deps = [ "//java" ] } ''')) with json_gn_editor.BuildFile(build_gn_path, rootdir) as build_file: # Test both explicit and implied dep resolution works. build_file.split_dep('//java:java', '//other_dir:other_dep') build_file.split_dep('//java', '//other_dir:other_dep2') with open(build_gn_path, 'r') as f: self.assertEqual( f.read(), textwrap.dedent('''\ android_library("java") { } android_library("target1") { deps = [ "//java:java", "//other_dir:other_dep", "//other_dir:other_dep2", ] } android_library("target2") { deps += [ ":java", "//other_dir:other_dep", "//other_dir:other_dep2", ] } android_library("target3") { public_deps = [ "//java", "//other_dir:other_dep", "//other_dir:other_dep2", ] } ''')) def test_split_dep_does_not_duplicate_deps(self): with tempfile.TemporaryDirectory() as rootdir: java_subdir = os.path.join(rootdir, 'java') os.mkdir(java_subdir) build_gn_path = os.path.join(java_subdir, 'BUILD.gn') with open(build_gn_path, 'w') as f: f.write( textwrap.dedent('''\ android_library("target") { deps = [ "//java", "//other_dir:other_dep", ] } ''')) with json_gn_editor.BuildFile(build_gn_path, rootdir) as build_file: build_file.split_dep('//java:java', '//other_dir:other_dep') with open(build_gn_path, 'r') as f: self.assertEqual( f.read(), textwrap.dedent('''\ android_library("target") { deps = [ "//java", "//other_dir:other_dep", ] } ''')) if __name__ == '__main__': unittest.main()
2,231
599
""" General utilities. """ import os import shutil from functools import partial import torch import random import warnings import requests from tqdm import tqdm import torch.backends.cudnn as cudnn import torch.nn.init as init from fsgan.utils.obj_factory import extract_args, obj_factory def init_weights(m, init_type='normal', gain=0.02): """ Randomly initialize a module's weights. Args: m (nn.Module): The module to initialize its weights init_type (str): Initialization type: 'normal', 'xavier', 'kaiming', or 'orthogonal' gain (float): Standard deviation of the normal distribution """ classname = m.__class__.__name__ if hasattr(m, 'weight') and (classname.find('Conv') != -1 or classname.find('Linear') != -1): if init_type == 'normal': init.normal_(m.weight.data, 0.0, gain) elif init_type == 'xavier': init.xavier_normal_(m.weight.data, gain=gain) elif init_type == 'kaiming': init.kaiming_normal_(m.weight.data, a=0, mode='fan_in') elif init_type == 'orthogonal': init.orthogonal_(m.weight.data, gain=gain) else: raise NotImplementedError('initialization method [%s] is not implemented' % init_type) if hasattr(m, 'bias') and m.bias is not None: init.constant_(m.bias.data, 0.0) elif classname.find('BatchNorm2d') != -1 or classname.find('BatchNorm3d') != -1: init.normal_(m.weight.data, 1.0, gain) init.constant_(m.bias.data, 0.0) def set_device(gpus=None, use_cuda=True): """ Sets computing device. Either the CPU or any of the available GPUs. Args: gpus (list of int, optional): The GPU ids to use. If not specified, all available GPUs will be used use_cuda (bool, optional): If True, CUDA enabled GPUs will be used, else the CPU will be used Returns: torch.device: The selected computing device. """ use_cuda = torch.cuda.is_available() if use_cuda else use_cuda if use_cuda: gpus = list(range(torch.cuda.device_count())) if not gpus else gpus print('=> using GPU devices: {}'.format(', '.join(map(str, gpus)))) else: gpus = None print('=> using CPU device') device = torch.device('cuda:{}'.format(gpus[0])) if gpus else torch.device('cpu') return device, gpus def set_seed(seed): """ Sets computing device. Either the CPU or any of the available GPUs. Args: gpus (list of int, optional): The GPU ids to use. If not specified, all available GPUs will be used use_cuda (bool, optional): If True, CUDA enabled GPUs will be used, else the CPU will be used Returns: torch.device: The selected computing device. """ if seed is not None: random.seed(seed) torch.manual_seed(seed) cudnn.deterministic = True warnings.warn('You have chosen to seed training. ' 'This will turn on the CUDNN deterministic setting, ' 'which can slow down your training considerably! ' 'You may see unexpected behavior when restarting ' 'from checkpoints.') def save_checkpoint(exp_dir, base_name, state, is_best=False): """ Saves a model's checkpoint. Args: exp_dir (str): Experiment directory to save the checkpoint into. base_name (str): The output file name will be <base_name>_latest.pth and optionally <base_name>_best.pth state (dict): The model state to save. is_best (bool): If True, <base_name>_best.pth will be saved as well. """ filename = os.path.join(exp_dir, base_name + '_latest.pth') torch.save(state, filename) if is_best: shutil.copyfile(filename, os.path.join(exp_dir, base_name + '_best.pth')) mag_map = {'K': 3, 'M': 6, 'B': 9} def str2int(s): """ Converts a string containing a number with 'K', 'M', or 'B' to an integer. """ if isinstance(s, (list, tuple)): return [str2int(o) for o in s] if not isinstance(s, str): return s return int(float(s[:-1]) * 10 ** mag_map[s[-1].upper()]) if s[-1].upper() in mag_map else int(s) def get_arch(obj, *args, **kwargs): """ Extract the architecture (string representation) of an object given as a string or partial together with additional provided arguments. The returned architecture can be used to create the object using the obj_factory function. Args: obj (str or partial): The object string expresion or partial to be converted into an object *args: Additional arguments to pass to the object **kwargs: Additional keyword arguments to pass to the object Returns: arch (str): The object's architecture (string representation). """ obj_args, obj_kwargs = [], {} if isinstance(obj, str): if '(' in obj and ')' in obj: arg_pos = obj.find('(') func = obj[:arg_pos] args_exp = obj[arg_pos:] obj_args, obj_kwargs = eval('extract_args' + args_exp) else: func = obj elif isinstance(obj, partial): func = obj.func.__module__ + '.' + obj.func.__name__ obj_args, obj_kwargs = obj.args, obj.keywords else: return None # Concatenate arguments obj_args = obj_args + args obj_kwargs.update(kwargs) # Convert object components to string representation args = ",".join(map(repr, obj_args)) kwargs = ",".join("{}={!r}".format(k, v) for k, v in obj_kwargs.items()) comma = ',' if args != '' and kwargs != '' else '' format_string = '{func}({args}{comma}{kwargs})' arch = format_string.format(func=func, args=args, comma=comma, kwargs=kwargs).replace(' ', '') return arch def load_model(model_path, name='', device=None, arch=None, return_checkpoint=False, train=False): """ Load a model from checkpoint. This is a utility function that combines the model weights and architecture (string representation) to easily load any model without explicit knowledge of its class. Args: model_path (str): Path to the model's checkpoint (.pth) name (str): The name of the model (for printing and error management) device (torch.device): The device to load the model to arch (str): The model's architecture (string representation) return_checkpoint (bool): If True, the checkpoint will be returned as well train (bool): If True, the model will be set to train mode, else it will be set to test mode Returns: (nn.Module, dict (optional)): A tuple that contains: - model (nn.Module): The loaded model - checkpoint (dict, optional): The model's checkpoint (only if return_checkpoint is True) """ assert model_path is not None, '%s model must be specified!' % name assert os.path.exists(model_path), 'Couldn\'t find %s model in path: %s' % (name, model_path) print('=> Loading %s model: "%s"...' % (name, os.path.basename(model_path))) checkpoint = torch.load(model_path) assert arch is not None or 'arch' in checkpoint, 'Couldn\'t determine %s model architecture!' % name arch = checkpoint['arch'] if arch is None else arch model = obj_factory(arch) if device is not None: model.to(device) model.load_state_dict(checkpoint['state_dict']) model.train(train) if return_checkpoint: return model, checkpoint else: return model def random_pair(n, min_dist=1, index1=None): """ Return a random pair of integers in the range [0, n) with a minimum distance between them. Args: n (int): Determine the range size min_dist (int): The minimum distance between the random pair index1 (int, optional): If specified, this will determine the first integer Returns: (int, int): The random pair of integers. """ r1 = random.randint(0, n - 1) if index1 is None else index1 d_left = min(r1, min_dist) d_right = min(n - 1 - r1, min_dist) r2 = random.randint(0, n - 2 - d_left - d_right) r2 = r2 + d_left + 1 + d_right if r2 >= (r1 - d_left) else r2 return r1, r2 def random_pair_range(a, b, min_dist=1, index1=None): """ Return a random pair of integers in the range [a, b] with a minimum distance between them. Args: a (int): The minimum number in the range b (int): The maximum number in the range min_dist (int): The minimum distance between the random pair index1 (int, optional): If specified, this will determine the first integer Returns: (int, int): The random pair of integers. """ r1 = random.randint(a, b) if index1 is None else index1 d_left = min(r1 - a, min_dist) d_right = min(b - r1, min_dist) r2 = random.randint(a, b - 1 - d_left - d_right) r2 = r2 + d_left + 1 + d_right if r2 >= (r1 - d_left) else r2 return r1, r2 # Adapted from: https://github.com/Sudy/coling2018/blob/master/torchtext/utils.py def download_from_url(url, output_path): """ Download file from url including Google Drive. Args: url (str): File URL output_path (str): Output path to write the file to """ def process_response(r): chunk_size = 16 * 1024 total_size = int(r.headers.get('Content-length', 0)) with open(output_path, "wb") as file: with tqdm(total=total_size, unit='B', unit_scale=1, desc=os.path.split(output_path)[1]) as t: for chunk in r.iter_content(chunk_size): if chunk: file.write(chunk) t.update(len(chunk)) if 'drive.google.com' not in url: response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'}, stream=True) process_response(response) return # print('downloading from Google Drive; may take a few minutes') confirm_token = None session = requests.Session() response = session.get(url, stream=True) for k, v in response.cookies.items(): if k.startswith("download_warning"): confirm_token = v if confirm_token: url = url + "&confirm=" + confirm_token response = session.get(url, stream=True) process_response(response) def main(): from torch.optim.lr_scheduler import StepLR scheduler = partial(StepLR, step_size=10, gamma=0.5) print(get_arch(scheduler)) scheduler = partial(StepLR, 10, 0.5) print(get_arch(scheduler)) scheduler = partial(StepLR, 10, gamma=0.5) print(get_arch(scheduler)) scheduler = partial(StepLR) print(get_arch(scheduler)) print(get_arch(scheduler, 10, gamma=0.5)) scheduler = 'torch.optim.lr_scheduler.StepLR(step_size=10,gamma=0.5)' print(get_arch(scheduler)) scheduler = 'torch.optim.lr_scheduler.StepLR(10,0.5)' print(get_arch(scheduler)) scheduler = 'torch.optim.lr_scheduler.StepLR(10,gamma=0.5)' print(get_arch(scheduler)) scheduler = 'torch.optim.lr_scheduler.StepLR()' print(get_arch(scheduler)) print(get_arch(scheduler, 10, gamma=0.5)) if __name__ == "__main__": main()
4,455
7,482
/* * Copyright (c) 2010-2012, Freescale Semiconductor, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * o Neither the name of Freescale Semiconductor, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "hab_defines.h" #include "soc_memory_map.h" //! @brief dcd data, list of (register, value) pairs to initialize ddr uint8_t input_dcd[] __attribute__ ((section (".dcd_data")))= { /*DDR clk to 400MHz*/ /*CCM_BASE_ADDR = 0x020c4000*/ EXPAND_UINT32(CCM_BASE_ADDR + 0x018), EXPAND_UINT32(0x00260324), /*========================================================================*/ /* IOMUX*/ /*========================================================================*/ /* Megrez note: IOMUX configs specify absolute addr in Arik IOMUXC. Changes to Megrez addr.*/ /* Megrez note: Good chance that drive strength change is required. to change them all by editing the LSB value "38"-> ""30" or "28"*/ /* Megrez note: Timing also can be tweaked by drive strength values. It is mainly by giving SDCLk and SDQS different values than the sampled signals*/ /*IOMUXC_BASE_ADDR = 0x020e0000*/ /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS0*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x344), EXPAND_UINT32(0x00003030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS1*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x348), EXPAND_UINT32(0x00003030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS2*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x34c), EXPAND_UINT32(0x00003030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS3*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x350), EXPAND_UINT32(0x00003030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM0*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x30c), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM1*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x310), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM2*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x314), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM3*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x318), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_CAS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x300), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_RAS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x31c), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDCLK_0*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x338), EXPAND_UINT32(0x00000028), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_RESET*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x320), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDBA2 - DSE can be configured using Group Control Register: IOMUXC_SW_PAD_CTL_GRP_CTLDS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x32c), EXPAND_UINT32(0x00000000), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDODT0*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x33c), EXPAND_UINT32(0x00000008), /*IOMUXC_SW_PAD_CTL_PAD_DRAM_SDODT1*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x340), EXPAND_UINT32(0x00000008), /*IOMUXC_SW_PAD_CTL_GRP_B0DS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5c4), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_GRP_B1DS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5cc), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_GRP_B2DS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5d4), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_GRP_B3DS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5d8), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_GRP_ADDDS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5ac), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_GRP_CTLDS*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5c8), EXPAND_UINT32(0x00000030), /*IOMUXC_SW_PAD_CTL_GRP_DDRMODE_CTL*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5b0), EXPAND_UINT32(0x00020000), /*IOMUXC_SW_PAD_CTL_GRP_DDRPKE*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5b4), EXPAND_UINT32(0x00000000), /*IOMUXC_SW_PAD_CTL_GRP_DDRMODE*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5c0), EXPAND_UINT32(0x00020000), /*IOMUXC_SW_PAD_CTL_GRP_DDR_TYPE*/ EXPAND_UINT32(IOMUXC_BASE_ADDR + 0x5d0), EXPAND_UINT32(0x00080000), /*========================================================================*/ /* DDR Controller Registers*/ /*========================================================================*/ /* Manufacturer: Samsung*/ /* Device Part Number: K4P8G304EB-AGC1*/ /* Clock Freq.: 400MMHz*/ /* MMDC channels: MMDC0*/ /* Density per CS in Gb: 512M*/ /* Chip Selects used: 2*/ /* Number of Banks: 8*/ /* Row address: 14*/ /* Column address: 10*/ /* Data bus width 32*/ /*========================================================================*/ /*MMDC_P0_BASE_ADDR = 0x021b0000*/ /*MMDC0_MDSCR, set the Configuration request bit during MMDC set up*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x00008000), /*setmem /32 0x021b085c = 0x1b5f01ff*/ /*LPDDR2 ZQ params*/ /*LPDDR2 ZQ params*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x85c), EXPAND_UINT32(0x1b4700c7), /*========================================================================*/ /* Calibration setup.*/ /**/ /*========================================================================*/ /*DDR_PHY_P0_MPZQHWCTRL, enable on time ZQ calibration*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x800), EXPAND_UINT32(0xa1390003), /* Megrez note: If entire word fails, CA bus might be involved. Try changing this:*/ /*ca bus abs delay*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x890), EXPAND_UINT32(0x00300000), /* values of 20,40,50,60,7f tried. no difference seen*/ /* Megrez note: This is also for CA bus. A bit-bit fine tuning.*/ /*setmem /32 0x021b48bc = 0x00055555*/ /*DDR_PHY_P1_MPWRCADL*/ /*frc_msr.*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x8b8), EXPAND_UINT32(0x00000800), /*DDR_PHY_P0_MPREDQBY0DL3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x81c), EXPAND_UINT32(0x33333333), /*DDR_PHY_P0_MPREDQBY1DL3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x820), EXPAND_UINT32(0x33333333), /*DDR_PHY_P0_MPREDQBY2DL3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x824), EXPAND_UINT32(0x33333333), /*DDR_PHY_P0_MPREDQBY3DL3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x828), EXPAND_UINT32(0x33333333), /*write delayes:*/ /*all byte 0 data & dm delayed by 3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x82c), EXPAND_UINT32(0xf3333333), /*all byte 1 data & dm delayed by 3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x830), EXPAND_UINT32(0xf3333333), /*all byte 2 data & dm delayed by 3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x834), EXPAND_UINT32(0xf3333333), /*all byte 3 data & dm delayed by 3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x838), EXPAND_UINT32(0xf3333333), /* Read and write data delay, per byte.*/ /* For optimized DDR operation it is recommended to run mmdc_calibration on your board, and replace 4 delay register assigns with resulted values*/ /* Note:*/ /* a. DQS gating is not relevant for LPDDR2. DSQ gating calibration section should be skipped, or the write/read calibration comming after that will stall*/ /* b. The calibration code that runs for both MMDC0 & MMDC1 should be used.*/ /*it is strongly recommended to run calibration on your board, and replace bellow values:*/ /* Megrez note: New set of values is required for the following 2 delay registers. Try running calibration code as in Arik APN.*/ /*Read calibration*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x848), EXPAND_UINT32(0x4241444a), /*Write calibration*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x850), EXPAND_UINT32(0x3030312b), /*dqs gating dis*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x83c), EXPAND_UINT32(0x20000000), EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x840), EXPAND_UINT32(0x00000000), /* Megrez note: Try enabling and changing the clock delay, as part of the calibration:*/ /*setmem /32 0x021b0858 = 0xa00*/ /*clk delay*/ /*fine tune duty cyc to low*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x8c0), EXPAND_UINT32(0x24911492), /*frc_msr*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x8b8), EXPAND_UINT32(0x00000800), /*========================================================================*/ /* Calibration setup end*/ /*========================================================================*/ /* Channel0 - startng address 0x80000000*/ /*setmem /32 0x021b000c = 0x3f436133*/ /* MMDC0_MDCFG0*/ /*MMDC0_MDCFG0*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x00c), EXPAND_UINT32(0x33374133), /*MMDC0_MDPDC - where is tCKSRX and tCKSRE defined in LPDDR2 data sheet?????*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x004), EXPAND_UINT32(0x00020024), /*MMDC0_MDCFG1*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x010), EXPAND_UINT32(0x00100A82), /*MMDC0_MDCFG2*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x014), EXPAND_UINT32(0x00000093), /*MMDC0_MDMISC. RALAT=3. Try increasing RALAT if case of failures at higher DDR freq*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x018), EXPAND_UINT32(0x00001688), /*MMDC0_MDRWD;*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x02c), EXPAND_UINT32(0x0f9f26d2), /*MMDC0_MDOR*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x030), EXPAND_UINT32(0x0000020e), /*setmem /32 0x021b0038 = 0x001a099a*/ /* MMDC0_MDCFG3LP*/ /*MMDC0_MDCFG3LP*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x038), EXPAND_UINT32(0x00190778), /*MMDC0_MDOTC*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x008), EXPAND_UINT32(0x00000000), /*CS0_END = 0x8fffffff*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x040), EXPAND_UINT32(0x0000004f), /*MMDC0_MDCTL*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x000), EXPAND_UINT32(0xc3110000), /* Channel0 : Configure DDR device:*/ /* Megrez note: Device drive strength change might help, consult device/JEDEC for the values.*/ /*MRW: BA=0 CS=0 MR_ADDR=63 MR_OP=0 //reset*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x003f8030), /*MRW: BA=0 CS=0 MR_ADDR=10 MR_OP=ff /zq*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0xff0a8030), /*MRW: BA=0 CS=0 MR_ADDR=1 MR_OP=c2*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x82018030), /*MRW: BA=0 CS=0 MR_ADDR=2 MR_OP=4. tcl=6, tcwl=3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x04028030), /*MRW: BA=0 CS=0 MR_ADDR=3 MR_OP=2.drive=240/6*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x02038030), /* Need to comment out MRW reset command to CS1 - investigating this*/ /* Also, adding delays before and after this makes no difference*/ /*setmem /32 0x021b001c = 0x003f8038*/ /* MRW: BA=0 CS=1 MR_ADDR=63 MR_OP=0*/ /*reset*/ /*MRW: BA=0 CS=1 MR_ADDR=10 MR_OP=ff*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0xff0a8038), /*MRW: BA=0 CS=1 MR_ADDR=1 MR_OP=c2*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x82018038), /*MRW: BA=0 CS=1 MR_ADDR=2 MR_OP=4. tcl=6, tcwl=3*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x04028038), /*MRW: BA=0 CS=1 MR_ADDR=3 MR_OP=2.drive=240/6*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x02038038), /*######################################################*/ /*final DDR setup, before operation start:*/ /*DDR_PHY_P0_MPZQHWCTRL, enable automatic ZQ calibration*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x800), EXPAND_UINT32(0xa1310003), /*MMDC0_MDREF*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x020), EXPAND_UINT32(0x00001800), /*DDR_PHY_P0_MPODTCTRL*/ /*setmem /32 0x021b0818 = 0*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x818), EXPAND_UINT32(0x00000000), /*DDR_PHY_P0_MPMUR0, frc_msr*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x8b8), EXPAND_UINT32(0x00000800), /*MMDC0_MDPDC now SDCTL power down enabled*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x004), EXPAND_UINT32(0x00025564), /*MMDC0_MAPSR ADOPT power down enabled*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x404), EXPAND_UINT32(0x00011006), /*MMDC0_MDSCR, clear this register (especially the configuration bit as initialization is complete),*/ EXPAND_UINT32(MMDC_P0_BASE_ADDR + 0x01c), EXPAND_UINT32(0x00000000), }; //! @brief HAB command write data header, with tag, //! size of dcd data with hdr, //! parameter field (size of register value and flag) uint8_t input_dcd_wrt_cmd[] __attribute__ ((section (".dcd_wrt_cmd")))= { HAB_CMD_WRT_DAT, EXPAND_UINT16(sizeof(input_dcd) + HDR_BYTES), WRT_DAT_PAR(0, HAB_DATA_WIDTH_WORD) //!< flag 0, width 4 }; //! @brief HAB dcd header with dcd tag, size of entire dcd and version. uint8_t input_dcd_hdr[] __attribute__ ((section (".dcd_hdr")))= { HAB_TAG_DCD, EXPAND_UINT16(sizeof(input_dcd) + sizeof(input_dcd_wrt_cmd) + HDR_BYTES), HAB_VER(4,0) };
6,551
18,012
<reponame>z727354123/dubbo /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dubbo.remoting.telnet.support; import org.apache.dubbo.common.URL; import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.telnet.support.command.HelpTelnetHandler; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; public class HelpTelnetHandlerTest { @Test public void test() { Channel channel = Mockito.mock(Channel.class); Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345")); HelpTelnetHandler helpTelnetHandler = new HelpTelnetHandler(); // default output String prompt = "Please input \"help [command]\" show detail.\r\n"; Assertions.assertTrue(helpTelnetHandler.telnet(channel, "").contains(prompt)); // "help" command output String demoOutput = "Command:\r\n" + " help [command]\r\n" + "Summary:\r\n" + " Show help.\r\n" + "Detail:\r\n" + " Show help."; Assertions.assertEquals(helpTelnetHandler.telnet(channel, "help"),demoOutput); } }
728
577
#pragma once #include <string> #include <utility> #include <Eigen/Core> #include <Eigen/Dense> #include <unsupported/Eigen/SparseExtra> #include "buffalo/algo.hpp" using namespace std; using namespace Eigen; namespace als { class CALS : public Algorithm { public: CALS(); ~CALS(); void release(); bool init(string opt_path); bool parse_option(string out_path); void initialize_model( float* P, int P_rows, float* Q, int Q_rows); void precompute(int axis); pair<double, double> partial_update(int start_x, int next_x, int64_t* indptr, int32_t* keys, float* vals, int axis); private: Json opt_; FactorType FF_; Map<FactorTypeRowMajor> P_, Q_; }; }
500
315
<filename>include/native/wsi/native_wsi.h #pragma once #ifdef DXVK_WSI_WIN32 #error You shouldnt be using this code path. #elif DXVK_WSI_SDL2 #include "wsi/native_sdl2.h" #else #error Unknown wsi! #endif
88
4,036
// Generated automatically from org.apache.commons.collections4.list.LazyList for testing purposes package org.apache.commons.collections4.list; import java.util.List; import org.apache.commons.collections4.Factory; import org.apache.commons.collections4.Transformer; import org.apache.commons.collections4.list.AbstractSerializableListDecorator; public class LazyList<E> extends AbstractSerializableListDecorator<E> { protected LazyList() {} protected LazyList(List<E> p0, Factory<? extends E> p1){} protected LazyList(List<E> p0, Transformer<Integer, ? extends E> p1){} public E get(int p0){ return null; } public List<E> subList(int p0, int p1){ return null; } public static <E> LazyList<E> lazyList(List<E> p0, Factory<? extends E> p1){ return null; } public static <E> LazyList<E> lazyList(List<E> p0, Transformer<Integer, ? extends E> p1){ return null; } }
311
879
<filename>plugin/ceph/src/main/java/org/zstack/storage/ceph/backup/CephBackupStorageSimulator.java<gh_stars>100-1000 package org.zstack.storage.ceph.backup; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.zstack.core.db.DatabaseFacade; import org.zstack.core.db.SimpleQuery; import org.zstack.core.db.SimpleQuery.Op; import org.zstack.header.exception.CloudRuntimeException; import org.zstack.header.rest.RESTConstant; import org.zstack.header.rest.RESTFacade; import org.zstack.header.storage.backup.BackupStorageVO; import org.zstack.header.storage.backup.BackupStorageVO_; import org.zstack.storage.ceph.backup.CephBackupStorageBase.*; import org.zstack.storage.ceph.backup.CephBackupStorageSimulatorConfig.CephBackupStorageConfig; import org.zstack.storage.ceph.primary.CephPrimaryStorageBase; import org.zstack.storage.ceph.primary.CephPrimaryStorageSimulatorConfig; import org.zstack.utils.DebugUtils; import org.zstack.utils.Utils; import org.zstack.utils.gson.JSONObjectUtil; import org.zstack.utils.logging.CLogger; /** * Created by frank on 7/28/2015. */ public class CephBackupStorageSimulator { CLogger logger = Utils.getLogger(CephBackupStorageSimulator.class); @Autowired private CephBackupStorageSimulatorConfig config; @Autowired private DatabaseFacade dbf; @Autowired private RESTFacade restf; public void reply(HttpEntity<String> entity, Object rsp) { String taskUuid = entity.getHeaders().getFirst(RESTConstant.TASK_UUID); String callbackUrl = entity.getHeaders().getFirst(RESTConstant.CALLBACK_URL); String rspBody = JSONObjectUtil.toJsonString(rsp); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentLength(rspBody.length()); headers.set(RESTConstant.TASK_UUID, taskUuid); HttpEntity<String> rreq = new HttpEntity<String>(rspBody, headers); restf.getRESTTemplate().exchange(callbackUrl, HttpMethod.POST, rreq, String.class); } private CephBackupStorageConfig getConfig(AgentCommand cmd) { SimpleQuery<BackupStorageVO> q = dbf.createQuery(BackupStorageVO.class); q.select(BackupStorageVO_.name); q.add(BackupStorageVO_.uuid, Op.EQ, cmd.getUuid()); String name = q.findValue(); CephBackupStorageConfig c = config.config.get(name); if (c == null) { throw new CloudRuntimeException(String.format("cannot find CephBackupStorageConfig by name[%s], uuid[%s]", name, cmd.getUuid())); } c.name = name; return c; } @RequestMapping(value= CephBackupStorageBase.GET_FACTS, method= RequestMethod.POST) public @ResponseBody String getFacts(HttpEntity<String> entity) { GetFactsCmd cmd = JSONObjectUtil.toObject(entity.getBody(), GetFactsCmd.class); GetFactsRsp rsp = new GetFactsRsp(); config.getFactsCmds.add(cmd); String fsid = config.getFactsCmdFsid.get(cmd.monUuid); if (fsid == null) { CephBackupStorageConfig c = getConfig(cmd); fsid = c.fsid; } rsp.fsid = fsid; rsp.monAddr = config.monAddr.get(cmd.monUuid); reply(entity, rsp); return null; } @RequestMapping(value= CephBackupStorageMonBase.PING_PATH, method= RequestMethod.POST) public @ResponseBody String pingMon(HttpEntity<String> entity) { CephBackupStorageMonBase.PingCmd cmd = JSONObjectUtil.toObject(entity.getBody(), CephBackupStorageMonBase.PingCmd.class); Boolean success = config.pingCmdSuccess.get(cmd.monUuid); CephBackupStorageMonBase.PingRsp rsp = new CephBackupStorageMonBase.PingRsp(); rsp.success = success == null ? true : success; if (!rsp.success) { rsp.error = "on purpose"; } rsp.failure = config.pingCmdOperationFailure.get(cmd.monUuid); reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.GET_IMAGE_SIZE_PATH, method= RequestMethod.POST) public @ResponseBody String getImageSize(HttpEntity<String> entity) { GetImageSizeCmd cmd = JSONObjectUtil.toObject(entity.getBody(), GetImageSizeCmd.class); config.getImageSizeCmds.add(cmd); GetImageSizeRsp rsp = new GetImageSizeRsp(); Long size = config.getImageSizeCmdSize.get(cmd.imageUuid); rsp.size = size == null ? 0 : size; Long asize = config.getImageSizeCmdActualSize.get(cmd.imageUuid); rsp.actualSize = asize == null ? 0 : asize; reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.INIT_PATH, method= RequestMethod.POST) public @ResponseBody String initialize(HttpEntity<String> entity) { InitCmd cmd = JSONObjectUtil.toObject(entity.getBody(), InitCmd.class); CephBackupStorageConfig cbc = getConfig(cmd); config.initCmds.add(cmd); DebugUtils.Assert(cbc.fsid != null, String.format("fsid for ceph backup storage[%s] is null", cbc.name)); InitRsp rsp = new InitRsp(); if (!config.monInitSuccess) { rsp.error = "on purpose"; rsp.success = false; } else { rsp.fsid = cbc.fsid; rsp.totalCapacity = cbc.totalCapacity; rsp.availableCapacity = cbc.availCapacity; } reply(entity, rsp); return null; } @RequestMapping(value= CephBackupStorageBase.CHECK_POOL_PATH, method= RequestMethod.POST) public @ResponseBody String checkPool(HttpEntity<String> entity) { CheckCmd cmd = JSONObjectUtil.toObject(entity.getBody(), CheckCmd.class); CephBackupStorageConfig cbc = getConfig(cmd); CheckRsp rsp = new CheckRsp(); if (!config.monInitSuccess) { rsp.error = "on purpose"; rsp.success = false; } else { rsp.success = true; } reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.DOWNLOAD_IMAGE_PATH, method= RequestMethod.POST) public @ResponseBody String download(HttpEntity<String> entity) { DownloadRsp rsp = new DownloadRsp(); DownloadCmd cmd = JSONObjectUtil.toObject(entity.getBody(), DownloadCmd.class); config.downloadCmds.add(cmd); Long size = config.imageSize.get(cmd.imageUuid); rsp.setSize(size == null ? 0 : size); Long asize = config.imageActualSize.get(cmd.imageUuid); rsp.setActualSize(asize == null ? 0 : asize); reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.DELETE_IMAGE_PATH, method= RequestMethod.POST) public @ResponseBody String doDelete(HttpEntity<String> entity) { DeleteCmd cmd = JSONObjectUtil.toObject(entity.getBody(), DeleteCmd.class); config.deleteCmds.add(cmd); DeleteRsp rsp = new DeleteRsp(); reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.CHECK_IMAGE_METADATA_FILE_EXIST, method= RequestMethod.POST) public @ResponseBody String checkMetaDataFile(HttpEntity<String> entity) { CheckImageMetaDataFileExistCmd cmd = JSONObjectUtil.toObject(entity.getBody(), CheckImageMetaDataFileExistCmd.class); config.checkMetadataFileCmds.add(cmd); CheckImageMetaDataFileExistRsp rsp = new CheckImageMetaDataFileExistRsp(); rsp.setExist(true); rsp.setBackupStorageMetaFileName("bs_ceph_info.json"); reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.DELETE_IMAGES_METADATA, method= RequestMethod.POST) public @ResponseBody String deleteImagesMetadata(HttpEntity<String> entity) { DeleteImageInfoFromMetaDataFileCmd cmd = JSONObjectUtil.toObject(entity.getBody(), DeleteImageInfoFromMetaDataFileCmd.class); config.deleteImageInfoFromMetadataFileCmds.add(cmd); DeleteImageInfoFromMetaDataFileRsp rsp = new DeleteImageInfoFromMetaDataFileRsp(); rsp.setRet(0); rsp.setOut("success delete"); reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.DUMP_IMAGE_METADATA_TO_FILE, method= RequestMethod.POST) public @ResponseBody String dumpImagesMetadataToFile(HttpEntity<String> entity) { DumpImageInfoToMetaDataFileCmd cmd = JSONObjectUtil.toObject(entity.getBody(), DumpImageInfoToMetaDataFileCmd.class); config.dumpImageInfoToMetaDataFileCmds.add(cmd); DumpImageInfoToMetaDataFileRsp rsp = new DumpImageInfoToMetaDataFileRsp(); rsp.setSuccess(true); reply(entity, rsp); return null; } @RequestMapping(value=CephBackupStorageBase.GET_IMAGES_METADATA, method= RequestMethod.POST) public @ResponseBody String getImagesMetadataToFile(HttpEntity<String> entity) { GetImagesMetaDataCmd cmd = JSONObjectUtil.toObject(entity.getBody(), GetImagesMetaDataCmd.class); config.getImageInfoToMetaDataFileCmds.add(cmd); GetImagesMetaDataRsp rsp = new GetImagesMetaDataRsp(); rsp.setSuccess(true); rsp.setImagesMetadata("{\"uuid\":\"a603e80ea18f424f8a5f00371d484537\",\"name\":\"test\",\"description\":\"\",\"state\":\"Enabled\",\"status\":\"Ready\",\"size\":19862528,\"actualSize\":15794176,\"md5Sum\":\"not calculated\",\"url\":\"http://192.168.200.1/mirror/diskimages/zstack-image-1.2.qcow2\",\"mediaType\":\"RootVolumeTemplate\",\"type\":\"zstack\",\"platform\":\"Linux\",\"format\":\"qcow2\",\"system\":false,\"createDate\":\"Dec 22, 2016 5:10:06 PM\",\"lastOpDate\":\"Dec 22, 2016 5:10:08 PM\",\"backupStorageRefs\":[{\"id\":45,\"imageUuid\":\"a603e80ea18f424f8a5f00371d484537\",\"backupStorageUuid\":\"63879ceb90764f839d3de772aa646c83\",\"installPath\":\"/bs-sftp/rootVolumeTemplates/acct-36c27e8ff05c4780bf6d2fa65700f22e/a603e80ea18f424f8a5f00371d484537/zstack-image-1.2.template\",\"status\":\"Ready\",\"createDate\":\"Dec 22, 2016 5:10:08 PM\",\"lastOpDate\":\"Dec 22, 2016 5:10:08 PM\"}]}"); reply(entity, rsp); return null; } }
4,259
529
<gh_stars>100-1000 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) Microsoft Corporation. All rights reserved. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "spot_hardware_usb_native.cpp" #include "spot_hardware_usb_native_Microsoft_SPOT_Hardware_UsbClient_UsbController.cpp" #include "spot_hardware_usb_native_Microsoft_SPOT_Hardware_UsbClient_UsbStream.cpp"
124
1,125
<reponame>dedsec-9/XNNPACK // Copyright (c) Facebook, Inc. and its affiliates. // All rights reserved. // // Copyright 2019 Google LLC // // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. #pragma once #include <stddef.h> #include <stdint.h> #include <xnnpack/params.h> #include <xnnpack/common.h> #ifdef __cplusplus extern "C" { #endif #define DECLARE_X8_LUT_UKERNEL_FUNCTION(fn_name) \ XNN_INTERNAL void fn_name( \ size_t n, \ const uint8_t* x, \ uint8_t* y, \ const uint8_t* t); DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__scalar_x1) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__scalar_x2) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__scalar_x4) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__scalar_x8) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__scalar_x16) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__neon_tbx128x4_x16) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__neon_tbx128x4_x32) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__neon_tbx128x4_x48) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__neon_tbx128x4_x64) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__ssse3_x16) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__ssse3_x32) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx_x16) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx_x32) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx_x48) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx_x64) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx2_x32) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx2_x64) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx2_x96) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx2_x128) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx512skx_vpshufb_x64) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx512skx_vpshufb_x128) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx512skx_vpshufb_x192) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__avx512skx_vpshufb_x256) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__wasmsimd_x16) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__wasmsimd_x32) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__wasmsimd_x48) DECLARE_X8_LUT_UKERNEL_FUNCTION(xnn_x8_lut_ukernel__wasmsimd_x64) #define DECLARE_U8_LUT32NORM_UKERNEL_FUNCTION(fn_name) \ XNN_INTERNAL void fn_name( \ size_t n, \ const uint8_t* x, \ const uint32_t* t, \ uint8_t* y); DECLARE_U8_LUT32NORM_UKERNEL_FUNCTION(xnn_u8_lut32norm_ukernel__scalar) #ifdef __cplusplus } // extern "C" #endif
1,728
1,056
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.modules.mercurial.options; import java.util.prefs.PreferenceChangeEvent; import java.util.prefs.PreferenceChangeListener; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import org.netbeans.modules.mercurial.HgModuleConfig; import org.netbeans.modules.mercurial.options.PropertiesTable; import org.netbeans.modules.versioning.util.ListenersSupport; /** * * @author <NAME> */ public class PropertiesPanel extends javax.swing.JPanel implements PreferenceChangeListener, TableModelListener { private static final Object EVENT_SETTINGS_CHANGED = new Object(); private PropertiesTable propertiesTable; private ListenersSupport listenerSupport = new ListenersSupport(this); /** Creates new form PropertiesPanel */ public PropertiesPanel() { initComponents(); } public javax.swing.JTextArea getTxtAreaValue() { return txtAreaValue; } public javax.swing.JComboBox getComboName() { return comboName; } public javax.swing.JButton getBtnAdd() { return btnAdd; } public javax.swing.JButton getBtnRemove() { return btnRemove; } public void setPropertiesTable(PropertiesTable propertiesTable){ this.propertiesTable = propertiesTable; } public void addNotify() { super.addNotify(); HgModuleConfig.getDefault().getPreferences().addPreferenceChangeListener(this); propertiesTable.getTableModel().addTableModelListener(this); listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED); txtAreaValue.selectAll(); } public void removeNotify() { propertiesTable.getTableModel().removeTableModelListener(this); HgModuleConfig.getDefault().getPreferences().removePreferenceChangeListener(this); super.removeNotify(); } public void preferenceChange(PreferenceChangeEvent evt) { if (evt.getKey().startsWith(HgModuleConfig.PROP_COMMIT_EXCLUSIONS)) { propertiesTable.dataChanged(); listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED); } } public void tableChanged(TableModelEvent e) { listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); propsPanel = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); labelForTable = new javax.swing.JLabel(); jLabel2.setLabelFor(comboName); org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel2.text")); // NOI18N jLabel1.setLabelFor(txtAreaValue); org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel1.text")); // NOI18N javax.swing.GroupLayout propsPanelLayout = new javax.swing.GroupLayout(propsPanel); propsPanel.setLayout(propsPanelLayout); propsPanelLayout.setHorizontalGroup( propsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 462, Short.MAX_VALUE) ); propsPanelLayout.setVerticalGroup( propsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 99, Short.MAX_VALUE) ); txtAreaValue.setColumns(20); txtAreaValue.setRows(5); jScrollPane1.setViewportView(txtAreaValue); txtAreaValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "ACSD_txtAreaValue")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(btnRemove, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnRemove.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(btnAdd, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnAdd.text")); // NOI18N btnAdd.setMaximumSize(new java.awt.Dimension(75, 23)); btnAdd.setMinimumSize(new java.awt.Dimension(75, 23)); org.openide.awt.Mnemonics.setLocalizedText(labelForTable, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "jLabel3.txt")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(propsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelForTable) .addComponent(jLabel1)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(comboName, javax.swing.GroupLayout.Alignment.LEADING, 0, 307, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnRemove))))) .addContainerGap()) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnAdd, btnRemove}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(comboName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGap(99, 99, 99) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnRemove)) .addGap(26, 26, 26) .addComponent(labelForTable)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE) .addComponent(propsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); btnRemove.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "ACSD_btnRemove")); // NOI18N btnAdd.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "ACSD_btnAdd")); // NOI18N }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables final javax.swing.JButton btnAdd = new javax.swing.JButton(); final javax.swing.JButton btnRemove = new javax.swing.JButton(); final javax.swing.JComboBox comboName = new javax.swing.JComboBox(); private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPane1; public javax.swing.JLabel labelForTable; public javax.swing.JPanel propsPanel; final javax.swing.JTextArea txtAreaValue = new javax.swing.JTextArea(); // End of variables declaration//GEN-END:variables }
4,238
496
<reponame>jda/lexbor /* * Copyright (C) 2018 <NAME> * * Author: <NAME> <<EMAIL>> */ #ifndef LEXBOR_DOM_EVENT_TARGET_H #define LEXBOR_DOM_EVENT_TARGET_H #ifdef __cplusplus extern "C" { #endif #include "lexbor/dom/interface.h" struct lxb_dom_event_target { void *events; }; LXB_API lxb_dom_event_target_t * lxb_dom_event_target_create(lxb_dom_document_t *document); LXB_API lxb_dom_event_target_t * lxb_dom_event_target_destroy(lxb_dom_event_target_t *event_target, lxb_dom_document_t *document); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* LEXBOR_DOM_EVENT_TARGET_H */
297
32,544
package com.baeldung.client; import com.baeldung.shared.MessageService; import com.baeldung.shared.MessageServiceAsync; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.VerticalPanel; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class Google_web_toolkit implements EntryPoint { private final MessageServiceAsync messageServiceAsync = GWT.create(MessageService.class); public void onModuleLoad() { Button sendButton = new Button("Submit"); TextBox nameField = new TextBox(); nameField.setText("Hi there"); Label warningLabel = new Label(); sendButton.addStyleName("sendButton"); RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("errorLabelContainer").add(warningLabel); Button closeButton = new Button("Thanks"); closeButton.getElement().setId("closeButton"); Label textToServerLabel = new Label(); HTML serverResponseLabel = new HTML(); VerticalPanel vPanel = new VerticalPanel(); vPanel.addStyleName("vPanel"); vPanel.add(new HTML("Sending message to the server:")); vPanel.add(textToServerLabel); vPanel.add(new HTML("<br><b>Server replies:</b>")); vPanel.add(serverResponseLabel); vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); vPanel.add(closeButton); vPanel.setVisible(false); RootPanel.get("serverResponseContainer").add(vPanel); closeButton.addClickHandler(event -> { sendButton.setEnabled(true); sendButton.setFocus(true); vPanel.setVisible(false); }); class MyHandler implements ClickHandler, KeyUpHandler { public void onClick(ClickEvent event) { sendMessageToServer(); } public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { sendMessageToServer(); } } private void sendMessageToServer() { warningLabel.setText(""); String textToServer = nameField.getText(); if (textToServer == null || textToServer.isEmpty()) { warningLabel.setText("Please enter the message"); return; } sendButton.setEnabled(false); textToServerLabel.setText(textToServer); serverResponseLabel.setText(""); messageServiceAsync.sendMessage(textToServer, new AsyncCallback<String>() { public void onFailure(Throwable caught) { serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML("server error occurred"); closeButton.setFocus(true); } public void onSuccess(String result) { serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(result); closeButton.setFocus(true); vPanel.setVisible(true); } }); } } // Add a handler to send the name to the server MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); } }
1,821
326
<reponame>timgates42/python-registry<filename>samples/test_dump.py from __future__ import print_function from __future__ import unicode_literals import sys from Registry import * def format_total_keys(total_keys): return "total_keys|{total_keys}".format(total_keys=total_keys) def format_total_values(total_values): return "total_values|{total_values}".format(total_values=total_values) def format_key(key): return "key|{path}|{ts}".format( path=key.path(), ts=key.timestamp().isoformat(chr(ord("T"))) + "Z") def format_value(key, value): try: h = " ".join(["%02X" % (ord(c)) for c in value.raw_data()]) except RegistryParse.UnknownTypeException: h = "UNKNOWN_TYPE_SO_UNKNOWN_DATA" return "value|{path}|{name}|{type}|{hex}".format( path=key.path(), name=value.name(), type=value.value_type(), hex=h) def handle_key(key): print(format_key(key)) def handle_value(key, value): print(format_value(key, value)) class RegistryExplorer(object): def __init__(self, root): self._root = root def handle_pre(self): pass def handle_key(self, key): raise NotImplementedException() def handle_value(self, key, value): raise NotImplementedException() def handle_post(self): pass def _rec(self, key): self.handle_key(key) for value in key.values(): self.handle_value(key, value) map(self._rec, key.subkeys()) def go(self): self.handle_pre() self._rec(self._root) self.handle_post() class TestDumper(RegistryExplorer): def __init__(self, *args, **kwargs): super(TestDumper, self).__init__(*args, **kwargs) self._key_count = 0 self._value_count = 0 def handle_key(self, key): self._key_count += 1 try: print(format_key(key)) except UnicodeEncodeError: pass except UnicodeDecodeError: pass def handle_value(self, key, value): self._value_count += 1 try: print(format_value(key, value)) except UnicodeEncodeError: pass except UnicodeDecodeError: pass def handle_post(self): print(format_total_keys(self._key_count)) print(format_total_values(self._value_count)) reg = Registry.Registry(sys.argv[1]) TestDumper(reg.root()).go()
1,112
559
#include "JitteredGBufferPass.h" #include <chrono> namespace { // For basic jittering, we don't need to change our rasterized g-buffer, just jitter the camera position const char *kGbufVertShader = "CommonPasses\\gBuffer.vs.hlsl"; const char *kGbufFragShader = "CommonPasses\\gBuffer.ps.hlsl"; // If we want to jitter the camera to antialias using traditional a traditional 8x MSAA pattern, // use these positions (which are in the range [-8.0...8.0], so divide by 16 before use) const float kMSAA[8][2] = { {1,-3}, {-1,3}, {5,1}, {-3,-5}, {-5,5}, {-7,-1}, {3,7}, {7,-7} }; }; bool JitteredGBufferPass::initialize(RenderContext::SharedPtr pRenderContext, ResourceManager::SharedPtr pResManager) { // Stash a copy of our resource manager so we can get rendering resources mpResManager = pResManager; // We write to these output textures; tell our resource manager that we expect them to exist mpResManager->requestTextureResource("WorldPosition"); mpResManager->requestTextureResource("WorldNormal"); mpResManager->requestTextureResource("MaterialDiffuse"); mpResManager->requestTextureResource("MaterialSpecRough"); mpResManager->requestTextureResource("MaterialExtraParams"); mpResManager->requestTextureResource("Z-Buffer", ResourceFormat::D24UnormS8, ResourceManager::kDepthBufferFlags); // Create our rasterization state and our raster shader wrapper mpGfxState = GraphicsState::create(); mpRaster = RasterPass::createFromFiles(kGbufVertShader, kGbufFragShader); mpRaster->setScene(mpScene); // Set up our random number generator by seeding it with the current time auto currentTime = std::chrono::high_resolution_clock::now(); auto timeInMillisec = std::chrono::time_point_cast<std::chrono::milliseconds>(currentTime); mRng = std::mt19937( uint32_t(timeInMillisec.time_since_epoch().count()) ); return true; } void JitteredGBufferPass::initScene(RenderContext::SharedPtr pRenderContext, Scene::SharedPtr pScene) { // Stash a copy of the scene. Update our raster pass wrapper with the scene if (pScene) mpScene = pScene; if (mpRaster) mpRaster->setScene(mpScene); } void JitteredGBufferPass::renderGui(Gui* pGui) { int dirty = 0; // Determine whether we're jittering at all dirty |= (int)pGui->addCheckBox(mUseJitter ? "Camera jitter enabled" : "Camera jitter disabled", mUseJitter); // Select what kind of jitter to use. Right now, the choices are: 8x MSAA or completely random if (mUseJitter) { dirty |= (int)pGui->addCheckBox(mUseRandom ? "Using randomized camera position" : "Using 8x MSAA pattern", mUseRandom); } // If UI parameters change, let the pipeline know we're doing something different next frame if (dirty) setRefreshFlag(); } void JitteredGBufferPass::execute(RenderContext::SharedPtr pRenderContext) { // Create a framebuffer for rendering. (Creating once per frame is for simplicity, not performance). Fbo::SharedPtr outputFbo = mpResManager->createManagedFbo( { "WorldPosition", "WorldNormal", "MaterialDiffuse", "MaterialSpecRough", "MaterialExtraParams" }, "Z-Buffer"); // Failed to create a valid FBO? We're done. if (!outputFbo) return; // Are we jittering? If so, update our camera with the current jitter if (mUseJitter && mpScene && mpScene->getActiveCamera()) { // Increase our frame count mFrameCount++; // Determine our offset in the pixel in the range [-0.5...0.5] float xOff = mUseRandom ? mRngDist(mRng) - 0.5f : kMSAA[mFrameCount % 8][0]*0.0625f; float yOff = mUseRandom ? mRngDist(mRng) - 0.5f : kMSAA[mFrameCount % 8][1]*0.0625f; // Give our jitter to the scene camera mpScene->getActiveCamera()->setJitter( xOff / float(outputFbo->getWidth()), yOff / float(outputFbo->getHeight())); } // Clear our g-buffer. All color buffers to (0,0,0,0), depth to 1, stencil to 0 pRenderContext->clearFbo(outputFbo.get(), vec4(0, 0, 0, 0), 1.0f, 0); // Separately clear our diffuse color buffer to the background color, rather than black pRenderContext->clearUAV(outputFbo->getColorTexture(2)->getUAV().get(), vec4(mBgColor, 1.0f)); // Execute our rasterization pass. Note: Falcor will populate many built-in shader variables mpRaster->execute(pRenderContext, mpGfxState, outputFbo); }
1,509
3,957
<gh_stars>1000+ from .sequence_tagger_model import SequenceTagger, MultiTagger from .language_model import LanguageModel from .text_classification_model import TextClassifier from .pairwise_classification_model import TextPairClassifier from .relation_extractor_model import RelationExtractor from .entity_linker_model import EntityLinker from .tars_model import FewshotClassifier from .tars_model import TARSClassifier from .tars_model import TARSTagger
126
336
<reponame>tomwei7/LA104<filename>tools/genelf/elf.h #pragma once typedef uint32_t Elf32_Addr; typedef uint16_t Elf32_Half; typedef uint32_t Elf32_Off; typedef int32_t Elf32_Sword; typedef uint32_t Elf32_Word; typedef uint32_t Elf32_Size; #pragma pack(push) #pragma pack(2) typedef struct { unsigned char ident[16]; Elf32_Half type; Elf32_Half machine; Elf32_Word version; Elf32_Addr entry; Elf32_Off phoff; Elf32_Off shoff; Elf32_Word flags; Elf32_Half ehsize; Elf32_Half phentsize; Elf32_Half phnum; Elf32_Half shentsize; Elf32_Half shnum; Elf32_Half shtrndx; } Elf32_Ehdr; typedef struct { Elf32_Word type; /* Entry type. */ Elf32_Off offset; /* File offset of contents. */ Elf32_Addr vaddr; /* Virtual address in memory image. */ Elf32_Addr paddr; /* Physical address (not used). */ Elf32_Size filesz; /* Size of contents in file. */ Elf32_Size memsz; /* Size of contents in memory. */ Elf32_Word flags; /* Access permission flags. */ Elf32_Size align; /* Alignment in memory and file. */ } Elf32_Phdr; typedef struct { Elf32_Word name; /* Section name (string tbl index) */ Elf32_Word type; /* Section type */ Elf32_Word flags; /* Section flags */ Elf32_Addr addr; /* Section virtual addr at execution */ Elf32_Off offset; /* Section file offset */ Elf32_Word size; /* Section size in bytes */ Elf32_Word link; /* Link to another section */ Elf32_Word info; /* Additional section information */ Elf32_Word addralign; /* Section alignment */ Elf32_Word entsize; /* Entry size if section holds table */ } Elf32_Shdr; typedef struct { Elf32_Word st_name; Elf32_Addr st_value; Elf32_Word st_size; unsigned char st_info; unsigned char st_other; Elf32_Half st_shndx; } Elf32_Sym; typedef struct { Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */ } Elf32_Rel; #pragma pack(pop) enum Elf32_enums { Elf32_PTypeNull = 0, Elf32_PTypeLoad = 1, Elf32_PTypeDynamic = 2, Elf32_PTypeInterpreter = 3, Elf32_PTypeHeader = 6 };
1,265
1,006
/**************************************************************************** * include/nuttx/sensors/hts221.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The * ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * ****************************************************************************/ #ifndef __INCLUDE_NUTT_SENSORS_HTS221_H #define __INCLUDE_NUTT_SENSORS_HTS221_H /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/sensors/ioctl.h> /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ #define HTS221_TEMPERATURE_PRECISION 100 #define HTS221_HUMIDITY_PRECISION 10 /**************************************************************************** * Public Types ****************************************************************************/ struct i2c_master_s; /* Forward reference */ /* Number of temperature samples */ typedef enum hts221_avrg_temp_e { HTS221_AVGT2 = 0, HTS221_AVGT4, HTS221_AVGT8, HTS221_AVGT16, /* Default value */ HTS221_AVGT32, HTS221_AVGT64, HTS221_AVGT128, HTS221_AVGT256 } hts221_avrg_temp_t; /* Number of humidity samples */ typedef enum hts221_avrg_humid_e { HTS221_AVGH4 = 0, HTS221_AVGH8, HTS221_AVGH16, HTS221_AVGH32, /* Default value */ HTS221_AVGH64, HTS221_AVGH128, HTS221_AVGH256, HTS221_AVGH512 }hts221_avrg_humid_t; /* Output data rate configuration */ typedef enum hts221_odr_e { HTS221_ODR_ONESHOT = 0, HTS221_ODR_1HZ, HTS221_ODR_7HZ, HTS221_ODR_12_5HZ } hts221_odr_t; /* Configuration structure */ typedef struct hts221_settings_s { hts221_avrg_temp_t temp_resol; /* Temperature resolution. The more * samples sensor takes, the more power * it uses */ hts221_avrg_humid_t humid_resol; /* Humidity resolution. The more * samples sensor takes, the more power * it uses */ hts221_odr_t odr; /* Output data rate */ bool is_bdu; /* If read operation is not faster than output * operation, then this variable must be set to true */ bool is_data_rdy; /* Must be set to true, if interrupt needed. * Default is 0, disabled */ bool is_high_edge; /* High or low interrupt signal from device. * Default is high, 0 */ bool is_open_drain; /* Open drain or push-pull on data-ready pin. * Default is push-pull, 0 */ bool is_boot; /* Refresh the content of the internal registers */ } hts221_settings_t; /* Interrupt configuration data structure */ typedef struct hts221_config_s { int irq; CODE int (*irq_attach)(FAR struct hts221_config_s * state, xcpt_t isr, FAR void *arg); CODE void (*irq_enable)(FAR const struct hts221_config_s *state, bool enable); CODE void (*irq_clear)(FAR const struct hts221_config_s *state); CODE int (*set_power)(FAR const struct hts221_config_s *state, bool on); } hts221_config_t; /* Raw data structure */ typedef struct hts221_raw_data_s { uint8_t humid_low_bits; uint8_t humid_high_bits; uint8_t temp_low_bits; uint8_t temp_high_bits; } hts221_raw_data_t; typedef struct hts221_conv_data_s { int temperature; unsigned int humidity; } hts221_conv_data_t; /* Status register data */ typedef struct hts221_status_s { bool is_humid_ready; bool is_temp_ready; } hts221_status_t; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ int hts221_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, uint8_t addr, hts221_config_t * config); #endif /* __INCLUDE_NUTT_SENSORS_HTS221_H */
1,924
2,151
<gh_stars>1000+ /* * * Copyright 2016 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include <grpc/support/port_platform.h> #include "src/core/lib/iomgr/port.h" #if GRPC_IF_NAMETOINDEX == 0 || !defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX) #include "src/core/lib/iomgr/grpc_if_nametoindex.h" #include <grpc/support/log.h> uint32_t grpc_if_nametoindex(char* name) { gpr_log(GPR_DEBUG, "Not attempting to convert interface name %s to index for current " "platform.", name); return 0; } #endif /* GRPC_IF_NAMETOINDEX == 0 || \ !defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX) */
421
575
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/supervised_user/supervised_user_sync_model_type_controller.h" #include "base/bind.h" #include "chrome/browser/profiles/profile.h" #include "components/sync/model/model_type_store_service.h" SupervisedUserSyncModelTypeController::SupervisedUserSyncModelTypeController( syncer::ModelType type, const Profile* profile, const base::RepeatingClosure& dump_stack, syncer::OnceModelTypeStoreFactory store_factory, base::WeakPtr<syncer::SyncableService> syncable_service) : SyncableServiceBasedModelTypeController( type, std::move(store_factory), syncable_service, dump_stack, DelegateMode::kTransportModeWithSingleModel), profile_(profile) { DCHECK(type == syncer::SUPERVISED_USER_SETTINGS || type == syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS); } SupervisedUserSyncModelTypeController:: ~SupervisedUserSyncModelTypeController() = default; syncer::DataTypeController::PreconditionState SupervisedUserSyncModelTypeController::GetPreconditionState() const { DCHECK(CalledOnValidThread()); return profile_->IsSupervised() ? PreconditionState::kPreconditionsMet : PreconditionState::kMustStopAndClearData; }
501
2,728
<reponame>Harshitha91/Tmdb-react-native-node /* * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * Copyright (c) 2009 <NAME> * Copyright (c) 2012 <NAME> * Copyright (c) 2013 - 2020 <NAME> */ /*! * \file atomic/detail/storage_traits.hpp * * This header defines underlying types used as storage */ #ifndef BOOST_ATOMIC_DETAIL_STORAGE_TRAITS_HPP_INCLUDED_ #define BOOST_ATOMIC_DETAIL_STORAGE_TRAITS_HPP_INCLUDED_ #include <cstddef> #include <boost/cstdint.hpp> #include <boost/atomic/detail/config.hpp> #include <boost/atomic/detail/string_ops.hpp> #include <boost/atomic/detail/aligned_variable.hpp> #include <boost/atomic/detail/type_traits/alignment_of.hpp> #include <boost/atomic/detail/header.hpp> #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif namespace boost { namespace atomics { namespace detail { template< typename T > BOOST_FORCEINLINE void non_atomic_load(T const volatile& from, T& to) BOOST_NOEXCEPT { to = from; } template< std::size_t Size, std::size_t Alignment = 1u > struct BOOST_ATOMIC_DETAIL_MAY_ALIAS buffer_storage { typedef unsigned char data_type[Size]; BOOST_ATOMIC_DETAIL_ALIGNED_VAR_TPL(Alignment, data_type, data); BOOST_FORCEINLINE bool operator! () const BOOST_NOEXCEPT { return (data[0] == 0u && BOOST_ATOMIC_DETAIL_MEMCMP(data, data + 1, Size - 1u) == 0); } BOOST_FORCEINLINE bool operator== (buffer_storage const& that) const BOOST_NOEXCEPT { return BOOST_ATOMIC_DETAIL_MEMCMP(data, that.data, Size) == 0; } BOOST_FORCEINLINE bool operator!= (buffer_storage const& that) const BOOST_NOEXCEPT { return BOOST_ATOMIC_DETAIL_MEMCMP(data, that.data, Size) != 0; } }; template< std::size_t Size, std::size_t Alignment > BOOST_FORCEINLINE void non_atomic_load(buffer_storage< Size, Alignment > const volatile& from, buffer_storage< Size, Alignment >& to) BOOST_NOEXCEPT { BOOST_ATOMIC_DETAIL_MEMCPY(to.data, const_cast< unsigned char const* >(from.data), Size); } template< std::size_t Size > struct storage_traits { typedef buffer_storage< Size, 1u > type; static BOOST_CONSTEXPR_OR_CONST std::size_t native_alignment = 1u; // By default, prefer the maximum supported alignment static BOOST_CONSTEXPR_OR_CONST std::size_t alignment = 16u; }; template< > struct storage_traits< 1u > { typedef boost::uint8_t BOOST_ATOMIC_DETAIL_MAY_ALIAS type; static BOOST_CONSTEXPR_OR_CONST std::size_t native_alignment = 1u; static BOOST_CONSTEXPR_OR_CONST std::size_t alignment = 1u; }; template< > struct storage_traits< 2u > { typedef boost::uint16_t BOOST_ATOMIC_DETAIL_MAY_ALIAS type; static BOOST_CONSTEXPR_OR_CONST std::size_t native_alignment = atomics::detail::alignment_of< boost::uint16_t >::value; static BOOST_CONSTEXPR_OR_CONST std::size_t alignment = 2u; }; template< > struct storage_traits< 4u > { typedef boost::uint32_t BOOST_ATOMIC_DETAIL_MAY_ALIAS type; static BOOST_CONSTEXPR_OR_CONST std::size_t native_alignment = atomics::detail::alignment_of< boost::uint32_t >::value; static BOOST_CONSTEXPR_OR_CONST std::size_t alignment = 4u; }; template< > struct storage_traits< 8u > { typedef boost::uint64_t BOOST_ATOMIC_DETAIL_MAY_ALIAS type; static BOOST_CONSTEXPR_OR_CONST std::size_t native_alignment = atomics::detail::alignment_of< boost::uint64_t >::value; static BOOST_CONSTEXPR_OR_CONST std::size_t alignment = 8u; }; #if defined(BOOST_HAS_INT128) template< > struct storage_traits< 16u > { typedef boost::uint128_type BOOST_ATOMIC_DETAIL_MAY_ALIAS type; static BOOST_CONSTEXPR_OR_CONST std::size_t native_alignment = atomics::detail::alignment_of< boost::uint128_type >::value; static BOOST_CONSTEXPR_OR_CONST std::size_t alignment = 16u; }; #else #if (__cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)) &&\ (!defined(BOOST_GCC_VERSION) || BOOST_GCC_VERSION >= 40900) using std::max_align_t; #else #if defined(BOOST_MSVC) #pragma warning(push) // alignment is sensitive to packing #pragma warning(disable: 4121) #endif class max_align_helper; union max_align_t { void* ptr; void (*fun_ptr)(); int max_align_helper::*mem_ptr; void (max_align_helper::*mem_fun_ptr)(); long long ll; long double ld; #if defined(BOOST_HAS_INT128) boost::int128_type i128; #endif #if defined(BOOST_HAS_FLOAT128) boost::float128_type f128; #endif }; #if defined(BOOST_MSVC) #pragma warning(pop) #endif #endif // __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) template< > struct storage_traits< 16u > { typedef buffer_storage< 16u, atomics::detail::alignment_of< atomics::detail::max_align_t >::value > type; static BOOST_CONSTEXPR_OR_CONST std::size_t native_alignment = atomics::detail::alignment_of< atomics::detail::max_align_t >::value; static BOOST_CONSTEXPR_OR_CONST std::size_t alignment = 16u; }; #endif template< typename T > struct storage_size_of { static BOOST_CONSTEXPR_OR_CONST std::size_t size = sizeof(T); static BOOST_CONSTEXPR_OR_CONST std::size_t value = (size == 3u ? 4u : (size >= 5u && size <= 7u ? 8u : (size >= 9u && size <= 15u ? 16u : size))); }; } // namespace detail } // namespace atomics } // namespace boost #include <boost/atomic/detail/footer.hpp> #endif // BOOST_ATOMIC_DETAIL_STORAGE_TRAITS_HPP_INCLUDED_
2,271
3,673
<reponame>jaeh/IncludeOS #include <service> extern "C" { __attribute__((noreturn)) void panic(const char* reason); } #ifndef __linux__ extern "C" __attribute__((noreturn)) void abort(){ panic("Abort called"); __builtin_unreachable(); } #endif const char* service_name__ = SERVICE_NAME; const char* service_binary_name__ = SERVICE; namespace os { uintptr_t liveupdate_memory_size_mb = _LIVEUPDATE_MEMSIZE_; }
165
312
package org.reveno.atp.metrics; import org.reveno.atp.api.transaction.TransactionStage; import org.reveno.atp.core.Engine; public class RevenoMetrics { protected ConfigurationImpl config = new ConfigurationImpl(); protected MetricsInterceptor interceptor = new MetricsInterceptor(config); public Configuration config() { return config; } public void listen(Engine engine) { engine.interceptors().add(TransactionStage.TRANSACTION, interceptor); interceptor.init(); } public void shutdown(Engine engine) { engine.interceptors().getInterceptors(TransactionStage.TRANSACTION).remove(interceptor); interceptor.shutdown(); } }
238
635
<filename>pyti/price_oscillator.py from __future__ import absolute_import from pyti import catch_errors from pyti.exponential_moving_average import ( exponential_moving_average as ema ) def price_oscillator(data, short_period, long_period): """ Price Oscillator. Formula: (short EMA - long EMA / long EMA) * 100 """ catch_errors.check_for_period_error(data, short_period) catch_errors.check_for_period_error(data, long_period) ema_short = ema(data, short_period) ema_long = ema(data, long_period) po = ((ema_short - ema_long) / ema_long) * 100 return po
234
547
<filename>bin2c.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <stdint.h> int main(int argc, char * argv[]) { FILE * fp_in, * fp_out; unsigned int length, left; char fname[256], * p; uint8_t buffer[256]; if(argc != 3) { printf("Usage: %s <binary file> <c file>\n", argv[0]); exit(-1); } fp_in = fopen(argv[1], "rb"); if(fp_in == NULL) { printf("Failed to open file %s for reading\n", argv[1]); exit(-1); } fp_out = fopen(argv[2], "wt"); if(fp_out == NULL) { printf("Failed to open file %s for output\n", argv[2]); exit(-1); } fseek(fp_in, 0, SEEK_END); length = ftell(fp_in); fseek(fp_in, 0, SEEK_SET); left = length; fprintf(fp_out, "/* Automatically generated file from %s */\n", argv[1]); strcpy(fname, argv[1]); for(p = fname; *p; p++) if(!isalnum(*p)) *p = '_'; fprintf(fp_out, "unsigned int %s_len = %d;\n", fname, length); fprintf(fp_out, "unsigned char %s[] = {\n\t", fname); while(left) { int to_read = left < sizeof(buffer) ? left : sizeof(buffer); int bytes = fread(buffer, 1, to_read, fp_in); int i; for(i = 0; i < bytes; i++) fprintf(fp_out, "0x%02x%s", buffer[i], (i % 16) == 15 ? ",\n\t" : ", "); left -= bytes; } fprintf(fp_out, "\n\t};\n"); fclose(fp_in); fclose(fp_out); return 0; }
635
852
<reponame>ckamtsikis/cmssw #include "EventFilter/RPCRawToDigi/interface/RPCAMC13Record.h" namespace rpcamc13 { Header::Header(std::uint64_t const record) : record_(record) {} Header::Header(unsigned int ufov, unsigned int n_amc, unsigned int orbit_counter) : record_(0x0) { setFirmwareVersion(ufov); setNAMC(n_amc); setOrbitCounter(orbit_counter); } Trailer::Trailer(std::uint64_t const record) : record_(record) {} Trailer::Trailer(std::uint32_t crc, unsigned int block_number, unsigned int event_counter, unsigned int bx_counter) : record_(0x0) { setCRC(crc); setBlockNumber(block_number); setEventCounter(event_counter); setBXCounter(bx_counter); } AMCHeader::AMCHeader(std::uint64_t const record) : record_(record) {} AMCHeader::AMCHeader(bool length_correct, bool last_block, bool first_block, bool enabled, bool present, bool valid, bool crc_ok, unsigned int size, unsigned int block_number, unsigned int amc_number, unsigned int board_id) : record_(0x0) { setLengthCorrect(length_correct); setLastBlock(last_block); setFirstBlock(first_block); setEnabled(enabled); setPresent(present); setValid(valid); setCRCOk(crc_ok); setSize(size); setBlockNumber(block_number); setAMCNumber(amc_number); setBoardId(board_id); } AMCPayload::AMCPayload() : valid_(true) {} } // namespace rpcamc13
762
982
<gh_stars>100-1000 #ifndef _VIRTIO_RING_ALLOCATION_H #define _VIRTIO_RING_ALLOCATION_H struct virtqueue *vring_new_virtqueue_split(unsigned int index, unsigned int num, unsigned int vring_align, VirtIODevice *vdev, void *pages, void (*notify)(struct virtqueue *), void *control); struct virtqueue *vring_new_virtqueue_packed(unsigned int index, unsigned int num, unsigned int vring_align, VirtIODevice *vdev, void *pages, void (*notify)(struct virtqueue *), void *control); unsigned int vring_control_block_size(u16 qsize, bool packed); unsigned int vring_control_block_size_packed(u16 qsize); unsigned long vring_size_packed(unsigned int num, unsigned long align); #endif /* _VIRTIO_RING_ALLOCATION_H */
284
12,278
// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2003-2007 <NAME> // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) // See http://www.boost.org/libs/iostreams for documentation. // Contains category and mode tags for classifying filters, devices and // standard stream and stream buffers types. #ifndef BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED #define BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED #if defined(_MSC_VER) # pragma once #endif namespace boost { namespace iostreams { //------------------Tags for dispatch according to i/o mode-------------------// struct any_tag { }; namespace detail { struct two_sequence : virtual any_tag { }; } namespace detail { struct random_access : virtual any_tag { }; } namespace detail { struct one_head : virtual any_tag { }; } namespace detail { struct two_head : virtual any_tag { }; } struct input : virtual any_tag { }; struct output : virtual any_tag { }; struct bidirectional : virtual input, virtual output, detail::two_sequence { }; struct dual_use : virtual input, virtual output { }; // Pseudo-mode. struct input_seekable : virtual input, virtual detail::random_access { }; struct output_seekable : virtual output, virtual detail::random_access { }; struct seekable : virtual input_seekable, virtual output_seekable, detail::one_head { }; struct dual_seekable : virtual input_seekable, virtual output_seekable, detail::two_head { }; struct bidirectional_seekable : input_seekable, output_seekable, bidirectional, detail::two_head { }; //------------------Tags for use as i/o categories----------------------------// struct device_tag : virtual any_tag { }; struct filter_tag : virtual any_tag { }; // // Tags for optional behavior. // struct peekable_tag : virtual any_tag { }; // Devices. struct closable_tag : virtual any_tag { }; struct flushable_tag : virtual any_tag { }; struct localizable_tag : virtual any_tag { }; struct optimally_buffered_tag : virtual any_tag { }; struct direct_tag : virtual any_tag { }; // Devices. struct multichar_tag : virtual any_tag { }; // Filters. struct source_tag : device_tag, input { }; struct sink_tag : device_tag, output { }; struct bidirectional_device_tag : device_tag, bidirectional { }; struct seekable_device_tag : virtual device_tag, seekable { }; struct input_filter_tag : filter_tag, input { }; struct output_filter_tag : filter_tag, output { }; struct bidirectional_filter_tag : filter_tag, bidirectional { }; struct seekable_filter_tag : filter_tag, seekable { }; struct dual_use_filter_tag : filter_tag, dual_use { }; struct multichar_input_filter_tag : multichar_tag, input_filter_tag { }; struct multichar_output_filter_tag : multichar_tag, output_filter_tag { }; struct multichar_bidirectional_filter_tag : multichar_tag, bidirectional_filter_tag { }; struct multichar_seekable_filter_tag : multichar_tag, seekable_filter_tag { }; struct multichar_dual_use_filter_tag : multichar_tag, dual_use_filter_tag { }; // // Tags for standard streams and streambufs. // struct std_io_tag : virtual localizable_tag { }; struct istream_tag : virtual device_tag, virtual peekable_tag, virtual std_io_tag { }; struct ostream_tag : virtual device_tag, virtual std_io_tag { }; struct iostream_tag : istream_tag, ostream_tag { }; struct streambuf_tag : device_tag, peekable_tag, std_io_tag { }; struct ifstream_tag : input_seekable, closable_tag, istream_tag { }; struct ofstream_tag : output_seekable, closable_tag, ostream_tag { }; struct fstream_tag : seekable, closable_tag, iostream_tag { }; struct filebuf_tag : seekable, closable_tag, streambuf_tag { }; struct istringstream_tag : input_seekable, istream_tag { }; struct ostringstream_tag : output_seekable, ostream_tag { }; struct stringstream_tag : dual_seekable, iostream_tag { }; struct stringbuf_tag : dual_seekable, streambuf_tag { }; struct generic_istream_tag : input_seekable, istream_tag { }; struct generic_ostream_tag : output_seekable, ostream_tag { }; struct generic_iostream_tag : seekable, iostream_tag { }; struct generic_streambuf_tag : seekable, streambuf_tag { }; } } // End namespaces iostreams, boost. #endif // #ifndef BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED
1,772
445
from skmultiflow.trees import HAT, RegressionHAT from decai.simulation.contract.classification.scikit_classifier import SciKitClassifierModule class DecisionTreeModule(SciKitClassifierModule): def __init__(self, regression=False): if regression: model_initializer = lambda: RegressionHAT( # leaf_prediction='mc' ) else: model_initializer = lambda: HAT( # leaf_prediction='mc', # nominal_attributes=[ 4], ) super().__init__(_model_initializer=model_initializer)
260
575
<filename>components/blocklist/opt_out_blocklist/opt_out_blocklist_item_unittest.cc // Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/blocklist/opt_out_blocklist/opt_out_blocklist_item.h" #include <memory> #include "base/optional.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" namespace { using OptOutBlocklistItemTest = testing::Test; } // namespace namespace blocklist { TEST_F(OptOutBlocklistItemTest, BlockListState) { const int history = 4; const int threshold = 2; const base::TimeDelta max_blocklist_duration = base::TimeDelta::FromSeconds(30); const base::Time now = base::Time::UnixEpoch(); const base::TimeDelta delay_between_entries = base::TimeDelta::FromSeconds(1); const base::Time later = now + max_blocklist_duration + (delay_between_entries * 3); OptOutBlocklistItem block_list_item(history, threshold, max_blocklist_duration); // Empty block list item should report that the host is allowed. EXPECT_FALSE(block_list_item.IsBlockListed(now)); EXPECT_FALSE(block_list_item.IsBlockListed(later)); EXPECT_FALSE(block_list_item.most_recent_opt_out_time()); block_list_item.AddEntry(false, now); EXPECT_FALSE(block_list_item.most_recent_opt_out_time()); block_list_item.AddEntry(true, now); EXPECT_TRUE(block_list_item.most_recent_opt_out_time()); EXPECT_EQ(now, block_list_item.most_recent_opt_out_time().value()); // Block list item of size less that |threshold| should report that the host // is allowed. EXPECT_FALSE(block_list_item.IsBlockListed(now)); EXPECT_FALSE(block_list_item.IsBlockListed(later)); block_list_item.AddEntry(true, now + delay_between_entries); // Block list item with |threshold| fresh entries should report the host as // disallowed. EXPECT_TRUE(block_list_item.IsBlockListed(now)); // Block list item with only entries from longer than |duration| ago should // report the host is allowed. EXPECT_FALSE(block_list_item.IsBlockListed(later)); block_list_item.AddEntry(true, later - (delay_between_entries * 2)); // Block list item with a fresh opt out and total number of opt outs larger // than |threshold| should report the host is disallowed. EXPECT_TRUE(block_list_item.IsBlockListed(later)); // The block list item should maintain entries based on time, so adding // |history| entries should not push out newer entries. block_list_item.AddEntry(true, later - delay_between_entries * 2); block_list_item.AddEntry(false, later - delay_between_entries * 3); block_list_item.AddEntry(false, later - delay_between_entries * 3); block_list_item.AddEntry(false, later - delay_between_entries * 3); block_list_item.AddEntry(false, later - delay_between_entries * 3); EXPECT_TRUE(block_list_item.IsBlockListed(later)); // The block list item should maintain entries based on time, so adding // |history| newer entries should push out older entries. block_list_item.AddEntry(false, later - delay_between_entries * 1); block_list_item.AddEntry(false, later - delay_between_entries * 1); block_list_item.AddEntry(false, later - delay_between_entries * 1); block_list_item.AddEntry(false, later - delay_between_entries * 1); EXPECT_FALSE(block_list_item.IsBlockListed(later)); } } // namespace blocklist
1,160
1,312
<gh_stars>1000+ from unittest.mock import patch from django.test import TestCase from bookmarks.models import Tag from bookmarks.services import tasks from bookmarks.services.importer import import_netscape_html from bookmarks.tests.helpers import BookmarkFactoryMixin, disable_logging class ImporterTestCase(TestCase, BookmarkFactoryMixin): def create_import_html(self, bookmark_tags_string: str): return f''' <!DOCTYPE NETSCAPE-Bookmark-file-1> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <TITLE>Bookmarks</TITLE> <H1>Bookmarks</H1> <DL><p> {bookmark_tags_string} </DL><p> ''' def test_replace_whitespace_in_tag_names(self): test_html = self.create_import_html(f''' <DT><A HREF="https://example.com" ADD_DATE="1616337559" PRIVATE="0" TOREAD="0" TAGS="tag 1, tag 2, tag 3">Example.com</A> <DD>Example.com ''') import_netscape_html(test_html, self.get_or_create_test_user()) tags = Tag.objects.all() tag_names = [tag.name for tag in tags] self.assertListEqual(tag_names, ['tag-1', 'tag-2', 'tag-3']) @disable_logging def test_validate_empty_or_missing_bookmark_url(self): test_html = self.create_import_html(f''' <!-- Empty URL --> <DT><A HREF="" ADD_DATE="1616337559" PRIVATE="0" TOREAD="0" TAGS="tag3">Empty URL</A> <DD>Empty URL <!-- Missing URL --> <DT><A ADD_DATE="1616337559" PRIVATE="0" TOREAD="0" TAGS="tag3">Missing URL</A> <DD>Missing URL ''') import_result = import_netscape_html(test_html, self.get_or_create_test_user()) self.assertEqual(import_result.success, 0) def test_schedule_snapshot_creation(self): user = self.get_or_create_test_user() test_html = self.create_import_html('') with patch.object(tasks, 'schedule_bookmarks_without_snapshots') as mock_schedule_bookmarks_without_snapshots: import_netscape_html(test_html, user) mock_schedule_bookmarks_without_snapshots.assert_called_once_with(user.id)
929
831
<reponame>phpc0de/idea-android /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.datastore.poller; import com.android.tools.datastore.database.DeviceProcessTable; import com.android.tools.profiler.proto.Common; import com.android.tools.profiler.proto.Common.AgentData; import com.android.tools.profiler.proto.Transport.AgentStatusRequest; import com.android.tools.profiler.proto.Transport.GetDevicesRequest; import com.android.tools.profiler.proto.Transport.GetDevicesResponse; import com.android.tools.profiler.proto.Transport.GetProcessesRequest; import com.android.tools.profiler.proto.Transport.GetProcessesResponse; import com.android.tools.profiler.proto.TransportServiceGrpc; import com.google.common.collect.Sets; import io.grpc.StatusRuntimeException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import org.jetbrains.annotations.NotNull; public class DeviceProcessPoller extends PollRunner { private static final class DeviceData { public final Common.Device device; public final Set<Common.Process> processes = new HashSet<>(); public DeviceData(Common.Device device) { this.device = device; } } @NotNull private final DeviceProcessTable myTable; @NotNull private final TransportServiceGrpc.TransportServiceBlockingStub myPollingService; @NotNull private final Map<Long, DeviceData> myDevices = new HashMap<>(); public DeviceProcessPoller(@NotNull DeviceProcessTable table, @NotNull TransportServiceGrpc.TransportServiceBlockingStub pollingService) { super(TimeUnit.SECONDS.toNanos(1)); myTable = table; myPollingService = pollingService; } @Override public void stop() { super.stop(); // This gets called when connection to the device is lost. Properly clean up the device and processes states. disconnect(); } @Override public void poll() { try { GetDevicesRequest devicesRequest = GetDevicesRequest.newBuilder().build(); GetDevicesResponse deviceResponse = myPollingService.getDevices(devicesRequest); for (Common.Device device : deviceResponse.getDeviceList()) { long deviceId = device.getDeviceId(); myTable.insertOrUpdateDevice(device); DeviceData deviceData = myDevices.computeIfAbsent(deviceId, s -> new DeviceData(device)); GetProcessesRequest processesRequest = GetProcessesRequest.newBuilder().setDeviceId(deviceId).build(); GetProcessesResponse processesResponse = myPollingService.getProcesses(processesRequest); // Gather the list of last known active processes. Set<Common.Process> liveProcesses = new HashSet<>(); for (Common.Process process : processesResponse.getProcessList()) { assert process.getDeviceId() == deviceId; myTable.insertOrUpdateProcess(deviceId, process); liveProcesses.add(process); AgentStatusRequest agentStatusRequest = AgentStatusRequest.newBuilder().setPid(process.getPid()).setDeviceId(deviceId).build(); AgentData cachedData = myTable.getAgentStatus(agentStatusRequest); if (cachedData.getStatus() == AgentData.Status.UNSPECIFIED) { AgentData agentData = myPollingService.getAgentStatus(agentStatusRequest); myTable.updateAgentStatus(deviceId, process, agentData); } deviceData.processes.add(process); } Set<Common.Process> deadProcesses = Sets.difference(deviceData.processes, liveProcesses); killProcesses(deviceId, deadProcesses); } } catch (StatusRuntimeException ex) { // We expect this to get called when connection to the device is lost. // To properly clean up the state we first set all ALIVE processes to DEAD // then we disconnect the channel. disconnect(); } } private void disconnect() { for (Map.Entry<Long, DeviceData> entry : myDevices.entrySet()) { disconnectDevice(entry.getValue().device); killProcesses(entry.getKey(), entry.getValue().processes); } myDevices.clear(); } private void disconnectDevice(Common.Device device) { Common.Device disconnectedDevice = device.toBuilder().setState(Common.Device.State.DISCONNECTED).build(); myTable.insertOrUpdateDevice(disconnectedDevice); } private void killProcesses(long deviceId, Set<Common.Process> processes) { for (Common.Process process : processes) { Common.Process updatedProcess = process.toBuilder().setState(Common.Process.State.DEAD).build(); myTable.insertOrUpdateProcess(deviceId, updatedProcess); // The process is already dead, but we still show past sessions in the UI. To preserve their agent status we only mark it unattachable // if an agent was never attached. AgentData agentData = myTable.getAgentStatus(AgentStatusRequest.newBuilder().setDeviceId(deviceId).setPid(process.getPid()).build()); if (agentData.getStatus() == AgentData.Status.UNSPECIFIED) { myTable.updateAgentStatus(deviceId, process, agentData.toBuilder().setStatus(AgentData.Status.UNATTACHABLE).build()); } } } }
1,887
507
<filename>test/lib/usd/translators/testUsdExportMesh.py #!/usr/bin/env mayapy # # Copyright 2016 Pixar # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import os import unittest from maya import cmds from maya import standalone from pxr import Gf, Sdf, Usd, UsdGeom, UsdSkel, Vt import fixturesUtils class testUsdExportMesh(unittest.TestCase): @classmethod def setUpClass(cls): cls.inputPath = fixturesUtils.setUpClass(__file__) cls.temp_dir = os.path.abspath('.') cls.meshTestFile = os.path.join(cls.inputPath, "UsdExportMeshTest", "UsdExportMeshTest.ma") cmds.file(cls.meshTestFile, force=True, open=True) @classmethod def tearDownClass(cls): standalone.uninitialize() def _AssertVec3fArrayAlmostEqual(self, arr1, arr2): self.assertEqual(len(arr1), len(arr2)) for i in range(len(arr1)): for j in range(3): self.assertAlmostEqual(arr1[i][j], arr2[i][j], places=3) def testExportAsCatmullClark(self): cmds.file(self.meshTestFile, force=True, open=True) usdFile = os.path.abspath('UsdExportMesh_catmullClark.usda') cmds.usdExport(mergeTransformAndShape=True, file=usdFile, shadingMode='none', defaultMeshScheme='catmullClark') stage = Usd.Stage.Open(usdFile) # This has subdivision scheme 'none', # face-varying linear interpolation 'all'. # The interpolation attribute doesn't matter since it's not a subdiv, # so we don't write it out even though it's set on the node. m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/poly') self.assertEqual(m.GetSubdivisionSchemeAttr().Get(), UsdGeom.Tokens.none) self.assertTrue(m.GetSubdivisionSchemeAttr().IsAuthored()) self.assertFalse(m.GetInterpolateBoundaryAttr().IsAuthored()) self.assertFalse(m.GetFaceVaryingLinearInterpolationAttr().IsAuthored()) self.assertTrue(len(m.GetNormalsAttr().Get()) > 0) m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/polyNoNormals') self.assertEqual(m.GetSubdivisionSchemeAttr().Get(), UsdGeom.Tokens.none) self.assertTrue(m.GetSubdivisionSchemeAttr().IsAuthored()) self.assertFalse(m.GetInterpolateBoundaryAttr().IsAuthored()) self.assertFalse(m.GetFaceVaryingLinearInterpolationAttr().IsAuthored()) self.assertTrue(not m.GetNormalsAttr().Get()) # We author subdivision scheme sparsely, so if the subd scheme is # catmullClark or unspecified (falls back to # defaultMeshScheme=catmullClark), then it shouldn't be authored. # Note that this code is interesting because both # USD_interpolateBoundary and USD_ATTR_interpolateBoundary are set; # the latter should win when both are present. m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/subdiv') self.assertEqual(m.GetSubdivisionSchemeAttr().Get(), UsdGeom.Tokens.catmullClark) self.assertFalse(m.GetSubdivisionSchemeAttr().IsAuthored()) self.assertEqual(m.GetInterpolateBoundaryAttr().Get(), UsdGeom.Tokens.edgeAndCorner) self.assertTrue(m.GetInterpolateBoundaryAttr().IsAuthored()) self.assertEqual(m.GetFaceVaryingLinearInterpolationAttr().Get(), UsdGeom.Tokens.cornersPlus1) self.assertTrue(m.GetFaceVaryingLinearInterpolationAttr().IsAuthored()) self.assertTrue(not m.GetNormalsAttr().Get()) m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/unspecified') self.assertEqual(m.GetSubdivisionSchemeAttr().Get(), UsdGeom.Tokens.catmullClark) self.assertFalse(m.GetSubdivisionSchemeAttr().IsAuthored()) self.assertFalse(m.GetInterpolateBoundaryAttr().IsAuthored()) self.assertFalse(m.GetFaceVaryingLinearInterpolationAttr().IsAuthored()) self.assertTrue(not m.GetNormalsAttr().Get()) def testExportAsPoly(self): cmds.file(self.meshTestFile, force=True, open=True) usdFile = os.path.abspath('UsdExportMesh_none.usda') cmds.usdExport(mergeTransformAndShape=True, file=usdFile, shadingMode='none', defaultMeshScheme='none') stage = Usd.Stage.Open(usdFile) m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/unspecified') self.assertEqual(m.GetSubdivisionSchemeAttr().Get(), UsdGeom.Tokens.none) self.assertTrue(m.GetSubdivisionSchemeAttr().IsAuthored()) self.assertFalse(m.GetInterpolateBoundaryAttr().IsAuthored()) self.assertFalse(m.GetFaceVaryingLinearInterpolationAttr().IsAuthored()) self.assertTrue(len(m.GetNormalsAttr().Get()) > 0) # Explicit catmullClark meshes should still export as catmullClark. m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/subdiv') self.assertEqual(m.GetSubdivisionSchemeAttr().Get(), UsdGeom.Tokens.catmullClark) self.assertFalse(m.GetSubdivisionSchemeAttr().IsAuthored()) self.assertEqual(m.GetInterpolateBoundaryAttr().Get(), UsdGeom.Tokens.edgeAndCorner) self.assertTrue(m.GetInterpolateBoundaryAttr().IsAuthored()) self.assertEqual(m.GetFaceVaryingLinearInterpolationAttr().Get(), UsdGeom.Tokens.cornersPlus1) self.assertTrue(m.GetFaceVaryingLinearInterpolationAttr().IsAuthored()) self.assertTrue(not m.GetNormalsAttr().Get()) # XXX: For some reason, when the mesh export used the getNormal() # method on MItMeshFaceVertex, we would sometimes get incorrect normal # values. Instead, we had to get all of the normals off of the MFnMesh # and then use the iterator's normalId() method to do a lookup into the # normals. # This test ensures that we're getting correct normals. The mesh should # only have normals in the x or z direction. m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/TestNormalsMesh') normals = m.GetNormalsAttr().Get() self.assertTrue(normals) for n in normals: # we don't expect the normals to be pointed in the y-axis at all. self.assertAlmostEqual(n[1], 0.0, delta=1e-4) # make sure the other 2 values aren't both 0. self.assertNotAlmostEqual(abs(n[0]) + abs(n[2]), 0.0, delta=1e-4) def testExportCreases(self): cmds.file(self.meshTestFile, force=True, open=True) usdFile = os.path.abspath('UsdExportMesh_creases.usda') cmds.usdExport(mergeTransformAndShape=True, file=usdFile, shadingMode='none') stage = Usd.Stage.Open(usdFile) m = UsdGeom.Mesh.Get(stage, '/UsdExportMeshTest/creased') self.assertEqual(m.GetSubdivisionSchemeAttr().Get(), UsdGeom.Tokens.catmullClark) self.assertFalse(m.GetSubdivisionSchemeAttr().IsAuthored()) self.assertTrue(not m.GetNormalsAttr().Get()) expectedCreaseIndices = Vt.IntArray([0, 1, 3, 2, 0, 3, 5, 4, 2, 5, 7, 6, 4, 7, 1, 0, 6]) creaseIndices = m.GetCreaseIndicesAttr().Get() self.assertEqual(creaseIndices, expectedCreaseIndices) expectedCreaseLengths = Vt.IntArray([5, 4, 4, 2, 2]) creaseLengths = m.GetCreaseLengthsAttr().Get() self.assertEqual(creaseLengths, expectedCreaseLengths) expectedCreaseSharpnesses = Vt.FloatArray([10, 10, 10, 10, 10]) creaseSharpnesses = m.GetCreaseSharpnessesAttr().Get() self.assertAlmostEqual(creaseSharpnesses, expectedCreaseSharpnesses, places=3) def testSidedness(self): for sidedness in ('single', 'double', 'derived'): for doubleSided in (False, True): output = os.path.join(self.temp_dir, 'sidedness_{}_{}.usda'.format(sidedness, doubleSided)) cmds.file(new=True, force=True) xform, _ = cmds.polyCube() shape = cmds.listRelatives(xform)[0] cmds.setAttr("{}.doubleSided".format(shape), doubleSided) cmds.mayaUSDExport(file=output, selection=True, geomSidedness=sidedness) stage = Usd.Stage.Open(output) prim = stage.GetPrimAtPath("/pCube1") value = UsdGeom.Mesh(prim).GetDoubleSidedAttr().Get() if sidedness == 'derived': self.assertEqual(value, doubleSided, "Incorrect derived sidedness value") elif sidedness == 'single': self.assertFalse(value, "Incorrect single sidedness value") elif sidedness == 'double': self.assertTrue(value, "Incorrect double sidedness value") if __name__ == '__main__': unittest.main(verbosity=2)
3,825
1,144
package de.metas.handlingunits.attribute.strategy; /* * #%L * de.metas.handlingunits.base * %% * Copyright (C) 2015 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ import java.math.BigDecimal; import org.compiere.model.I_C_UOM; import de.metas.handlingunits.IHUContext; import de.metas.handlingunits.attribute.storage.IAttributeStorage; import de.metas.handlingunits.storage.IHUStorage; import de.metas.product.ProductId; /** * Provides necessary data from to the transfer strategies when re-propagating values post-transfer to the other storage. * * @author al */ public interface IHUAttributeTransferRequest { /** * @return {@link IHUContext} in which the transfer is happening */ IHUContext getHUContext(); /** * @return product used in transfer between {@link IHUStorage}s */ ProductId getProductId(); /** * @return qty to be transferred between {@link IHUStorage}s */ BigDecimal getQty(); /** * @return UOM used in transfer between {@link IHUStorage}s */ I_C_UOM getC_UOM(); /** * @return {@link IAttributeStorage} from which the attributes are transferred */ IAttributeStorage getAttributesFrom(); /** * @return {@link IAttributeStorage} to which the attributes are transferred */ IAttributeStorage getAttributesTo(); /** * @return {@link IHUStorage} from which the attributes are transferred */ IHUStorage getHUStorageFrom(); /** * @return {@link IHUStorage} to which the attributes are transferred */ IHUStorage getHUStorageTo(); /** * @return qty already unloaded (at the moment of the attribute transfer, the trxLines are not processed, so the ProductStorage changes are not persisted yet) */ BigDecimal getQtyUnloaded(); /** * * @return true if this request is about transfering attributes between virtual HUs. */ boolean isVHUTransfer(); }
757
364
/** * @file oglplus/output_data.hpp * @brief Object wrapping buffer to store output data * * @author <NAME> * * Copyright 2010-2019 <NAME>. Distributed under the Boost * Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #pragma once #ifndef OGLPLUS_OUTPUT_DATA_1310102147_HPP #define OGLPLUS_OUTPUT_DATA_1310102147_HPP #include <oglplus/buffer_size.hpp> #include <oglplus/data_type.hpp> #include <oglplus/pixel_data.hpp> #include <oglplus/size_type.hpp> namespace oglplus { /// Class used for passing the address and size of a writable buffer to /// functions class OutputData { public: using PixDataType = OneOf<GLenum, std::tuple<DataType, PixelDataType>>; private: PixDataType _type; BufferSize _size; GLvoid* _addr; OutputData(const OutputData&); public: /// Construction from @p size in bytes and pointer to @p addr OutputData(BufferSize size, GLvoid* addr) : _type(DataType::UnsignedByte) , _size(size) , _addr(addr) {} /// Construction from @p type, @p size in bytes and pointer to @p addr OutputData(PixDataType type, BufferSize size, GLvoid* addr) : _type(type) , _size(size) , _addr(addr) {} /// Construction from @p count of instances of type @c T at @p addr template <typename T> OutputData(SizeType count, T* addr) : _type(GetDataType<T>()) , _size(unsigned(count), addr) , _addr(addr) {} /// Construction from an array with known size template <typename T, std::size_t N> OutputData(T (&addr)[N]) : _type(GetDataType<T>()) , _size(addr) , _addr(addr) {} /// Construction from a std::array template <typename T, std::size_t N> OutputData(std::array<T, N>& a) : _type(GetDataType<T>()) , _size(a) , _addr(a.data()) {} /// Construction from a std::vector template <typename T> OutputData(std::vector<T>& v) : _type(GetDataType<T>()) , _size(v) , _addr(v.data()) {} PixDataType Type() const { return _type; } BigSizeType Size() const { return _size; } GLvoid* Addr() const { return _addr; } }; } // namespace oglplus #endif // include guard
937
2,728
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """ FILE: network_activity_logging.py DESCRIPTION: This example shows how to enable logging to console, using the storage library as an example. This sample expects that the `AZURE_STORAGE_CONNECTION_STRING` environment variable is set. It SHOULD NOT be hardcoded in any code derived from this sample. USAGE: python network_activity_logging.py Set the environment variables with your own values before running the sample: 1) AZURE_STORAGE_CONNECTION_STRING - the connection string to your storage account EXAMPLE OUTPUT: Request with logging enabled and log level set to DEBUG. Queue test ... <logged network activity> ... Message: b'here is a message' Message: Here is a non-base64 encoded message. """ import base64 import binascii import logging import os import sys from azure.storage.queue import QueueServiceClient # Retrieve connection string from environment variables # and construct a blob service client. connection_string = os.environ.get('AZURE_STORAGE_CONNECTION_STRING', None) if not connection_string: print('AZURE_STORAGE_CONNECTION_STRING required.') sys.exit(1) service_client = QueueServiceClient.from_connection_string(connection_string) # Retrieve a compatible logger and add a handler to send the output to console (STDOUT). # Compatible loggers in this case include `azure` and `azure.storage`. logger = logging.getLogger('azure.storage.queue') logger.addHandler(logging.StreamHandler(stream=sys.stdout)) # Logging policy logs network activity at the DEBUG level. Set the level on the logger prior to the call. logger.setLevel(logging.DEBUG) # The logger level must be set to DEBUG, AND the following must be true: # `logging_enable=True` passed as kwarg to the client constructor OR the API call print('Request with logging enabled and log level set to DEBUG.') queues = service_client.list_queues(logging_enable=True) for queue in queues: print('Queue: {}'.format(queue.name)) queue_client = service_client.get_queue_client(queue.name) messages = queue_client.peek_messages(max_messages=20, logging_enable=True) for message in messages: try: print(' Message: {}'.format(base64.b64decode(message.content))) except binascii.Error: print(' Message: {}'.format(message.content))
761
1,433
/* ***************************************************************** * * Copyright 2015 Samsung Electronics All Rights Reserved. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************/ /** * @file * This file contains class which provides functions to retrieve the Action * details from a Segment. */ package org.iotivity.service.tm; import java.util.StringTokenizer; import java.util.Vector; import android.util.Log; /** * This class provides functions to retrieve the Action details from a Segment. */ public class Action { private static final String LOG_TAG = "Action"; /** * Sub Segment Value */ public String target; /** * Capability instance stored in listOfCapability vector variable. */ public Vector<Capability> listOfCapability = new Vector<Capability>(); /** * This function generates an Action String (Example: * uri=coap://10.251.44.228:49858/a/light|power=10) * * @return String for a specific action. */ public String toString() { StringBuilder result = new StringBuilder(); result.append("uri=" + target + "|"); for (int i = 0; i < listOfCapability.size(); i++) { if (i != 0) result.append('|'); result.append(listOfCapability.elementAt(i).toString()); } return result.toString(); } /** * This function parses the Segment value to retrieve sub segments separated * by a vertical bar(|): URI and a pair of attribute key and value. * * @param actionString * Segment String * * @return Action needed by remote devices as members of a specific group */ public static Action toAction(String actionString) { Action result = new Action(); StringTokenizer tokenizer = new StringTokenizer(actionString, "|"); boolean actionFlag = false; while (tokenizer.hasMoreTokens()) { String segment = tokenizer.nextToken(); if (false == actionFlag) { // Parse the action string StringTokenizer targetTokenizer = new StringTokenizer(segment, "="); if (2 != targetTokenizer.countTokens() || false == targetTokenizer.nextToken() .equalsIgnoreCase("uri")) { Log.e(LOG_TAG, "Invalid action segment = " + segment); return null; } result.target = targetTokenizer.nextToken(); actionFlag = true; } else { // Parse the capability string Capability capability = Capability.toCapability(segment); if (null == capability) { Log.e(LOG_TAG, "Failed to convert string to Capability class!"); return null; } // Add the parsed capability to list result.listOfCapability.add(capability); } } return result; } }
1,472
1,056
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.modules.maven.indexer; import java.util.Set; import org.openide.util.Cancellable; import org.openide.util.WeakSet; /** * Thrown when a task is canceled. * Cannot just be a {@link RuntimeException}, since {@link DefaultNexusIndexer#scan} would catch it. */ final class Cancellation extends Error { public Cancellation() { super("canceled"); } private static final Set<Cancellable> cancellables = new WeakSet<Cancellable>(); public static synchronized void register(Cancellable c) { cancellables.add(c); } public static synchronized boolean cancelAll() { boolean ok = true; for (Cancellable c : cancellables) { boolean result = c.cancel(); ok &= result; } return ok; } }
503
513
<gh_stars>100-1000 package com.zmops.iot.web.alarm.service; import com.zmops.iot.core.auth.context.LoginContextHolder; import com.zmops.iot.domain.messages.MailParam; import com.zmops.iot.domain.messages.MailSetting; import com.zmops.iot.domain.messages.NoticeResult; import com.zmops.iot.domain.messages.query.QMailSetting; import com.zmops.iot.media.mail.MailNotice; import com.zmops.iot.media.mail.MailSettingService; import io.ebean.DB; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; /** * @author yefei **/ @Service @Slf4j public class MailSettingServiceImpl implements MailSettingService { @Autowired MailNotice mailNotice; private volatile Map<Long, MailSetting> instanceMap = new HashMap<>(); @Override public MailSetting get() { return Optional.ofNullable(getOne()).orElse(new MailSetting()); } private MailSetting getOne() { Long tenantId = LoginContextHolder.getContext().getUser().getTenantId(); tenantId = Optional.ofNullable(tenantId).orElse(-1L); if (instanceMap.get(tenantId) != null) { return instanceMap.get(tenantId); } MailSetting mailSetting = Optional.of(new QMailSetting().findList()) .map(Collection::iterator) .filter(Iterator::hasNext) .map(Iterator::next).orElse(null); if (mailSetting != null) { instanceMap.put(tenantId, mailSetting); } return mailSetting; } @Override public NoticeResult test(MailParam mailParam) { MailSetting mailSetting = mailParam.getSettings(); NoticeResult noticeResult = mailNotice.test(mailSetting, mailParam.getReceiver()); //updateSettings(noticeResult, mailSetting); return noticeResult; } @Override public Integer updateSettings(MailSetting mailSetting) { if (mailSetting.getTls() == null) { mailSetting.setTls(0); } if (mailSetting.getSsl() == null) { mailSetting.setSsl(0); } MailSetting dbSetting = getOne(); if (dbSetting == null) { DB.insert(mailSetting); } else { mailSetting.setId(dbSetting.getId()); DB.update(mailSetting); } Long tenantId = Optional.ofNullable(mailSetting.getTenantId()).orElse(-1L); instanceMap.put(tenantId, mailSetting); return mailSetting.getId(); } }
1,049
310
{ "name": "<NAME> (iOS)", "description": "A jewel-matching puzzle game.", "url": "https://itunes.apple.com/us/app/bejeweled-blitz/id469960709" }
60
366
#from @PeterSardine from manimlib.imports import * class Main(Scene): def construct(self): title = Text(r'Manim Homework I').shift(UP)\ .set_color(ORANGE).set_opacity(0.5) signature = Text(r'by PeterSardine').next_to(title, DOWN).scale(0.5)\ .set_color(ORANGE).set_opacity(0.5) beginning = VGroup(title, signature) self.play(Write(title), rate_func=smooth) self.play(Write(signature), rate_func=smooth) self.wait(2) triangle = Polygon( np.array([-1,-1,0]), np.array([1.2,0.5,0]), np.array([-0.5,1,0]) ) self.play(ReplacementTransform(beginning, triangle)) self.wait(1) squares = VGroup() points = [] for pair in adjacent_pairs(triangle.get_vertices()): from_point, to_point = pair mid = (from_point+to_point)/2 center = mid + rotate(from_point-mid, np.pi/2) points.extend([ rotate(to_point-from_point, -np.pi/2) + from_point, rotate(to_point-from_point, -np.pi/2) + to_point, ]) squares.add(Square( side_length = np.linalg.norm(to_point-from_point), color=BLUE, fill_opacity=0.5 ).move_to(center).rotate(np.arctan((to_point[1]-from_point[1])/(to_point[0]-from_point[0]))) ) self.play(ShowCreation(squares)) self.wait(1) triangles = VGroup() for i in range(3): triangles.add( Polygon(triangle.get_vertices()[i], points[2*i-1], points[2*i],\ color=RED, fill_opacity=0.5) ) labels = VGroup() labels.add(TexMobject('S_{1}', color=WHITE)) labels.add(*[ TexMobject('S_%d'%i, color=WHITE) for i in range(3) ]) labels.add_updater( lambda m:[m[i+1].move_to(triangles[i].get_center())for i in range(3)] ) self.play(ShowCreation(triangles)) self.play(Write(labels)) self.play(*[Rotate(triangles[i], np.pi/2, about_point=triangle.get_vertices()[i])for i in range(3)],\ FadeOut(squares)) labels.suspend_updating() eq = TexMobject('S_0=S_1=S_2=S_3', color= WHITE) for i in triangles: self.play(ReplacementTransform(i, triangle)) self.play(ReplacementTransform(labels, eq)) self.play(eq.shift, UP*1.5) self.wait(2)
1,387
4,054
<reponame>Anlon-Burke/vespa {"put":"id:testapp:metric::clicks-2015110414","fields":{"date":"2015110414","name":"clicks","value":1,"application":"testapp"}} {"fields":{"date":"2015110416","name":"clicks","value":5,"application":"testapp"},"put":"id:testapp:metric::clicks-2015110416"} {"put":"id:testapp:metric::clicks-2015110415","fields":{"date":"2015110415","name":"clicks","value":2,"application":"testapp"}} {"put":"id:testapp:metric::clicks-2015110417","fields":{"date":"2015110417","name":"clicks","value":3,"application":"testapp"}} {"put":"id:testapp:metric::clicks-2015110418","fields":{"date":"2015110418","name":"clicks","value":6,"application":"testapp"}} {"put":"id:testapp:metric::clicks-2015110419","fields":{"date":"2015110419","name":"clicks","value":3,"application":"testapp"}} {"put":"id:testapp:metric::clicks-2015110420","fields":{"date":"2015110420","name":"clicks","value":4,"application":"testapp"}} {"put":"id:testapp:metric::clicks-2015110421","fields":{"date":"2015110421","name":"clicks","value":2,"application":"testapp"}} {"fields":{"date":"2015110422","name":"clicks","value":5,"application":"testapp"},"condition":"metrics==0","put":"id:testapp:metric::clicks-2015110422"} {"put":"id:testapp:metric::clicks-2015110423","fields":{"date":"2015110423","name":"clicks","value":1,"application":"testapp"}}
459
1,997
<gh_stars>1000+ dependencies = ["torch", "math"] def se_resnet20(**kwargs): from senet.se_resnet import se_resnet20 as _se_resnet20 return _se_resnet20(**kwargs) def se_resnet56(**kwargs): from senet.se_resnet import se_resnet56 as _se_resnet56 return _se_resnet56(**kwargs) def se_resnet50(**kwargs): from senet.se_resnet import se_resnet50 as _se_resnet50 return _se_resnet50(**kwargs) def se_resnet101(**kwargs): from senet.se_resnet import se_resnet101 as _se_resnet101 return _se_resnet101(**kwargs)
235
333
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import settings import subprocess def main(): assert os.path.isfile(settings.PRETRAIN_MODEL), 'please download pretrain model {}'.format(settings.PRETRAIN_MODEL) assert os.path.isfile(os.path.join(settings.CAFFE_ROOT, 'build/tools/caffe')), 'please build caffe' exe = 'python2' script = os.path.join('ssd_hardcode', 'ssd_pascal_512.py') args = [exe, script] env = os.environ.copy() pythonpath = os.path.join(settings.CAFFE_ROOT, 'python') if 'PYTHONPATH' in env: env['PYTHONPATH'] = '{}:{}:{}'.format(env['PYTHONPATH'], '.', pythonpath) else: env['PYTHONPATH'] = '{}:{}'.format('.', pythonpath) print(*args) p = subprocess.Popen(args, env=env) p.wait() assert 0 == p.returncode if __name__ == '__main__': main()
395
1,574
//======================================================================= // Copyright <NAME> 2013-2018. // Distributed under the terms of the MIT License. // (See accompanying file LICENSE or copy at // http://www.opensource.org/licenses/MIT) //======================================================================= #ifndef INITIALIZER_LIST_H #define INITIALIZER_LIST_H #include <types.hpp> namespace std { template <typename T> struct initializer_list { const T* first; size_t _size; constexpr initializer_list(const T* __b, size_t __s) noexcept : first(__b), _size(__s) { // Nothing else to init } public: using value_type = T; using reference = const T&; using const_reference = const T&; using size_type = size_t; using iterator = const T*; using const_iterator = const T*; constexpr initializer_list() noexcept : first(nullptr), _size(0) { // Nothing else to init } constexpr size_t size() const noexcept { return _size; } constexpr const T* begin() const noexcept { return first; } constexpr const T* end() const noexcept { return first + _size; } }; template <typename T> inline constexpr const T* begin(initializer_list<T> list) noexcept { return list.begin(); } template <typename T> inline constexpr const T* end(initializer_list<T> list) noexcept { return list.end(); } } //end of namespace std #endif
531
1,080
<reponame>xtuzy/enaml #------------------------------------------------------------------------------ # Copyright (c) 2013, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. #------------------------------------------------------------------------------ from contextlib import contextmanager from types import FunctionType import bytecode as bc from .code_tracing import inject_tracing, inject_inversion from .expression_engine import HandlerPair from .standard_handlers import ( StandardReadHandler, StandardWriteHandler, StandardTracedReadHandler, StandardInvertedWriteHandler ) def optimize_locals(bytecode): """ Optimize the bytecode for fast locals access. All STORE_NAME opcodes will be replaced with STORE_FAST. Names which are stored and then loaded via LOAD_NAME are rewritten to LOAD_FAST and DELETE_NAME is rewritten to DELETE_FAST. This transformation is performed in-place. Parameters ---------- bytecode : bc.Bytecode Bytecode to modify. """ fast_locals = set() for instr in bytecode: # Filter out SetLineno and Label if not isinstance(instr, bc.Instr): continue if instr.name == "STORE_NAME": fast_locals.add(instr.arg) instr.name = "STORE_FAST" for instr in bytecode: # Filter out SetLineno and Label if not isinstance(instr, bc.Instr): continue i_name, i_arg = instr.name, instr.arg if i_name == "LOAD_NAME" and i_arg in fast_locals: instr.name = "LOAD_FAST" elif i_name == "DELETE_NAME" and i_arg in fast_locals: instr.name = "DELETE_FAST" bytecode.update_flags() def gen_simple(code, f_globals): """ Generate a simple function from a code object. Parameters ---------- code : CodeType The code object created by the Enaml compiler. f_globals : dict The global scope for the returned function. Returns ------- result : FunctionType A new function with optimized local variable access. """ bc_code = bc.Bytecode.from_code(code) optimize_locals(bc_code) bc_code.flags ^= (bc_code.flags & bc.CompilerFlags.NEWLOCALS) new_code = bc_code.to_code() return FunctionType(new_code, f_globals) def gen_tracer(code, f_globals): """ Generate a trace function from a code object. Parameters ---------- code : CodeType The code object created by the Enaml compiler. f_globals : dict The global scope for the returned function. Returns ------- result : FunctionType A new function with optimized local variable access and instrumentation for invoking a code tracer. """ bc_code = bc.Bytecode.from_code(code) optimize_locals(bc_code) bc_code = inject_tracing(bc_code) bc_code.flags ^= (bc_code.flags & bc.CompilerFlags.NEWLOCALS) bc_code.argnames = ['_[tracer]'] + bc_code.argnames bc_code.argcount += 1 new_code = bc_code.to_code() return FunctionType(new_code, f_globals) def gen_inverter(code, f_globals): """ Generate an inverter function from a code object. Parameters ---------- code : CodeType The code object created by the Enaml compiler. f_globals : dict The global scope for the returned function. Returns ------- result : FunctionType A new function with optimized local variable access and instrumentation for inverting the operation. """ bc_code = bc.Bytecode.from_code(code) optimize_locals(bc_code) bc_code = inject_inversion(bc_code) bc_code.flags ^= (bc_code.flags & bc.CompilerFlags.NEWLOCALS) bc_code.argnames = ['_[inverter]', '_[value]'] + bc_code.argnames bc_code.argcount += 2 new_code = bc_code.to_code() return FunctionType(new_code, f_globals) def op_simple(code, scope_key, f_globals): """ The default Enaml operator function for the `=` operator. This operator generates a simple function with optimized local access and hooks it up to a StandardReadHandler. This operator does not support write semantics. Parameters ---------- code : CodeType The code object created by the Enaml compiler. scope_key : object The block scope key created by the Enaml compiler. f_globals : dict The global scope for the for code execution. Returns ------- result : HandlerPair A pair with the reader set to a StandardReadHandler. """ func = gen_simple(code, f_globals) reader = StandardReadHandler(func=func, scope_key=scope_key) return HandlerPair(reader=reader) def op_notify(code, scope_key, f_globals): """ The default Enaml operator function for the `::` operator. This operator generates a simple function with optimized local access and hooks it up to a StandardWriteHandler. This operator does not support read semantics. Parameters ---------- code : CodeType The code object created by the Enaml compiler. scope_key : object The block scope key created by the Enaml compiler. f_globals : dict The global scope for the for code execution. Returns ------- result : HandlerPair A pair with the writer set to a StandardWriteHandler. """ func = gen_simple(code, f_globals) writer = StandardWriteHandler(func=func, scope_key=scope_key) return HandlerPair(writer=writer) def op_subscribe(code, scope_key, f_globals): """ The default Enaml operator function for the `<<` operator. This operator generates a tracer function with optimized local access and hooks it up to a StandardTracedReadHandler. This operator does not support write semantics. Parameters ---------- code : CodeType The code object created by the Enaml compiler. scope_key : object The block scope key created by the Enaml compiler. f_globals : dict The global scope for the for code execution. Returns ------- result : HandlerPair A pair with the reader set to a StandardTracedReadHandler. """ func = gen_tracer(code, f_globals) reader = StandardTracedReadHandler(func=func, scope_key=scope_key) return HandlerPair(reader=reader) def op_update(code, scope_key, f_globals): """ The default Enaml operator function for the `>>` operator. This operator generates a inverter function with optimized local access and hooks it up to a StandardInvertedWriteHandler. This operator does not support read semantics. Parameters ---------- code : CodeType The code object created by the Enaml compiler. scope_key : object The block scope key created by the Enaml compiler. f_globals : dict The global scope for the for code execution. Returns ------- result : HandlerPair A pair with the writer set to a StandardInvertedWriteHandler. """ func = gen_inverter(code, f_globals) writer = StandardInvertedWriteHandler(func=func, scope_key=scope_key) return HandlerPair(writer=writer) def op_delegate(code, scope_key, f_globals): """ The default Enaml operator function for the `:=` operator. This operator combines the '<<' and the '>>' operators into a single operator. It supports both read and write semantics. Parameters ---------- code : CodeType The code object created by the Enaml compiler. scope_key : object The block scope key created by the Enaml compiler. f_globals : dict The global scope for the for code execution. Returns ------- result : HandlerPair A pair with the reader set to a StandardTracedReadHandler and the writer set to a StandardInvertedWriteHandler. """ p1 = op_subscribe(code, scope_key, f_globals) p2 = op_update(code, scope_key, f_globals) return HandlerPair(reader=p1.reader, writer=p2.writer) DEFAULT_OPERATORS = { '=': op_simple, '::': op_notify, '>>': op_update, '<<': op_subscribe, ':=': op_delegate, } #: The internal stack of operators pushed by the operator context. __operator_stack = [] @contextmanager def operator_context(ops, union=False): """ Push operators onto the stack for the duration of the context. Parameters ---------- ops : dict The dictionary of operators to push onto the stack. union : bool, optional Whether or to union the operators with the existing operators on the top of the stack. The default is False. """ if union: new = dict(__get_operators()) new.update(ops) ops = new __operator_stack.append(ops) yield __operator_stack.pop() def __get_default_operators(): """ Set the default operators. This function is for internal use only and may disappear at any time. """ return DEFAULT_OPERATORS def __set_default_operators(ops): """ Set the default operators. This function is for internal use only and may disappear at any time. """ global DEFAULT_OPERATORS DEFAULT_OPERATORS = ops def __get_operators(): """ An internal routine used to get the operators for a given class. Operators resolution is performed in the following order: - The operators on the top of the operators stack. - The default operators via __get_default_operators() This function may disappear at any time. """ if __operator_stack: return __operator_stack[-1] return __get_default_operators()
3,414
1,673
<filename>src/ca65/fragment.h /*****************************************************************************/ /* */ /* fragment.h */ /* */ /* Data fragments for the ca65 crossassembler */ /* */ /* */ /* */ /* (C) 1998-2011, <NAME> */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: <EMAIL> */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ /* arising from the use of this software. */ /* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ /* freely, subject to the following restrictions: */ /* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ /* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ /* be misrepresented as being the original software. */ /* 3. This notice may not be removed or altered from any source */ /* distribution. */ /* */ /*****************************************************************************/ #ifndef FRAGMENT_H #define FRAGMENT_H /* common */ #include "exprdefs.h" #include "coll.h" /* ca65 */ #include "lineinfo.h" /*****************************************************************************/ /* struct Fragment */ /*****************************************************************************/ typedef struct Fragment Fragment; struct Fragment { Fragment* Next; /* Pointer to next fragment in segment */ Fragment* LineList; /* List of fragments for one src line */ Collection LI; /* Line info for this fragment */ unsigned short Len; /* Length for this fragment */ unsigned char Type; /* Fragment type */ union { unsigned char Data[sizeof (ExprNode*)]; /* Literal values */ ExprNode* Expr; /* Expression */ } V; }; /*****************************************************************************/ /* Code */ /*****************************************************************************/ Fragment* NewFragment (unsigned char Type, unsigned short Len); /* Create, initialize and return a new fragment. The fragment will be inserted ** into the current segment. */ /* End of fragment.h */ #endif
2,125
700
/* * Copyright (c) 2012 <NAME> <<EMAIL>> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* $OpenBSD: krl.h,v 1.8 2020/04/03 02:26:56 djm Exp $ */ #ifndef _KRL_H #define _KRL_H /* Functions to manage key revocation lists */ #define KRL_MAGIC "SSHKRL\n\0" #define KRL_FORMAT_VERSION 1 /* KRL section types */ #define KRL_SECTION_CERTIFICATES 1 #define KRL_SECTION_EXPLICIT_KEY 2 #define KRL_SECTION_FINGERPRINT_SHA1 3 #define KRL_SECTION_SIGNATURE 4 #define KRL_SECTION_FINGERPRINT_SHA256 5 /* KRL_SECTION_CERTIFICATES subsection types */ #define KRL_SECTION_CERT_SERIAL_LIST 0x20 #define KRL_SECTION_CERT_SERIAL_RANGE 0x21 #define KRL_SECTION_CERT_SERIAL_BITMAP 0x22 #define KRL_SECTION_CERT_KEY_ID 0x23 struct sshkey; struct sshbuf; struct ssh_krl; struct ssh_krl *ssh_krl_init(void); void ssh_krl_free(struct ssh_krl *krl); void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version); int ssh_krl_set_comment(struct ssh_krl *krl, const char *comment); int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const struct sshkey *ca_key, u_int64_t serial); int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi); int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const struct sshkey *ca_key, const char *key_id); int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const struct sshkey *key); int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const u_char *p, size_t len); int ssh_krl_revoke_key_sha256(struct ssh_krl *krl, const u_char *p, size_t len); int ssh_krl_revoke_key(struct ssh_krl *krl, const struct sshkey *key); int ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf, struct sshkey **sign_keys, u_int nsign_keys); int ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp, const struct sshkey **sign_ca_keys, size_t nsign_ca_keys); int ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key); int ssh_krl_file_contains_key(const char *path, const struct sshkey *key); int krl_dump(struct ssh_krl *krl, FILE *f); #endif /* _KRL_H */
1,068
372
<filename>clients/google-api-services-firebasehosting/v1beta1/1.30.1/com/google/api/services/firebasehosting/v1beta1/model/ServingConfig.java /* * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.firebasehosting.v1beta1.model; /** * The configuration for how incoming requests to a site should be routed and processed before * serving content. The patterns are matched and applied according to a specific [priority * order](/docs/hosting/full-config#hosting_priority_order). * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Firebase Hosting API. For a detailed explanation see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class ServingConfig extends com.google.api.client.json.GenericJson { /** * How to handle well known App Association files. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String appAssociation; /** * Defines whether to drop the file extension from uploaded files. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.Boolean cleanUrls; /** * A list of custom response headers that are added to the content if the request URL path matches * the glob. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<Header> headers; static { // hack to force ProGuard to consider Header used, since otherwise it would be stripped out // see https://github.com/google/google-api-java-client/issues/543 com.google.api.client.util.Data.nullOf(Header.class); } /** * A list of globs that will cause the response to redirect to another location. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<Redirect> redirects; static { // hack to force ProGuard to consider Redirect used, since otherwise it would be stripped out // see https://github.com/google/google-api-java-client/issues/543 com.google.api.client.util.Data.nullOf(Redirect.class); } /** * A list of rewrites that will act as if the service were given the destination URL. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<Rewrite> rewrites; static { // hack to force ProGuard to consider Rewrite used, since otherwise it would be stripped out // see https://github.com/google/google-api-java-client/issues/543 com.google.api.client.util.Data.nullOf(Rewrite.class); } /** * Defines how to handle a trailing slash in the URL path. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String trailingSlashBehavior; /** * How to handle well known App Association files. * @return value or {@code null} for none */ public java.lang.String getAppAssociation() { return appAssociation; } /** * How to handle well known App Association files. * @param appAssociation appAssociation or {@code null} for none */ public ServingConfig setAppAssociation(java.lang.String appAssociation) { this.appAssociation = appAssociation; return this; } /** * Defines whether to drop the file extension from uploaded files. * @return value or {@code null} for none */ public java.lang.Boolean getCleanUrls() { return cleanUrls; } /** * Defines whether to drop the file extension from uploaded files. * @param cleanUrls cleanUrls or {@code null} for none */ public ServingConfig setCleanUrls(java.lang.Boolean cleanUrls) { this.cleanUrls = cleanUrls; return this; } /** * A list of custom response headers that are added to the content if the request URL path matches * the glob. * @return value or {@code null} for none */ public java.util.List<Header> getHeaders() { return headers; } /** * A list of custom response headers that are added to the content if the request URL path matches * the glob. * @param headers headers or {@code null} for none */ public ServingConfig setHeaders(java.util.List<Header> headers) { this.headers = headers; return this; } /** * A list of globs that will cause the response to redirect to another location. * @return value or {@code null} for none */ public java.util.List<Redirect> getRedirects() { return redirects; } /** * A list of globs that will cause the response to redirect to another location. * @param redirects redirects or {@code null} for none */ public ServingConfig setRedirects(java.util.List<Redirect> redirects) { this.redirects = redirects; return this; } /** * A list of rewrites that will act as if the service were given the destination URL. * @return value or {@code null} for none */ public java.util.List<Rewrite> getRewrites() { return rewrites; } /** * A list of rewrites that will act as if the service were given the destination URL. * @param rewrites rewrites or {@code null} for none */ public ServingConfig setRewrites(java.util.List<Rewrite> rewrites) { this.rewrites = rewrites; return this; } /** * Defines how to handle a trailing slash in the URL path. * @return value or {@code null} for none */ public java.lang.String getTrailingSlashBehavior() { return trailingSlashBehavior; } /** * Defines how to handle a trailing slash in the URL path. * @param trailingSlashBehavior trailingSlashBehavior or {@code null} for none */ public ServingConfig setTrailingSlashBehavior(java.lang.String trailingSlashBehavior) { this.trailingSlashBehavior = trailingSlashBehavior; return this; } @Override public ServingConfig set(String fieldName, Object value) { return (ServingConfig) super.set(fieldName, value); } @Override public ServingConfig clone() { return (ServingConfig) super.clone(); } }
2,159
831
/* * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.android.actions; import com.android.ide.common.resources.ValueXmlHelper; import com.android.resources.ResourceFolderType; import com.android.resources.ResourceType; import com.android.tools.adtui.font.FontUtil; import com.android.tools.idea.res.IdeResourcesUtil; import com.android.tools.idea.res.IdeResourceNameValidator; import com.android.tools.idea.ui.TextFieldWithBooleanBoxKt; import com.android.tools.idea.ui.TextFieldWithColorPickerKt; import com.intellij.application.options.ModulesComboBox; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.ValidationInfo; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.components.JBLabel; import com.intellij.util.ui.JBUI; import java.awt.Color; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.Function; import javax.swing.BoxLayout; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import org.jetbrains.android.facet.AndroidFacet; import org.jetbrains.android.util.AndroidUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * Embeddable UI for selecting how to create a new resource value (which XML file and directories to place it). */ public class CreateXmlResourcePanelImpl implements CreateXmlResourcePanel, CreateXmlResourceSubdirPanel.Parent { private JPanel myPanel; private JTextField myNameField; private ModulesComboBox myModuleCombo; private JBLabel myModuleLabel; /** * The panel for the 'value' TextField Component. This container is abstracted since we may wrap {@link #myValueField} in a custom * Component for some resource values. E.g: We use a TextField with a ColorPicker Icon when creating a {@link ResourceType#COLOR} value. */ private JPanel myValueFieldContainer; private JBLabel myValueLabel; private JBLabel myNameLabel; private JComboBox myFileNameCombo; private JBLabel mySourceSetLabel; private JComboBox mySourceSetCombo; private JBLabel myFileNameLabel; private final @Nullable Module myModule; private final @NotNull ResourceType myResourceType; private final @NotNull ResourceFolderType myFolderType; private JPanel myDirectoriesPanel; private JBLabel myDirectoriesLabel; private JTextField myValueField; private CreateXmlResourceSubdirPanel mySubdirPanel; private IdeResourceNameValidator myResourceNameValidator; public CreateXmlResourcePanelImpl(@NotNull Module module, @NotNull ResourceType resourceType, @NotNull ResourceFolderType folderType, @Nullable String resourceName, @Nullable String resourceValue, boolean chooseName, boolean chooseValue, boolean chooseFilename, @Nullable VirtualFile defaultFile, @Nullable VirtualFile contextFile, @NotNull final Function<Module, IdeResourceNameValidator> nameValidatorFactory) { setChangeNameVisible(false); setChangeValueVisible(false); setChangeFileNameVisible(chooseFilename); myFolderType = folderType; if (chooseName) { setChangeNameVisible(true); resourceName = IdeResourcesUtil.prependResourcePrefix(module, resourceName, folderType); } if (!StringUtil.isEmpty(resourceName)) { myNameField.setText(resourceName); } if (resourceType == ResourceType.COLOR) { // For Color values, we want a TextField with a ColorPicker so we wrap the TextField with a custom component. Color defaultColor = IdeResourcesUtil.parseColor(resourceValue); myValueFieldContainer.removeAll(); myValueFieldContainer.add(TextFieldWithColorPickerKt.wrapWithColorPickerIcon(myValueField, defaultColor)); } else if (resourceType == ResourceType.BOOL) { myValueFieldContainer.removeAll(); myValueFieldContainer.add(TextFieldWithBooleanBoxKt.wrapWithBooleanCheckBox(myValueField, Boolean.parseBoolean(resourceValue))); } if (chooseValue) { myValueField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent event) { myValueField.setFont(FontUtil.getFontAbleToDisplay(myValueField.getText(), myValueField.getFont())); } }); setChangeValueVisible(true); if (!StringUtil.isEmpty(resourceValue)) { // Need to escape the string to properly represent it in the JTextField. // E.g: If the string is "foo \n bar" we need to pass "foo \\n bar" to properly see it in the JTextField. String value = (resourceType == ResourceType.STRING) ? ValueXmlHelper.escapeResourceString(resourceValue, false) : resourceValue; myValueField.setText(value); } } myResourceType = resourceType; final Set<Module> modulesSet = new HashSet<>(); modulesSet.add(module); for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(module, true)) { modulesSet.add(depFacet.getModule()); } assert !modulesSet.isEmpty(); myModuleCombo.setModules(modulesSet); myModuleCombo.setSelectedModule(module); if (modulesSet.size() == 1) { // Don't show the module ComboBox when there can only be one option. myModule = module; setChangeModuleVisible(false); } else { // The module will have to be obtained form the ComboBox. myModule = null; } myModuleCombo.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { CreateResourceDialogUtils.updateSourceSetCombo(mySourceSetLabel, mySourceSetCombo, AndroidFacet.getInstance(getModule()), null); } }); ApplicationManager.getApplication().assertReadAccessAllowed(); CreateResourceDialogUtils.updateSourceSetCombo(mySourceSetLabel, mySourceSetCombo, AndroidFacet.getInstance(getModule()), null); if (defaultFile == null) { final String defaultFileName = IdeResourcesUtil.getDefaultResourceFileName(myResourceType); if (defaultFileName != null) { myFileNameCombo.getEditor().setItem(defaultFileName); } } myDirectoriesLabel.setLabelFor(myDirectoriesPanel); mySubdirPanel = new CreateXmlResourceSubdirPanel(module.getProject(), folderType, myDirectoriesPanel, this); myResourceNameValidator = nameValidatorFactory.apply(getModule()); myModuleCombo.addActionListener(e -> { mySubdirPanel.updateDirectories(true, getResourceDirectory()); myResourceNameValidator = nameValidatorFactory.apply(getModule()); }); if (defaultFile != null) { resetFromFile(defaultFile, module.getProject()); } } private void createUIComponents() { myValueField = new JTextField(); // this panel just holds the value field component within the swing form, so we strip any UI from it and use a very simple LayoutManager myValueFieldContainer = new JPanel(); myValueFieldContainer.setFocusable(false); myValueFieldContainer.setLayout(new BoxLayout(myValueFieldContainer, BoxLayout.Y_AXIS)); myValueFieldContainer.setUI(null); myValueFieldContainer.setBorder(JBUI.Borders.empty()); myValueFieldContainer.setOpaque(false); myValueFieldContainer.add(myValueField); } @Override public void resetToDefault() { if (myModule == null) { myModuleCombo.setSelectedModule(getRootModule()); } String defaultFileName = IdeResourcesUtil.getDefaultResourceFileName(myResourceType); if (defaultFileName != null) { myFileNameCombo.getEditor().setItem(defaultFileName); } mySubdirPanel.resetToDefault(); } /** * Finds the root modules of all the modules in the myModuleCombo. */ @NotNull private Module getRootModule() { assert myModule == null; // this method should ONLY be called if myModule == null, otherwise myModule IS the root. ComboBoxModel model = myModuleCombo.getModel(); Module root = null; int moduleDependencyCount = -1; // we go through all the modules, and find the one with the most dependencies. for (int c = 0; c < model.getSize(); c++) { Module otherModule = (Module)model.getElementAt(c); // getAllAndroidDependencies returns all transitive dependencies int otherModuleDependencyCount = AndroidUtils.getAllAndroidDependencies(otherModule, true).size(); if (otherModuleDependencyCount > moduleDependencyCount) { moduleDependencyCount = otherModuleDependencyCount; root = otherModule; } } assert root != null; return root; } @Override public void resetFromFile(@NotNull VirtualFile file, @NotNull Project project) { final Module moduleForFile = ModuleUtilCore.findModuleForFile(file, project); if (moduleForFile == null) { return; } final VirtualFile parent = file.getParent(); if (parent == null) { return; } if (myModule == null) { final Module prev = myModuleCombo.getSelectedModule(); myModuleCombo.setSelectedItem(moduleForFile); if (!moduleForFile.equals(myModuleCombo.getSelectedItem())) { myModuleCombo.setSelectedModule(prev); return; } } else if (!myModule.equals(moduleForFile)) { return; } mySubdirPanel.resetFromFile(parent); myFileNameCombo.getEditor().setItem(file.getName()); myPanel.repaint(); } /** * @see CreateXmlResourceDialog#doValidate() */ @Override public ValidationInfo doValidate() { String resourceName = getResourceName(); String resourceValue = getValue(); Module selectedModule = getModule(); VirtualFile resourceDir = getResourceDirectory(); List<String> directoryNames = getDirNames(); String fileName = getFileName(); if (myNameField.isVisible() && resourceName.isEmpty()) { return new ValidationInfo("specify resource name", myNameField); } else if (myNameField.isVisible() && !IdeResourcesUtil.isCorrectAndroidResourceName(resourceName)) { return new ValidationInfo(resourceName + " is not correct resource name", myNameField); } else if (fileName.isEmpty()) { return new ValidationInfo("specify file name", myFileNameCombo); } else if (selectedModule == null) { return new ValidationInfo("specify module", myModuleCombo); } else if (resourceDir == null) { return new ValidationInfo("specify a module with resources", myModuleCombo); } else if (directoryNames.isEmpty()) { return new ValidationInfo("choose directories", myDirectoriesPanel); } else if (resourceName.equals(IdeResourcesUtil.prependResourcePrefix(myModule, null, myFolderType))) { return new ValidationInfo("specify more than resource prefix", myNameField); } return CreateXmlResourceDialog.checkIfResourceAlreadyExists(selectedModule.getProject(), resourceDir, resourceName, resourceValue, myResourceType, directoryNames, fileName); } @Override @NotNull public IdeResourceNameValidator getResourceNameValidator() { return myResourceNameValidator; } /** * @see CreateXmlResourceDialog#getPreferredFocusedComponent() */ @Override public JComponent getPreferredFocusedComponent() { String name = myNameField.getText(); if (name.isEmpty() || // If the value is already populated, the user probably don't want to change it // (e.g extracting a string resources), so we focus the name field myValueField.isVisible() && !myValueField.getText().isEmpty() || name.equals(IdeResourcesUtil.prependResourcePrefix(myModule, null, myFolderType))) { return myNameField; } else if (myValueField.isVisible()) { return myValueField; } else if (myModuleCombo.isVisible()) { return myModuleCombo; } else { return myFileNameCombo; } } @Override @NotNull public String getResourceName() { return myNameField.getText().trim(); } @Override @NotNull public ResourceType getType() { return myResourceType; } @Override @NotNull public List<String> getDirNames() { return mySubdirPanel.getDirNames(); } @Override @NotNull public String getFileName() { return ((String)myFileNameCombo.getEditor().getItem()).trim(); } @Override @NotNull public String getValue() { String value = myValueField.getText(); // When we need to get the desired value for a string resource, the text has to be unescaped. // E.g: If the user types "foo \n bar" JTextField.getText will return "foo \\n bar" so it has to be unescaped. return (myResourceType == ResourceType.STRING) ? ValueXmlHelper.unescapeResourceString(value, false, false) : value; } @Override @Nullable public Module getModule() { return myModule != null ? myModule : myModuleCombo.getSelectedModule(); } @Override @Nullable public VirtualFile getResourceDirectory() { Module module = getModule(); if (module == null) { return null; } PsiDirectory resDirectory = CreateResourceDialogUtils.getOrCreateResourceDirectory(mySourceSetCombo, module); return resDirectory != null ? resDirectory.getVirtualFile() : null; } @Override public JComponent getPanel() { return myPanel; } private void setChangeFileNameVisible(boolean isVisible) { myFileNameLabel.setVisible(isVisible); myFileNameCombo.setVisible(isVisible); } private void setChangeValueVisible(boolean isVisible) { myValueFieldContainer.setVisible(isVisible); myValueLabel.setVisible(isVisible); } private void setChangeNameVisible(boolean isVisible) { myNameField.setVisible(isVisible); myNameLabel.setVisible(isVisible); } private void setChangeModuleVisible(boolean isVisible) { myModuleLabel.setVisible(isVisible); myModuleCombo.setVisible(isVisible); } // Only public for CreateXmlResourceSubdirPanel.Parent @Override public void updateFilesCombo(List<VirtualFile> directories) { final Object oldItem = myFileNameCombo.getEditor().getItem(); final Set<String> fileNameSet = new HashSet<>(); for (VirtualFile dir : directories) { for (VirtualFile file : dir.getChildren()) { fileNameSet.add(file.getName()); } } final List<String> fileNames = new ArrayList<>(fileNameSet); Collections.sort(fileNames); myFileNameCombo.setModel(new DefaultComboBoxModel(fileNames.toArray())); myFileNameCombo.getEditor().setItem(oldItem); } }
5,631
1,118
<gh_stars>1000+ /* * << Haru Free PDF Library 2.0.0 >> -- make_rawimage.c * * Copyright (c) 1999-2006 <NAME> <<EMAIL>> * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. * It is provided "as is" without express or implied warranty. * */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <setjmp.h> #include "hpdf.h" #ifdef HPDF_USE_PNGLIB jmp_buf env; #ifdef HPDF_DLL void __stdcall #else void #endif error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void *user_data) { printf ("ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no); longjmp(env, 1); } int main (int argc, char **argv) { HPDF_Doc pdf; HPDF_Image image; HPDF_Stream stream; HPDF_UINT iw; HPDF_UINT ih; HPDF_UINT bits_per_comp; const char *cs; if (argc < 2) { printf ("usage: make_rawimage <in-file-name> <out-file-name>\n"); return 1; } pdf = HPDF_New (error_handler, NULL); if (!pdf) { printf ("error: cannot create PdfDoc object\n"); return 1; } /* error-handler */ if (setjmp(env)) { HPDF_Free (pdf); return 1; } /* load image file. */ image = HPDF_LoadPngImageFromFile (pdf, argv[1]); iw = HPDF_Image_GetWidth (image); ih = HPDF_Image_GetHeight (image); bits_per_comp = HPDF_Image_GetBitsPerComponent (image); cs = HPDF_Image_GetColorSpace (image); printf ("width=%u\n", iw); printf ("height=%u\n", ih); printf ("bits_per_comp=%u\n", bits_per_comp); printf ("color_space=%s\n", cs); /* save raw-data to file */ stream = HPDF_FileWriter_New (pdf->mmgr, argv[2]); if (!stream) printf ("cannot open %s\n", argv[2]); else HPDF_Stream_WriteToStream(image->stream, stream, 0, NULL); HPDF_Stream_Free (stream); /* clean up */ HPDF_Free (pdf); return 0; } #else int main() { printf("WARNING: if you want to run this example, \n" "make libhpdf with HPDF_USE_PNGLIB option.\n"); return 0; } #endif
1,047
778
// ______ _____ _ ________ // / ____/___ / ___/(_)___ ___ / _/ __ | // / / / __ \\__ \/ / __ `__ \ / // / / / // / /___/ /_/ /__/ / / / / / / // // /_/ / // \____/\____/____/_/_/ /_/ /_/___/\____/ // Kratos CoSimulationApplication // // License: BSD License, see license.txt // // Main authors: <NAME> (https://github.com/philbucher) // #ifndef CO_SIM_IO_MODEL_PART_H_INCLUDED #define CO_SIM_IO_MODEL_PART_H_INCLUDED /* This file contains the implementation of th CoSimIO::ModelPart It serves as a data container when exchanging data Also it is used in order to be consistent with Kratos to reduce compatibility problems This is a simplified version of Kratos::ModelPart see https://github.com/KratosMultiphysics/Kratos/blob/master/kratos/includes/model_part.h */ // System includes #include <memory> #include <vector> #include <string> #include <functional> #include <algorithm> // Project includes #include "define.hpp" #include "macros.hpp" #include "utilities.hpp" namespace CoSimIO { class Node { public: Node( const IdType I_Id, const double I_X, const double I_Y, const double I_Z) : mId(I_Id), mX(I_X), mY(I_Y), mZ(I_Z) { CO_SIM_IO_ERROR_IF(I_Id < 1) << "Id must be >= 1!" << std::endl; } Node( const IdType I_Id, const CoordinatesType& I_Coordinates) : Node(I_Id, I_Coordinates[0], I_Coordinates[1], I_Coordinates[2]) { } // delete copy and assignment CTor Node(const Node&) = delete; Node& operator=(Node const&) = delete; IdType Id() const { return mId; } double X() const { return mX; } double Y() const { return mY; } double Z() const { return mZ; } CoordinatesType Coordinates() const { return {mX, mY, mZ}; } void Print(std::ostream& rOStream) const { rOStream << "CoSimIO-Node; Id: " << Id() << "\n"; rOStream << " Coordinates: [ " << X() << " | " << Y() << " | " << Z() << " ]" << std::endl; } private: IdType mId; double mX; double mY; double mZ; }; /// output stream function inline std::ostream & operator <<( std::ostream& rOStream, const Node& rThis) { rThis.Print(rOStream); return rOStream; } class Element { public: using NodesContainerType = std::vector<Node*>; Element( const IdType I_Id, const ElementType I_Type, const NodesContainerType& I_Nodes) : mId(I_Id), mType(I_Type), mNodes(I_Nodes) { CO_SIM_IO_ERROR_IF(I_Id < 1) << "Id must be >= 1!" << std::endl; CO_SIM_IO_ERROR_IF(NumberOfNodes() < 1) << "No nodes were passed!" << std::endl; const int num_nodes_elem_type = CoSimIO::Internals::GetNumberOfNodesForElementType(I_Type); CO_SIM_IO_ERROR_IF_NOT(num_nodes_elem_type == static_cast<int>(NumberOfNodes())) << "Number of nodes (" << NumberOfNodes() << ") does not match expected number for element type (" << num_nodes_elem_type << ")!" << std::endl; } // delete copy and assignment CTor Element(const Element&) = delete; Element& operator=(Element const&) = delete; IdType Id() const { return mId; } ElementType Type() const { return mType; } std::size_t NumberOfNodes() const { return mNodes.size(); } NodesContainerType::const_iterator NodesBegin() const { return mNodes.begin(); } NodesContainerType::const_iterator NodesEnd() const { return mNodes.end(); } void Print(std::ostream& rOStream) const { rOStream << "CoSimIO-Element; Id: " << Id() << "\n"; rOStream << " Number of Nodes: " << NumberOfNodes() << "\n"; rOStream << " Node Ids: "; if (NumberOfNodes() > 0) { rOStream << mNodes[0]->Id(); } for (std::size_t i=1; i<NumberOfNodes(); ++i) { rOStream << ", " << mNodes[i]->Id(); } rOStream << std::endl; } private: IdType mId; ElementType mType; NodesContainerType mNodes; }; /// output stream function inline std::ostream & operator <<( std::ostream& rOStream, const Element& rThis) { rThis.Print(rOStream); return rOStream; } class ModelPart { public: using NodePointerType = std::shared_ptr<Node>; // TODO switch to intrusive_ptr using ElementPointerType = std::shared_ptr<Element>; // TODO switch to intrusive_ptr using NodesContainerType = std::vector<NodePointerType>; using ElementsContainerType = std::vector<ElementPointerType>; explicit ModelPart(const std::string& I_Name) : mName(I_Name) { CO_SIM_IO_ERROR_IF(I_Name.empty()) << "Please don't use empty names (\"\") when creating a ModelPart" << std::endl; CO_SIM_IO_ERROR_IF_NOT(I_Name.find(".") == std::string::npos) << "Please don't use names containing (\".\") when creating a ModelPart (used in \"" << I_Name << "\")" << std::endl; } // delete copy and assignment CTor ModelPart(const ModelPart&) = delete; ModelPart& operator=(ModelPart const&) = delete; const std::string& Name() const { return mName; } std::size_t NumberOfNodes() const { return mNodes.size(); } std::size_t NumberOfElements() const { return mElements.size(); } Node& CreateNewNode( const IdType I_Id, const double I_X, const double I_Y, const double I_Z) { CO_SIM_IO_ERROR_IF(HasNode(I_Id)) << "The Node with Id " << I_Id << " exists already!" << std::endl; mNodes.push_back(std::make_shared<Node>(I_Id, I_X, I_Y, I_Z)); return *(mNodes.back()); } Element& CreateNewElement( const IdType I_Id, const ElementType I_Type, const ConnectivitiesType& I_Connectivities) { CO_SIM_IO_ERROR_IF(HasElement(I_Id)) << "The Element with Id " << I_Id << " exists already!" << std::endl; Element::NodesContainerType nodes; nodes.reserve(I_Connectivities.size()); for (const IdType node_id : I_Connectivities) { nodes.push_back(&GetNode(node_id)); } mElements.push_back(std::make_shared<Element>(I_Id, I_Type, nodes)); return *(mElements.back()); } NodesContainerType::const_iterator NodesBegin() const { return mNodes.begin(); } ElementsContainerType::const_iterator ElementsBegin() const { return mElements.begin(); } NodesContainerType::const_iterator NodesEnd() const { return mNodes.end(); } ElementsContainerType::const_iterator ElementsEnd() const { return mElements.end(); } Node& GetNode(const IdType I_Id) { auto it_node = FindNode(I_Id); CO_SIM_IO_ERROR_IF(it_node == mNodes.end()) << "Node with Id " << I_Id << " does not exist!" << std::endl; return **it_node; } const Node& GetNode(const IdType I_Id) const { auto it_node = FindNode(I_Id); CO_SIM_IO_ERROR_IF(it_node == mNodes.end()) << "Node with Id " << I_Id << " does not exist!" << std::endl; return **it_node; } NodePointerType pGetNode(const IdType I_Id) { auto it_node = FindNode(I_Id); CO_SIM_IO_ERROR_IF(it_node == mNodes.end()) << "Node with Id " << I_Id << " does not exist!" << std::endl; return *it_node; } Element& GetElement(const IdType I_Id) { auto it_elem = FindElement(I_Id); CO_SIM_IO_ERROR_IF(it_elem == mElements.end()) << "Element with Id " << I_Id << " does not exist!" << std::endl; return **it_elem; } const Element& GetElement(const IdType I_Id) const { auto it_elem = FindElement(I_Id); CO_SIM_IO_ERROR_IF(it_elem == mElements.end()) << "Element with Id " << I_Id << " does not exist!" << std::endl; return **it_elem; } ElementPointerType pGetElement(const IdType I_Id) { auto it_elem = FindElement(I_Id); CO_SIM_IO_ERROR_IF(it_elem == mElements.end()) << "Element with Id " << I_Id << " does not exist!" << std::endl; return *it_elem; } void Print(std::ostream& rOStream) const { rOStream << "CoSimIO-ModelPart \"" << mName << "\"\n"; rOStream << " Number of Nodes: " << NumberOfNodes() << "\n"; rOStream << " Number of Elements: " << NumberOfElements() << std::endl; } void Clear() { mElements.clear(); mElements.shrink_to_fit(); mNodes.clear(); mNodes.shrink_to_fit(); } private: std::string mName; NodesContainerType mNodes; ElementsContainerType mElements; NodesContainerType::const_iterator FindNode(const IdType I_Id) const { return std::find_if( mNodes.begin(), mNodes.end(), [I_Id](const NodePointerType& rp_node) { return rp_node->Id() == I_Id;}); } NodesContainerType::iterator FindNode(const IdType I_Id) { return std::find_if( mNodes.begin(), mNodes.end(), [I_Id](const NodePointerType& rp_node) { return rp_node->Id() == I_Id;}); } ElementsContainerType::const_iterator FindElement(const IdType I_Id) const { return std::find_if( mElements.begin(), mElements.end(), [I_Id](const ElementPointerType& rp_elem) { return rp_elem->Id() == I_Id;}); } ElementsContainerType::iterator FindElement(const IdType I_Id) { return std::find_if( mElements.begin(), mElements.end(), [I_Id](const ElementPointerType& rp_elem) { return rp_elem->Id() == I_Id;}); } bool HasNode(const IdType I_Id) const { return FindNode(I_Id) != mNodes.end(); } bool HasElement(const IdType I_Id) const { return FindElement(I_Id) != mElements.end(); } }; /// output stream function inline std::ostream & operator <<( std::ostream& rOStream, const ModelPart& rThis) { rThis.Print(rOStream); return rOStream; } } //namespace CoSimIO #endif // CO_SIM_IO_MODEL_PART_H_INCLUDED
4,286
1,056
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.lib.profiler.wireprotocol; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Arrays; /** * * @author <NAME> */ public class GetClassFileBytesCommand extends Command { private String[] classes; private int[] classLoaderIds; public GetClassFileBytesCommand(String[] classes, int[] classLoaderIds) { this(); this.classes = classes; this.classLoaderIds = classLoaderIds; } // Custom serializaion support GetClassFileBytesCommand() { super(GET_CLASS_FILE_BYTES); } public int[] getClassLoaderIds() { return classLoaderIds; } public String[] getClasses() { return classes; } void readObject(ObjectInputStream in) throws IOException { int nClasses = in.readInt(); if (nClasses == 0) { return; } classes = new String[nClasses]; classLoaderIds = new int[nClasses]; for (int i = 0; i < nClasses; i++) { classes[i] = in.readUTF().replace('/', '.'); // NOI18N classLoaderIds[i] = in.readInt(); } } void writeObject(ObjectOutputStream out) throws IOException { if (classes == null) { out.writeInt(0); return; } int nClasses = classes.length; out.writeInt(nClasses); for (int i = 0; i < nClasses; i++) { out.writeUTF(classes[i]); out.writeInt(classLoaderIds[i]); } classes = null; classLoaderIds = null; } public String toString() { return super.toString() + " "+classes.length+" classes(): "+Arrays.toString(classes); // NOI18N } }
973
28,056
package com.alibaba.json.bvt.issue_2800; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.parser.Feature; import junit.framework.TestCase; public class Issue2866 extends TestCase { public void test_for_issue() throws Exception { String json = "{\"A1\":1,\"A2\":2,\"A3\":3}"; A a = JSON.parseObject(json, A.class, Feature.SupportNonPublicField); assertEquals(1, a.a1); assertEquals(2, a.A2); assertEquals(3, a.a3); } static class A{ @JSONField(name="A1") int a1; int A2; @JSONField(name="A3") public int a3; } }
317
1,282
// Copyright (c) 2019, Google Inc. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <openssl/cipher.h> #include <gtest/gtest.h> #include "../../crypto/internal.h" #include "../../crypto/test/test_util.h" struct CastTestCase { uint8_t key[16]; uint8_t plaintext[16]; uint8_t iv[8]; uint8_t ecb_ciphertext[16]; uint8_t cbc_ciphertext[24]; }; static const CastTestCase kTests[] = { // Randomly generated test cases. Checked against vanilla OpenSSL. { {0xbb, 0x56, 0xb1, 0x27, 0x7c, 0x4c, 0xdd, 0x5a, 0x99, 0x90, 0x1e, 0x6f, 0xeb, 0x36, 0x6c, 0xf3}, {0xa6, 0x5b, 0xe0, 0x99, 0xad, 0x5d, 0x91, 0x98, 0x37, 0xc1, 0xa4, 0x7f, 0x01, 0x24, 0x9a, 0x6b}, {0xd5, 0x8a, 0x5c, 0x29, 0xeb, 0xee, 0xed, 0x76}, {0x01, 0x8d, 0x1b, 0x42, 0xb8, 0x77, 0xc8, 0x84, 0x25, 0x7d, 0xd4, 0x89, 0x8d, 0xc1, 0xbc, 0x2a}, {0xc1, 0x05, 0xa1, 0x9a, 0xb4, 0xc4, 0xd0, 0x15, 0x9d, 0xfd, 0xea, 0xd0, 0xc3, 0x54, 0xe5, 0x33, 0x26, 0xac, 0x25, 0xf3, 0x48, 0xbc, 0xf6, 0xa2}, }, { {0x5d, 0x98, 0xa9, 0xd2, 0x27, 0x5d, 0xc8, 0x8c, 0x8c, 0xee, 0x23, 0x7f, 0x8e, 0x2b, 0xd4, 0x8d}, {0x60, 0xec, 0x31, 0xda, 0x25, 0x07, 0x02, 0x14, 0x84, 0x44, 0x96, 0xa6, 0x04, 0x81, 0xca, 0x4e}, {0x96, 0x4c, 0xa4, 0x07, 0xee, 0x1c, 0xd1, 0xfb}, {0x58, 0x62, 0x29, 0x62, 0x23, 0x69, 0x9e, 0xe8, 0x27, 0xc2, 0xcd, 0x5b, 0x35, 0xf1, 0xdf, 0xa4}, {0x1c, 0xd0, 0x29, 0xe5, 0xf3, 0xdb, 0x65, 0x60, 0x05, 0xde, 0x01, 0x2b, 0x10, 0x09, 0x44, 0x56, 0x59, 0x44, 0x00, 0x26, 0xdb, 0xb3, 0x2d, 0x98}, }, }; TEST(CAST, ECB) { unsigned test_num = 0; for (const auto &test : kTests) { test_num++; SCOPED_TRACE(test_num); uint8_t out[sizeof(test.ecb_ciphertext)]; int out_bytes, final_bytes; bssl::ScopedEVP_CIPHER_CTX ctx; ASSERT_TRUE(EVP_EncryptInit_ex(ctx.get(), EVP_cast5_ecb(), nullptr, test.key, nullptr)); ASSERT_TRUE(EVP_CIPHER_CTX_set_padding(ctx.get(), 0 /* no padding */)); ASSERT_TRUE(EVP_EncryptUpdate(ctx.get(), out, &out_bytes, test.plaintext, sizeof(test.plaintext))); ASSERT_TRUE(EVP_EncryptFinal_ex(ctx.get(), out + out_bytes, &final_bytes)); EXPECT_EQ(static_cast<size_t>(out_bytes + final_bytes), sizeof(test.plaintext)); EXPECT_EQ(Bytes(test.ecb_ciphertext), Bytes(out)); bssl::ScopedEVP_CIPHER_CTX decrypt_ctx; ASSERT_TRUE(EVP_DecryptInit_ex(decrypt_ctx.get(), EVP_cast5_ecb(), nullptr, test.key, nullptr)); ASSERT_TRUE( EVP_CIPHER_CTX_set_padding(decrypt_ctx.get(), 0 /* no padding */)); ASSERT_TRUE(EVP_DecryptUpdate(decrypt_ctx.get(), out, &out_bytes, test.ecb_ciphertext, sizeof(test.ecb_ciphertext))); ASSERT_TRUE( EVP_DecryptFinal_ex(decrypt_ctx.get(), out + out_bytes, &final_bytes)); EXPECT_EQ(static_cast<size_t>(out_bytes + final_bytes), sizeof(test.plaintext)); EXPECT_EQ(Bytes(test.plaintext), Bytes(out)); } } TEST(CAST, CBC) { unsigned test_num = 0; for (const auto &test : kTests) { test_num++; SCOPED_TRACE(test_num); uint8_t out[sizeof(test.cbc_ciphertext)]; int out_bytes, final_bytes; bssl::ScopedEVP_CIPHER_CTX ctx; ASSERT_TRUE(EVP_EncryptInit_ex(ctx.get(), EVP_cast5_cbc(), nullptr, test.key, test.iv)); ASSERT_TRUE(EVP_EncryptUpdate(ctx.get(), out, &out_bytes, test.plaintext, sizeof(test.plaintext))); EXPECT_TRUE(EVP_EncryptFinal_ex(ctx.get(), out + out_bytes, &final_bytes)); EXPECT_EQ(static_cast<size_t>(out_bytes + final_bytes), sizeof(test.cbc_ciphertext)); EXPECT_EQ(Bytes(test.cbc_ciphertext), Bytes(out)); bssl::ScopedEVP_CIPHER_CTX decrypt_ctx; ASSERT_TRUE(EVP_DecryptInit_ex(decrypt_ctx.get(), EVP_cast5_cbc(), nullptr, test.key, test.iv)); ASSERT_TRUE(EVP_DecryptUpdate(decrypt_ctx.get(), out, &out_bytes, test.cbc_ciphertext, sizeof(test.cbc_ciphertext))); EXPECT_TRUE( EVP_DecryptFinal_ex(decrypt_ctx.get(), out + out_bytes, &final_bytes)); EXPECT_EQ(static_cast<size_t>(out_bytes + final_bytes), sizeof(test.plaintext)); EXPECT_EQ(Bytes(test.plaintext), Bytes(out, out_bytes + final_bytes)); } }
2,768
390
<gh_stars>100-1000 from sigtools.wrappers import decorator from clize import run @decorator def with_uppercase(wrapped, *args, uppercase=False, **kwargs): """ Formatting options: :param uppercase: Print output in capitals """ ret = wrapped(*args, **kwargs) if uppercase: return str(ret).upper() else: return ret @with_uppercase def hello_world(name=None): """Says hello world :param name: Who to say hello to """ if name is not None: return 'Hello ' + name else: return 'Hello world!' if __name__ == '__main__': run(hello_world)
251
404
PACKAGE_MSG = 'Package Success'
12
762
<filename>tests/misc/test_normalization.py import numpy as np import pytest from pymoo.util.normalization import ZeroToOneNormalization n_var = 10 @pytest.fixture def matrix_input(): xl, xu = np.full(n_var, -5.0), np.full(n_var, 5.0) X = np.random.random((200, n_var)) * (xu - xl) + xl return X, xl, xu @pytest.fixture def vector_input(): xl, xu = np.full(n_var, -5.0), np.full(n_var, 5.0) X = np.random.random(n_var) * (xu - xl) + xl return X, xl, xu def test_zero_to_one(matrix_input): X, xl, xu = matrix_input norm = ZeroToOneNormalization(xl, xu) N = norm.forward(X) _X = norm.backward(N) np.testing.assert_allclose(X, _X) # now let us do just backward norm = ZeroToOneNormalization(xl, xu) _X = norm.backward(N) np.testing.assert_allclose(X, _X) def test_zero_to_one_xl_and_xu_equal(matrix_input): X, xl, xu = matrix_input xl[0] = 15.0 xu[0] = 15.0 X[:, 0] = 15.0 norm = ZeroToOneNormalization(xl, xu) N = norm.forward(X) assert np.all(N[:, 0] == 0.0) _X = norm.backward(N) np.testing.assert_allclose(X, _X) def test_zero_to_one_xl_has_nan(matrix_input): X, xl, xu = matrix_input xl[0] = np.nan xu[0] = np.nan norm = ZeroToOneNormalization(xl, xu) N = norm.forward(X) assert np.all(N[:, 0] == X[:, 0]) _X = norm.backward(N) np.testing.assert_allclose(X, _X) def test_zero_to_one_only_one_dim(vector_input): X, xl, xu = vector_input norm = ZeroToOneNormalization(xl, xu) N = norm.forward(X) _X = norm.backward(N) np.testing.assert_allclose(X, _X) def test_zero_to_one_xl_and_xu_are_none(vector_input): X, xl, xu = vector_input norm = ZeroToOneNormalization(None, None) N = norm.forward(X) _X = norm.backward(N) np.testing.assert_allclose(X, _X) def test_none_as_input(vector_input): X, xl, xu = vector_input norm = ZeroToOneNormalization(xl, xu) N = norm.forward(None) assert N is None def test_only_xl(vector_input): X, xl, _ = vector_input norm = ZeroToOneNormalization(xl, None) N = norm.forward(xl) assert np.all(N == 0.0) np.testing.assert_allclose(X, norm.backward(norm.forward(X))) def test_only_xu(vector_input): X, _, xu = vector_input norm = ZeroToOneNormalization(None, xu) N = norm.forward(xu) assert np.all(N == 1.0) np.testing.assert_allclose(X, norm.backward(norm.forward(X)))
1,154
377
#pragma once //------------------------------------------------------------------------------ /** @class Simple::HttpClient Use a HTTP client to send HTTP requests to a HTTP server, and receive and decode HTTP responses. The HttpClient class is generally blocking. For non-blocking behaviour it's best to wrap the HttpClient into a thread. (C) 2009 Radon Labs GmbH (C) 2013-2020 Individual contributors, see AUTHORS file */ #include "core/config.h" #include "core/refcounted.h" #include "net/tcpclient.h" #include "http/httpstatus.h" #include "http/httpmethod.h" #include "io/uri.h" #include "io/stream.h" //------------------------------------------------------------------------------ namespace Http { class NebulaHttpClient : public Core::RefCounted { __DeclareClass(NebulaHttpClient); public: /// constructor NebulaHttpClient(); /// destructor virtual ~NebulaHttpClient(); /// set the user-agent to use for HTTP requests void SetUserAgent(const Util::String& userAgent); /// get the user-agent const Util::String& GetUserAgent() const; /// establish a connection to a HTTP server bool Connect(const IO::URI& uri); /// disconnect from the server void Disconnect(); /// return true if currently connected bool IsConnected() const; /// send request and write result to provided response content stream HttpStatus::Code SendRequest(HttpMethod::Code requestMethod, const IO::URI& uri, const Ptr<IO::Stream>& responseContentStream); /// send request with body and write result to provided response content stream HttpStatus::Code SendRequest(HttpMethod::Code requestMethod, const IO::URI& uri, const Util::String & body, const Ptr<IO::Stream>& responseContentStream); private: Util::String userAgent; Ptr<Net::TcpClient> tcpClient; }; //------------------------------------------------------------------------------ /** */ inline void NebulaHttpClient::SetUserAgent(const Util::String& agent) { this->userAgent = agent; } //------------------------------------------------------------------------------ /** */ inline const Util::String& NebulaHttpClient::GetUserAgent() const { return this->userAgent; } } // namespace Simple //------------------------------------------------------------------------------
665
382
package com.netflix.spinnaker.clouddriver.deploy; import java.util.List; public class NullOpDeployHandler implements DeployHandler<String> { @Override public DeploymentResult handle(String description, List priorOutputs) { return null; } @Override public boolean handles(DeployDescription description) { return false; } }
100
3,451
# Copyright 2019 Atalaya Tech, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging from typing import TYPE_CHECKING from gunicorn.app.base import Application from simple_di import Provide, inject from bentoml.configuration.containers import BentoMLContainer marshal_logger = logging.getLogger("bentoml.marshal") if TYPE_CHECKING: # make type checkers happy from bentoml.marshal.marshal import MarshalApp class GunicornMarshalServer(Application): # pylint: disable=abstract-method @inject(squeeze_none=True) def __init__( self, *, workers: int = Provide[BentoMLContainer.config.bento_server.microbatch.workers], timeout: int = Provide[BentoMLContainer.config.bento_server.timeout], max_request_size: int = Provide[ BentoMLContainer.config.bento_server.max_request_size ], host: str = Provide[BentoMLContainer.service_host], port: int = Provide[BentoMLContainer.service_port], loglevel: str = Provide[BentoMLContainer.config.bento_server.logging.level], ): self.port = port self.options = { "bind": "%s:%s" % (host, port), "timeout": timeout, "limit_request_line": max_request_size, "loglevel": loglevel.upper(), "worker_class": "aiohttp.worker.GunicornWebWorker", } if workers: self.options['workers'] = workers super().__init__() def load_config(self): self.load_config_from_file("python:bentoml.server.gunicorn_config") # override config with self.options assert self.cfg, "gunicorn config must be loaded" for k, v in self.options.items(): if k.lower() in self.cfg.settings and v is not None: self.cfg.set(k.lower(), v) @property @inject def app(self, app: "MarshalApp" = Provide[BentoMLContainer.proxy_app]): return app def load(self): return self.app.get_app() def run(self): marshal_logger.info("Running micro batch service on :%d", self.port) super().run()
1,008
405
<reponame>zishuimuyu/jeewx package weixin.guanjia.base.entity; import javax.persistence.Entity; import javax.persistence.Table; import org.jeecgframework.core.common.entity.IdEntity; @Entity @Table(name = "weixin_subscribe") public class Subscribe extends IdEntity { private String templateName; private String templateId; private String msgType; private String addTime; private String accountid; public String getAccountid() { return accountid; } public void setAccountid(String accountid) { this.accountid = accountid; } public String getTemplateName() { return templateName; } public void setTemplateName(String templateName) { this.templateName = templateName; } public String getTemplateId() { return templateId; } public void setTemplateId(String templateId) { this.templateId = templateId; } public void setMsgType(String msgType) { this.msgType = msgType; } public String getMsgType() { return msgType; } public String getAddTime() { return addTime; } public void setAddTime(String addTime) { this.addTime = addTime; } }
366
4,200
package com.dtolabs.rundeck.core.authorization; public interface AclRuleSetAuthorization extends Authorization, AclRuleSetSource { }
48
510
package com.diffey.view.rxzhihu.contant; /** * Created by diff on 2016/2/3. */ public class UrlContant { //github public static final String URL_DEV_GITHUB = "https://github.com/Runpop"; //简书 public static final String URL_DEV_JIANSHU = "http://www.jianshu.com/users/e81e0133d845/latest_articles"; }
129
446
package com.ruoyi.file.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import io.minio.MinioClient; /** * Minio 配置信息 * * @author ruoyi */ @Configuration @ConfigurationProperties(prefix = "minio") public class MinioConfig { /** * 服务地址 */ private String url; /** * 用户名 */ private String accessKey; /** * 密码 */ private String secretKey; /** * 存储桶名称 */ private String bucketName; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getAccessKey() { return accessKey; } public void setAccessKey(String accessKey) { this.accessKey = accessKey; } public String getSecretKey() { return secretKey; } public void setSecretKey(String secretKey) { this.secretKey = secretKey; } public String getBucketName() { return bucketName; } public void setBucketName(String bucketName) { this.bucketName = bucketName; } @Bean public MinioClient getMinioClient() { return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); } }
703
1,127
<filename>src/plugins/intel_myriad/common/include/vpu/ngraph/operations/static_shape_reshape.hpp // Copyright (C) 2018-2022 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once #include "ngraph/op/util/attr_types.hpp" #include "ngraph/node.hpp" #include <ngraph/opsets/opset3.hpp> #include <memory> #include <vector> namespace ngraph { namespace vpu { namespace op { class StaticShapeReshape : public ngraph::opset3::Reshape { public: OPENVINO_OP("StaticShapeReshape", "VPUOpset"); StaticShapeReshape(const Output<Node>& arg, const Output<Node>& pattern, bool special_zero); explicit StaticShapeReshape(const std::shared_ptr<ngraph::opset3::Reshape>& reshape); void validate_and_infer_types() override; protected: ngraph::PartialShape m_evaluatedOutputShape; }; } // namespace op } // namespace vpu } // namespace ngraph
316
4,205
<reponame>EMellau/reactor-core<gh_stars>1000+ /* * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package reactor.core.publisher; import java.time.Duration; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.Test; import org.reactivestreams.Subscription; import reactor.core.CoreSubscriber; import reactor.core.Scannable; import reactor.test.StepVerifier; import static org.assertj.core.api.Assertions.assertThat; public class FluxConcatMapNoPrefetchTest extends AbstractFluxConcatMapTest { @Override int implicitPrefetchValue() { return 0; } @Test public void noRequestBeforeOnCompleteWithZeroPrefetch() { AtomicBoolean firstCompleted = new AtomicBoolean(false); Flux .<Integer, Integer>generate(() -> 0, (i, sink) -> { switch (i) { case 0: sink.next(1); return 1; case 1: assertThat(firstCompleted).isTrue(); sink.next(2); return 2; default: sink.complete(); return -1; } }) .concatMap( it -> { switch (it) { case 1: return Mono.delay(Duration.ofMillis(50)) .then(Mono.fromRunnable(() -> { firstCompleted.set(true); })) .thenReturn(it); default: return Mono.just(it); } }, 0 ) .as(StepVerifier::create) .expectNext(1, 2) .expectComplete() .verify(Duration.ofSeconds(5)); assertThat(firstCompleted).isTrue(); } @Test public void scanOperator(){ Flux<Integer> parent = Flux.just(1, 2); FluxConcatMapNoPrefetch<Integer, String> test = new FluxConcatMapNoPrefetch<>(parent, i -> Flux.just(i.toString()) , FluxConcatMap.ErrorMode.END); assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent); assertThat(test.scan(Scannable.Attr.PREFETCH)).isZero(); assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); } @Test public void scanConcatMapNoPrefetchDelayError() { CoreSubscriber<Integer> actual = new LambdaSubscriber<>(null, e -> {}, null, null); FluxConcatMapNoPrefetch.FluxConcatMapNoPrefetchSubscriber<Integer, Integer> test = new FluxConcatMapNoPrefetch.FluxConcatMapNoPrefetchSubscriber<>(actual, Flux::just, FluxConcatMap.ErrorMode.END); Subscription parent = Operators.emptySubscription(); test.onSubscribe(parent); assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent); assertThat(test.scan(Scannable.Attr.PREFETCH)).isZero(); assertThat(test.scan(Scannable.Attr.DELAY_ERROR)).isTrue(); assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual); assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse(); test.onComplete(); assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue(); assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse(); test.cancel(); assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue(); } }
1,457
1,574
<reponame>IchordeDionysos/FirebaseUI-iOS // // Copyright (c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import "FUIIndexArray.h" /** * An internal helper class used by FUIIndexArray to manage all its queries. */ @interface FUIQueryObserver : NSObject NS_ASSUME_NONNULL_BEGIN /// The query observed by this observer. @property (nonatomic, readonly) id<FUIDataObservable> query; /// Populated when the query returns a result. @property (nonatomic, readonly, nullable) FIRDataSnapshot *contents; /** * Initializes a FUIQueryObserver */ - (instancetype)initWithQuery:(id<FUIDataObservable>)query NS_DESIGNATED_INITIALIZER; /** * Creates a query observer and immediately starts observing the query. */ + (FUIQueryObserver *)observerForQuery:(id<FUIDataObservable>)query completion:(void (^_Nullable)(FUIQueryObserver *obs, FIRDataSnapshot *_Nullable, NSError *_Nullable))completion; /** * Removes all the query's observers. The observer cannot be reused after * this method is called. */ - (void)removeAllObservers; NS_ASSUME_NONNULL_END @end
652
2,151
<gh_stars>1000+ // Copyright (C) 2014 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // It is not always desirable to cache libaddressinput data. Sometimes it might // give better performance characteristics to not cache. This implementation of // the Storage interface therefore doesn't actually store anything. #ifndef I18N_ADDRESSINPUT_NULL_STORAGE_H_ #define I18N_ADDRESSINPUT_NULL_STORAGE_H_ #include <libaddressinput/storage.h> #include <string> namespace i18n { namespace addressinput { class NullStorage : public Storage { public: NullStorage(const NullStorage&) = delete; NullStorage& operator=(const NullStorage&) = delete; NullStorage(); ~NullStorage() override; // No-op. void Put(const std::string& key, std::string* data) override; // Always calls the |data_ready| callback function signaling failure. void Get(const std::string& key, const Callback& data_ready) const override; }; } // namespace addressinput } // namespace i18n #endif // I18N_ADDRESSINPUT_NULL_STORAGE_H_
440
2,151
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.am; import android.app.ActivityManager; import android.os.SystemClock; import android.os.UserHandle; import android.util.TimeUtils; /** * Overall information about a uid that has actively running processes. */ public final class UidRecord { final int uid; int curProcState; int setProcState = ActivityManager.PROCESS_STATE_NONEXISTENT; long lastBackgroundTime; boolean idle; int numProcs; static final int CHANGE_PROCSTATE = 0; static final int CHANGE_GONE = 1; static final int CHANGE_GONE_IDLE = 2; static final int CHANGE_IDLE = 3; static final int CHANGE_ACTIVE = 4; static final class ChangeItem { UidRecord uidRecord; int uid; int change; int processState; } ChangeItem pendingChange; public UidRecord(int _uid) { uid = _uid; reset(); } public void reset() { curProcState = ActivityManager.PROCESS_STATE_CACHED_EMPTY; } public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("UidRecord{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(' '); UserHandle.formatUid(sb, uid); sb.append(' '); sb.append(ProcessList.makeProcStateString(curProcState)); if (lastBackgroundTime > 0) { sb.append(" bg:"); TimeUtils.formatDuration(SystemClock.elapsedRealtime()-lastBackgroundTime, sb); } if (idle) { sb.append(" idle"); } sb.append(" procs:"); sb.append(numProcs); sb.append("}"); return sb.toString(); } }
892
311
#pragma once // License: MIT http://opensource.org/licenses/MIT // Author: dustpg mailto:<EMAIL> #include <stdint.h> /// <summary> /// ROM 信息 /// </summary> typedef struct { // PRG-ROM 程序只读储存器 数据指针 uint8_t* data_prgrom; // CHR-ROM 角色只读存储器 数据指针 uint8_t* data_chrrom; // 16KB为单位 程序只读储存器 数据长度 uint32_t count_prgrom16kb; // 8KB为单位 角色只读存储器 数据长度 uint32_t count_chrrom_8kb; // Mapper 编号 uint8_t mapper_number; // 是否Vertical Mirroring(否即为水平) uint8_t vmirroring; // 是否FourScreen uint8_t four_screen; // 是否有SRAM(电池供电的) uint8_t save_ram; // 保留以对齐 uint8_t reserved[4]; } sfc_rom_info_t; /// <summary> /// NES 文件头 /// </summary> typedef struct { // NES^Z uint32_t id; // 16k 程序只读储存器 数量 uint8_t count_prgrom16kb; // 8k 角色只读存储器 数量 uint8_t count_chrrom_8kb; // 控制信息1 uint8_t control1; // 控制信息2 uint8_t control2; // 保留数据 uint8_t reserved[8]; } sfc_nes_header_t; /// <summary> /// ROM control 字节 #1 /// </summary> enum { SFC_NES_VMIRROR = 0x01, SFC_NES_SAVERAM = 0x02, SFC_NES_TRAINER = 0x04, SFC_NES_4SCREEN = 0x08 }; // ROM control byte #2 enum { SFC_NES_VS_UNISYSTEM = 0x01, SFC_NES_Playchoice10 = 0x02 };
896
317
#ifndef _PAW_GET_INVERSE_H_ #define _PAW_GET_INVERSE_H_ /* $Id$ */ extern void paw_get_inverse(double **a, int matrix_size); extern void paw_test_matrix_inverse(); #endif
85
2,671
<gh_stars>1000+ import _sk_fail; _sk_fail._("UserString")
24
496
#include "simit-test.h" #include "path_indices-tests.h" #include "path_expressions-test.h" #include <map> #include <set> #include <iostream> #include "graph.h" #include "path_expressions.h" #include "path_indices.h" using namespace simit; using namespace simit::pe; using namespace std; TEST(pathindex, link) { PathIndexBuilder builder; simit::Set V; simit::Set E(V,V); Box box = createBox(&V, &E, 5, 1, 1); // v-e-v-e-v-e-v-e-v // Test e-v links Var e("e", simit::pe::Set("E")); Var v("v", simit::pe::Set("V")); PathExpression ev = Link::make(e, v, Link::ev); builder.bind("V", &V); builder.bind("E", &E); PathIndex evIndex = builder.buildSegmented(ev, 0); VERIFY_INDEX(evIndex, nbrs({{0,1}, {1,2}, {2,3}, {3,4}})); // Check that EV get's memoized PathExpression ev2 = Link::make(e, v, Link::ev); PathIndex ev2Index = builder.buildSegmented(ev, 0); ASSERT_EQ(evIndex, ev2Index); // Check that different ev get's a different index Var f("f", simit::pe::Set("F")); Var u("u", simit::pe::Set("U")); PathExpression fu = Link::make(f, u, Link::ev); simit::Set U; simit::Set F(V,V); builder.bind("U", &U); builder.bind("F", &F); PathIndex fuIndex = builder.buildSegmented(fu, 0); ASSERT_NE(evIndex, fuIndex); // Test v-e links PathExpression ve = Link::make(v, e, Link::ve); PathIndex veIndex = builder.buildSegmented(ve, 0); VERIFY_INDEX(veIndex, nbrs({{0}, {0,1}, {1,2}, {2,3}, {3}})); // Check that ve get's memoized PathExpression ve2 = Link::make(v, e, Link::ve); PathIndex ve2Index = builder.buildSegmented(ve2, 0); ASSERT_EQ(veIndex, ve2Index); // Check that different VE get's a different index PathExpression uf = Link::make(u,f, Link::ve); PathIndex ufIndex = builder.buildSegmented(uf, 0); ASSERT_NE(veIndex, ufIndex); // Test that ev evaluated backwards gets the same index as ve and vice versa // TODO // Test ve where some variables do not have neighbors Var g("g", simit::pe::Set("G")); PathExpression vg = Link::make(v, g, Link::ve); simit::Set G(V,V); G.add(box(0,0,0), box(4,0,0)); builder.bind("G", &G); PathIndex vgIndex = builder.buildSegmented(vg, 0); VERIFY_INDEX(vgIndex, nbrs({{0}, {}, {}, {}, {0}})); } TEST(pathindex, and) { PathIndexBuilder builder; simit::Set V; simit::Set E(V,V); simit::Set F(V,V); createTestGraph0(&V, &E, &F); // test (ve and ve) PathExpression ve = makeVE(); Var v("v"); Var e("e"); PathExpression veANDve = And::make({v,e}, {}, ve(v,e), ve(e,v)); builder.bind("V", &V); builder.bind("E", &E); PathIndex veANDveIndex = builder.buildSegmented(veANDve, 0); VERIFY_INDEX(veANDveIndex, nbrs({{0}, {0,1}, {1}, {}})); // test (vev and vfv): PathExpression ev = makeEV(); Var vi("vi"); Var vj("vj"); PathExpression vev = And::make({vi,vj}, {{QuantifiedVar::Exist,e}}, ve(vi, e), ev(e, vj)); PathExpression vf = makeVE("v","V", "f","F"); PathExpression fv = makeEV("f","F", "v","V"); builder.bind("F", &F); Var f("f"); PathExpression vfv = And::make({vi,vj}, {{QuantifiedVar::Exist,f}}, vf(vi, f), fv(f, vj)); PathExpression vevANDvfv = And::make({vi,vj}, {}, vev(vi,vj), vfv(vi,vj)); PathIndex vevANDvfvIndex = builder.buildSegmented(vevANDvfv, 0); VERIFY_INDEX(vevANDvfvIndex, nbrs({{0,1}, {0,1}, {2}, {}})); // TODO: Test optimization PathIndex(pe or pe) == PathIndex(pe) } TEST(pathindex, or) { PathIndexBuilder builder; simit::Set V; simit::Set E(V,V); simit::Set F(V,V); createTestGraph0(&V, &E, &F); // test (ve or ve) PathExpression ve = makeVE(); builder.bind("V", &V); builder.bind("E", &E); Var v("v"); Var e("e"); PathExpression veORve = Or::make({v,e}, {}, ve(v,e), ve(e,v)); PathIndex veORveIndex = builder.buildSegmented(veORve, 0); VERIFY_INDEX(veORveIndex, nbrs({{0}, {0,1}, {1}, {}})); // test (vev or vfv): PathExpression ev = makeEV(); ev.bind(E,V); Var vi("vi"); Var vj("vj"); PathExpression vev = And::make({vi,vj}, {{QuantifiedVar::Exist,e}}, ve(vi, e), ev(e, vj)); PathExpression vf = makeVE("v","V", "f","F"); PathExpression fv = makeEV("f","F", "v","V"); builder.bind("F", &F); Var f("f"); PathExpression vfv = And::make({vi,vj}, {{QuantifiedVar::Exist,f}}, vf(vi, f), fv(f, vj)); PathExpression vevORvfv = Or::make({vi,vj}, {}, vev(vi,vj), vfv(vi,vj)); PathIndex vevORvfvIndex = builder.buildSegmented(vevORvfv, 0); VERIFY_INDEX(vevORvfvIndex, nbrs({{0,1,3}, {0,1,2}, {1,2,3}, {0,2,3}})); // TODO: Test optimization PathIndex(pe) == PathIndex(pe or pe) } TEST(pathindex, exist_and) { PathIndexBuilder builder; simit::Set V; simit::Set E(V,V); Box box = createBox(&V, &E, 3, 1, 1); // v-e-v-e-v // Test vev expressions (there exist an e s.t. (vi-e and e-vj)) PathExpression ve = makeVE(); PathExpression ev = makeEV(); builder.bind("V", &V); builder.bind("E", &E); Var vi("vi"); Var e("e"); Var vj("vj"); PathExpression vev = And::make({vi,vj}, {{QuantifiedVar::Exist,e}}, ve(vi, e), ev(e, vj)); PathIndex vevIndex = builder.buildSegmented(vev, 0); VERIFY_INDEX(vevIndex, nbrs({{0,1}, {0,1,2}, {1,2}})); // Check that vev get's memoized PathExpression ve2 = makeVE(); PathExpression ev2 = makeEV(); Var vi2("vi2"); Var ee2("f"); Var vj2("vj2"); PathExpression vev2 = And::make({vi2,vj2}, {{QuantifiedVar::Exist,ee2}}, ve(vi2, ee2), ev(ee2,vj2)); PathIndex vev2Index = builder.buildSegmented(vev2, 0); ASSERT_EQ(vevIndex, vev2Index); // Check that a different vev get's a different index PathExpression uf = makeVE("u","U", "f","F"); PathExpression fu = makeEV("f","F", "u","U"); Var ui("ui"); Var ff("f"); Var uj("uj"); PathExpression ufu = And::make({ui,uj}, {{QuantifiedVar::Exist,ff}}, uf(ui, ff), fu(ff,uj)); simit::Set U; simit::Set F(U,U); builder.bind("U", &U); builder.bind("F", &F); PathIndex ufuIndex = builder.buildSegmented(ufu, 0); ASSERT_NE(vevIndex, ufuIndex); // Check that vev evaluated backwards get's a different index // TODO // Test vevev expression Var vk("vk"); PathExpression vevev = And::make({vi,vj}, {{QuantifiedVar::Exist,vk}}, vev(vi,vk), vev(vk, vj)); PathIndex vevevIndex = builder.buildSegmented(vevev, 0); VERIFY_INDEX(vevevIndex, nbrs({{0,1,2}, {0,1,2}, {0,1,2}})); // Test vevgv expressions: v-e-v-e-v // ---g--- simit::Set G(V,V); G.add(box(0,0,0), box(2,0,0)); Var g("g"); PathExpression vg = makeVE("v","V", "g","G"); PathExpression gv = makeEV("g","G", "v","V"); builder.bind("G", &G); PathExpression vgv = And::make({vi,vj}, {{QuantifiedVar::Exist,g}}, vg(vi, g), gv(g, vj)); PathIndex vgvIndex = builder.buildSegmented(vgv, 0); ASSERT_NE(vev, vgv); ASSERT_TRUE(vev < vgv || vev > vgv); ASSERT_NE(vevIndex, vgvIndex); PathExpression vevgv = And::make({vi,vj}, {{QuantifiedVar::Exist,vk}}, vev(vi,vk), vgv(vk, vj)); PathIndex vevgvIndex = builder.buildSegmented(vevgv, 0); VERIFY_INDEX(vevgvIndex, nbrs({{0,2}, {0,2}, {0,2}})); } TEST(pathindex, exist_or) { PathIndexBuilder builder; simit::Set V; simit::Set E(V,V); simit::Set G(V,V); createTestGraph1(&V, &E, &G); // Test vev expressions (there exist an e s.t. (vi-e and e-vj)) PathExpression ve = makeVE(); PathExpression ev = makeEV(); builder.bind("V", &V); builder.bind("E", &E); Var vi("vi"); Var e("e"); Var vj("vj"); PathExpression vev = Or::make({vi,vj}, {{QuantifiedVar::Exist,e}}, ve(vi, e), ev(e, vj)); PathIndex vevIndex = builder.buildSegmented(vev, 0); VERIFY_INDEX(vevIndex, nbrs({{1,2}, {0,1,2,3,4}, {0,1,2,3,4}, {1,2}, {1,2}})); // Check that vev gets memoized Var vi2("vi2"); Var ee2("e2"); Var vj2("vj2"); PathExpression vev2 = Or::make({vi2,vj2}, {{QuantifiedVar::Exist,ee2}}, ve(vi2,ee2), ev(ee2,vj2)); PathIndex vev2Index = builder.buildSegmented(vev2, 0); ASSERT_EQ(vevIndex, vev2Index); // Check that a different vev get's a different index PathExpression uf = makeVE("u","U", "f","F"); PathExpression fu = makeEV("f","F", "u","U"); Var ui("ui"); Var ff("f"); Var uj("uj"); PathExpression ufu = Or::make({ui,uj}, {{QuantifiedVar::Exist,ff}}, uf(ui, ff), fu(ff,uj)); simit::Set U; simit::Set F(U,U); builder.bind("U", &U); builder.bind("F", &F); PathIndex ufuIndex = builder.buildSegmented(ufu, 0); ASSERT_NE(vevIndex, ufuIndex); // Check that vev evaluated backwards get's a different index // TODO // Test vevev expression Var vk("vk"); PathExpression vevev = Or::make({vi,vj}, {{QuantifiedVar::Exist,vk}}, vev(vi,vk), vev(vk, vj)); PathIndex vevevIndex = builder.buildSegmented(vevev, 0); VERIFY_INDEX(vevevIndex, nbrs({{0,1,2,3,4}, {0,1,2,3,4}, {0,1,2,3,4}, {0,1,2,3,4}, {0,1,2,3,4}})); // Test vevgv expressions: v v-e-v-e-v v-g-v vev = And::make({vi,vj}, {{QuantifiedVar::Exist,e}}, ve(vi, e), ev(e, vj)); Var g("g"); PathExpression vg = makeVE("v","V", "g","G"); PathExpression gv = makeEV("g","G", "v","V"); builder.bind("G", &G); PathExpression vgv = And::make({vi,vj}, {{QuantifiedVar::Exist,g}}, vg(vi, g), gv(g, vj)); PathIndex vgvIndex = builder.buildSegmented(vgv, 0); PathExpression vevgv = Or::make({vi,vj}, {{QuantifiedVar::Exist,vk}}, vev(vi,vk), vgv(vk, vj)); PathIndex vevgvIndex = builder.buildSegmented(vevgv, 0); VERIFY_INDEX(vevgvIndex, nbrs({{3,4}, {0,1,2,3,4}, {0,1,2,3,4}, {3,4}, {3,4}})); } TEST(pathindex, alias) { simit::Set V; simit::Set E(V,V); ElementRef v0 = V.add(); ElementRef v1 = V.add(); E.add(v0,v1); E.add(v1,v0); PathExpression ve = makeVE(); PathExpression ev = makeEV(); Var vi("vi"); Var ee("e"); Var vj("vj"); PathExpression vev = And::make({vi,vj}, {{QuantifiedVar::Exist, ee}}, ve(vi,ee), ev(ee,vj)); PathIndexBuilder builder; builder.bind("V", &V); builder.bind("E", &E); PathIndex index = builder.buildSegmented(vev, 0); VERIFY_INDEX(index, vector<vector<unsigned>>({{0,1}, {0,1}})); } TEST(pathindex, hypergraph) { Var vi("vi"); Var e("e"); Var f("f"); Var vj("vj"); PathExpression ve = makeVE("v","V", "e","E"); PathExpression ev = makeEV("e","E", "v","V"); PathExpression vev = And::make({vi,vj}, {{QuantifiedVar::Exist,e}}, ve(vi, e), ev(e, vj)); PathExpression vf = makeVE("v","V", "f","F"); PathExpression fv = makeEV("f","F", "v","V"); PathExpression vfv = And::make({vi,vj}, {{QuantifiedVar::Exist,f}}, ve(vi, f), ev(f, vj)); simit::Set V; simit::Set E(V,V,V); simit::Set F(V,V,V); ElementRef v0 = V.add(); ElementRef v1 = V.add(); ElementRef v2 = V.add(); ElementRef v3 = V.add(); E.add(v0, v1, v2); E.add(v1, v2, v3); PathIndexBuilder builder; builder.bind("V", &V); builder.bind("E", &E); builder.bind("F", &F); PathExpression vevORvfv = Or::make({vi,vj}, {}, vev(vi,vj), vfv(vi,vj)); PathIndex pidx = builder.buildSegmented(vevORvfv, 0); VERIFY_INDEX(pidx, nbrs({{0,1,2}, {0,1,2,3}, {0,1,2,3}, {1,2,3}})); }
5,538
726
package com.yuyh.sprintnba.widget; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import com.facebook.drawee.drawable.ProgressBarDrawable; public class ImageLoadProgressBar extends ProgressBarDrawable { private float level; private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); private final RectF oval = new RectF(); private int radius = 60; private OnLevelChangeListener listener; public ImageLoadProgressBar() { this(null); } public ImageLoadProgressBar(OnLevelChangeListener listener) { this(listener, Color.GRAY); } public ImageLoadProgressBar(OnLevelChangeListener listener, int color) { this.listener = listener; paint.setColor(color); } @Override protected boolean onLevelChange(int level) { this.level = level; if (listener != null) { listener.onChange(level); } invalidateSelf(); return true; } @Override public void draw(Canvas canvas) { oval.set(canvas.getWidth() / 2 - radius, canvas.getHeight() / 2 - radius, canvas.getWidth() / 2 + radius, canvas.getHeight() / 2 + radius); drawCircle(canvas, level); } private void drawCircle(Canvas canvas, float level) { float angle = level / 10000 * 360f; canvas.drawArc(oval, 270, angle, true, paint); } public interface OnLevelChangeListener { void onChange(int level); } }
588
732
<reponame>eventuate-tram/eventuate-tram<gh_stars>100-1000 package io.eventuate.tram.micronaut.inmemory; import io.eventuate.common.inmemorydatabase.EventuateDatabaseScriptSupplier; import io.eventuate.tram.consumer.common.MessageConsumerImplementation; import io.eventuate.tram.inmemory.InMemoryMessageConsumer; import io.eventuate.tram.inmemory.InMemoryMessageProducer; import io.eventuate.tram.messaging.producer.common.MessageProducerImplementation; import io.micronaut.context.annotation.Factory; import io.micronaut.context.annotation.Primary; import io.micronaut.context.annotation.Requires; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import javax.inject.Named; import javax.inject.Singleton; import javax.sql.DataSource; import java.util.Collections; @Factory public class TramInMemoryFactory { @Singleton public InMemoryMessageConsumer inMemoryMessageConsumer() { return new InMemoryMessageConsumer(); } @Singleton @Primary public MessageConsumerImplementation messageConsumerImplementation(InMemoryMessageConsumer inMemoryMessageConsumer) { return inMemoryMessageConsumer; } @Singleton public InMemoryMessageProducer inMemoryMessageProducer(InMemoryMessageConsumer messageConsumer) { return new InMemoryMessageProducer(messageConsumer, new EventuateMicronautTransactionSynchronizationManager()); } @Singleton @Primary public MessageProducerImplementation messageProducerImplementation(InMemoryMessageProducer inMemoryMessageProducer) { return inMemoryMessageProducer; } @Singleton @Named("TramEventuateDatabaseScriptSupplier") public EventuateDatabaseScriptSupplier eventuateCommonInMemoryScriptSupplierForTram() { return () -> Collections.singletonList("eventuate-tram-embedded-schema.sql"); } @Singleton @Requires(missingBeans = PlatformTransactionManager.class) public PlatformTransactionManager platformTransactionManager(DataSource dataSource) { return new DataSourceTransactionManager(dataSource); } }
589
1,234
package org.benf.cfr.reader.entities.classfilehelpers; import org.benf.cfr.reader.bytecode.analysis.types.ClassSignature; import org.benf.cfr.reader.bytecode.analysis.types.JavaRefTypeInstance; import org.benf.cfr.reader.bytecode.analysis.types.JavaTypeInstance; import org.benf.cfr.reader.entities.*; import org.benf.cfr.reader.state.DCCommonState; import org.benf.cfr.reader.state.TypeUsageCollector; import org.benf.cfr.reader.util.MiscConstants; import org.benf.cfr.reader.util.output.Dumper; import java.util.List; import static org.benf.cfr.reader.util.DecompilerComment.PACKAGE_INFO_CODE; public class ClassFileDumperInterface extends AbstractClassFileDumper { private static final AccessFlag[] dumpableAccessFlagsInterface = new AccessFlag[]{ AccessFlag.ACC_PUBLIC, AccessFlag.ACC_PRIVATE, AccessFlag.ACC_PROTECTED, AccessFlag.ACC_STRICT, AccessFlag.ACC_STATIC, AccessFlag.ACC_FINAL, AccessFlag.ACC_FAKE_SEALED, AccessFlag.ACC_FAKE_NON_SEALED }; public ClassFileDumperInterface(DCCommonState dcCommonState) { super(dcCommonState); } private void dumpHeader(ClassFile c, InnerClassDumpType innerClassDumpType, Dumper d) { d.print(getAccessFlagsString(c.getAccessFlags(), dumpableAccessFlagsInterface)); d.print("interface "); c.dumpClassIdentity(d); d.newln(); ClassSignature signature = c.getClassSignature(); List<JavaTypeInstance> interfaces = signature.getInterfaces(); if (!interfaces.isEmpty()) { d.print("extends "); int size = interfaces.size(); for (int x = 0; x < size; ++x) { JavaTypeInstance iface = interfaces.get(x); d.dump(iface).print((x < (size - 1) ? "," : "")).newln(); } } c.dumpPermitted(d); d.removePendingCarriageReturn().print(" "); } @Override public Dumper dump(ClassFile classFile, InnerClassDumpType innerClass, Dumper d) { // Do this now, as we don't necessarily know if something is a package info until later // than classfiledumper construction. // (we could match on the end of the filename, but that means we might get tricked by OS specific separators). if (isPackageInfo(classFile, d)) { dumpPackageInfo(classFile, d); return d; } if (!innerClass.isInnerClass()) { dumpTopHeader(classFile, d, true); dumpImports(d, classFile); } dumpComments(classFile, d); dumpAnnotations(classFile, d); dumpHeader(classFile, innerClass, d); boolean first = true; d.separator("{").newln(); d.indent(1); // Horrid, but an interface can have fields.... List<ClassFileField> fields = classFile.getFields(); for (ClassFileField field : fields) { field.dump(d, classFile); first = false; } dumpMethods(classFile, d, first, false); classFile.dumpNamedInnerClasses(d); d.indent(-1); d.print("}").newln(); return d; } private boolean isPackageInfo(ClassFile classFile, Dumper d) { JavaRefTypeInstance classType = classFile.getRefClassType(); if (!MiscConstants.PACKAGE_INFO.equals(classType.getRawShortName())) return false; // A package info should have no methods. List<Method> methods = classFile.getMethods(); if (!methods.isEmpty()) { classFile.ensureDecompilerComments().addComment(PACKAGE_INFO_CODE); return false; } if (!classFile.getFields().isEmpty()) { classFile.ensureDecompilerComments().addComment(PACKAGE_INFO_CODE); return false; } return true; } private void dumpPackageInfo(ClassFile classFile, Dumper d) { dumpTopHeader(classFile, d, false); dumpAnnotations(classFile, d); d.packageName(classFile.getRefClassType()); dumpImports(d, classFile); dumpComments(classFile, d); } @Override public void collectTypeUsages(TypeUsageCollector collector) { } }
1,727
334
<reponame>kadel/ocdev { "name": "docusaurus-odo-plugin-segment", "version": "1.0.0", "description": "Docusaurus plugin providing odo specific integration with Segment", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ "segment", "analytics.js", "docusaurus-plugin" ], "author": "<NAME>", "license": "Apache-2.0" }
163
302
<gh_stars>100-1000 import drawBot drawBot.size(200, 200) drawBot.stroke(0, 0, 1) drawBot.strokeWidth(5) drawBot.save() drawBot.fill(1, 0, 0) drawBot.translate(100, 100) drawBot.rect(0, 0, 100, 100) drawBot.restore() drawBot.rect(0, 0, 100, 100) drawBot.save() drawBot.fill(0, 1, 0) drawBot.translate(100, 0) drawBot.rect(0, 0, 100, 100) drawBot.restore() drawBot.rect(0, 100, 100, 100)
172
1,144
<filename>backend/de.metas.manufacturing/src/main/java/org/eevolution/model/validator/DD_Order.java<gh_stars>1000+ package org.eevolution.model.validator; /* * #%L * de.metas.adempiere.libero.libero * %% * Copyright (C) 2015 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ import java.util.List; import org.adempiere.ad.modelvalidator.annotations.DocValidate; import org.adempiere.ad.modelvalidator.annotations.Init; import org.adempiere.ad.modelvalidator.annotations.ModelChange; import org.adempiere.ad.modelvalidator.annotations.Validator; import org.adempiere.model.CopyRecordFactory; import org.adempiere.model.InterfaceWrapperHelper; import org.adempiere.service.ISysConfigBL; import org.compiere.model.ModelValidator; import org.eevolution.api.IDDOrderBL; import org.eevolution.api.IDDOrderDAO; import org.eevolution.model.I_DD_Order; import org.eevolution.model.I_DD_OrderLine; import de.metas.util.Services; @Validator(I_DD_Order.class) public class DD_Order { /** * Task http://dewiki908/mediawiki/index.php/09687_DD_order_Copy_with_details_%28101015490340%29 */ @Init public void init() { CopyRecordFactory.enableForTableName(I_DD_Order.Table_Name); } /** * Sys config used to Disable the Forward/Backward DD Order processing * * Task http://dewiki908/mediawiki/index.php/08059_Trigger_Fertigstellen_for_DD_Orders_%28107323649094%29 */ private static final String SYSCONFIG_DisableProcessForwardAndBackwardDraftDDOrders = "org.eevolution.mrp.spi.impl.DDOrderMRPSupplyProducer.DisableProcessForwardAndBackwardDraftDDOrders"; /** * Before Delete * * @return true of it can be deleted */ @ModelChange(timings = ModelValidator.TYPE_BEFORE_DELETE) public void beforeDelete(final I_DD_Order ddOrder) { if (ddOrder.isProcessed()) { return; } final List<I_DD_OrderLine> ddOrderLines = Services.get(IDDOrderDAO.class).retrieveLines(ddOrder); for (final I_DD_OrderLine ddOrderLine : ddOrderLines) { InterfaceWrapperHelper.delete(ddOrderLine); } } // beforeDelete private boolean isProcessForwardAndBackwaredDDOrdersAutomatically(final I_DD_Order ddOrder) { final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class); final int adClientId = ddOrder.getAD_Client_ID(); final int adOrgId = ddOrder.getAD_Org_ID(); final boolean disabled = sysConfigBL.getBooleanValue(SYSCONFIG_DisableProcessForwardAndBackwardDraftDDOrders, false, // default value adClientId, adOrgId); return !disabled; } /** * If {@link I_DD_Order#COLUMN_MRP_AllowCleanup} is set to <code>false</code> then propagate this flag to forward and backward DD Orders too. * * Task http://dewiki908/mediawiki/index.php/08059_Trigger_Fertigstellen_for_DD_Orders_%28107323649094%29 */ @ModelChange(timings = ModelValidator.TYPE_AFTER_CHANGE, ifColumnsChanged = I_DD_Order.COLUMNNAME_MRP_AllowCleanup) public void propagate_MRPDisallowCleanup(final I_DD_Order ddOrder) { if (!isProcessForwardAndBackwaredDDOrdersAutomatically(ddOrder)) { return; } // // Shall we disallow cleanup on Forward and Backward DD Order? final boolean doDisallowCleanupOnForwardAndBackwardDDOrders = // Flag from this DD Order was set to false !ddOrder.isMRP_AllowCleanup() && InterfaceWrapperHelper.isValueChanged(ddOrder, I_DD_Order.COLUMNNAME_MRP_AllowCleanup) // flag was just changed // There is no point to propagate this flag if the DD Order was already processed // because when a DD Order is completed, this flag is automatically set to false && !ddOrder.isProcessed(); // // If MRP_AllowCleanup flag was just set to false, // Set it to false on Forward and Backward DD Orders, if they are on the same plant (08059) if (doDisallowCleanupOnForwardAndBackwardDDOrders) { final IDDOrderBL ddOrderBL = Services.get(IDDOrderBL.class); ddOrderBL.disallowMRPCleanupOnForwardAndBackwardDDOrders(ddOrder); } } /** * Complete all forward and backward DD Orders (but on the same plant) * * Task http://dewiki908/mediawiki/index.php/08059_Trigger_Fertigstellen_for_DD_Orders_%28107323649094%29 */ @DocValidate(timings = ModelValidator.TIMING_AFTER_COMPLETE) public void completeForwardAndBackwardDDOrders(final I_DD_Order ddOrder) { if (!isProcessForwardAndBackwaredDDOrdersAutomatically(ddOrder)) { return; } final IDDOrderBL ddOrderBL = Services.get(IDDOrderBL.class); ddOrderBL.completeForwardAndBackwardDDOrders(ddOrder); } }
1,794