max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
2,389
<filename>client-java-contrib/cert-manager/src/main/java/io/cert/manager/models/V1alpha2IssuerSpecAcmeDns01Webhook.java /* Copyright 2020 The Kubernetes 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. */ package io.cert.manager.models; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; /** Configure an external webhook based DNS01 challenge solver to manage DNS01 challenge records. */ @ApiModel( description = "Configure an external webhook based DNS01 challenge solver to manage DNS01 challenge records.") @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-08-18T19:55:23.947Z[Etc/UTC]") public class V1alpha2IssuerSpecAcmeDns01Webhook { public static final String SERIALIZED_NAME_CONFIG = "config"; @SerializedName(SERIALIZED_NAME_CONFIG) private Object config; public static final String SERIALIZED_NAME_GROUP_NAME = "groupName"; @SerializedName(SERIALIZED_NAME_GROUP_NAME) private String groupName; public static final String SERIALIZED_NAME_SOLVER_NAME = "solverName"; @SerializedName(SERIALIZED_NAME_SOLVER_NAME) private String solverName; public V1alpha2IssuerSpecAcmeDns01Webhook config(Object config) { this.config = config; return this; } /** * Additional configuration that should be passed to the webhook apiserver when challenges are * processed. This can contain arbitrary JSON data. Secret values should not be specified in this * stanza. If secret values are needed (e.g. credentials for a DNS service), you should use a * SecretKeySelector to reference a Secret resource. For details on the schema of this field, * consult the webhook provider implementation&#39;s documentation. * * @return config */ @javax.annotation.Nullable @ApiModelProperty( value = "Additional configuration that should be passed to the webhook apiserver when challenges are processed. This can contain arbitrary JSON data. Secret values should not be specified in this stanza. If secret values are needed (e.g. credentials for a DNS service), you should use a SecretKeySelector to reference a Secret resource. For details on the schema of this field, consult the webhook provider implementation's documentation.") public Object getConfig() { return config; } public void setConfig(Object config) { this.config = config; } public V1alpha2IssuerSpecAcmeDns01Webhook groupName(String groupName) { this.groupName = groupName; return this; } /** * The API group name that should be used when POSTing ChallengePayload resources to the webhook * apiserver. This should be the same as the GroupName specified in the webhook provider * implementation. * * @return groupName */ @ApiModelProperty( required = true, value = "The API group name that should be used when POSTing ChallengePayload resources to the webhook apiserver. This should be the same as the GroupName specified in the webhook provider implementation.") public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public V1alpha2IssuerSpecAcmeDns01Webhook solverName(String solverName) { this.solverName = solverName; return this; } /** * The name of the solver to use, as defined in the webhook provider implementation. This will * typically be the name of the provider, e.g. &#39;cloudflare&#39;. * * @return solverName */ @ApiModelProperty( required = true, value = "The name of the solver to use, as defined in the webhook provider implementation. This will typically be the name of the provider, e.g. 'cloudflare'.") public String getSolverName() { return solverName; } public void setSolverName(String solverName) { this.solverName = solverName; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } V1alpha2IssuerSpecAcmeDns01Webhook v1alpha2IssuerSpecAcmeDns01Webhook = (V1alpha2IssuerSpecAcmeDns01Webhook) o; return Objects.equals(this.config, v1alpha2IssuerSpecAcmeDns01Webhook.config) && Objects.equals(this.groupName, v1alpha2IssuerSpecAcmeDns01Webhook.groupName) && Objects.equals(this.solverName, v1alpha2IssuerSpecAcmeDns01Webhook.solverName); } @Override public int hashCode() { return Objects.hash(config, groupName, solverName); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class V1alpha2IssuerSpecAcmeDns01Webhook {\n"); sb.append(" config: ").append(toIndentedString(config)).append("\n"); sb.append(" groupName: ").append(toIndentedString(groupName)).append("\n"); sb.append(" solverName: ").append(toIndentedString(solverName)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
1,921
372
/* * 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.sysds.runtime.compress.utils; import java.util.Arrays; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class DoubleCountHashMap { protected static final Log LOG = LogFactory.getLog(DoubleCountHashMap.class.getName()); protected static final int RESIZE_FACTOR = 2; protected static final float LOAD_FACTOR = 0.80f; protected int _size = -1; private Bucket[] _data = null; public DoubleCountHashMap(int init_capacity) { _data = new Bucket[(Util.getPow2(init_capacity)/2) + 7]; // _data = new Bucket[(Util.getPow2(init_capacity)) ]; _size = 0; } public int size() { return _size; } private void appendValue(DCounts ent) { // compute entry index position int ix = hashIndex(ent.key); Bucket l = _data[ix]; if(l == null) _data[ix] = new Bucket(ent); else { while(l != null) l = l.n; Bucket ob = _data[ix]; _data[ix] = new Bucket(ent); _data[ix].n = ob; } _size++; } public final int increment(final double key) { final int ix = hashIndex(key); Bucket l = _data[ix]; while(l != null) { if(l.v.key == key) { l.v.count++; return l.v.id; } else l = l.n; } return addNewBucket(ix, key); } public final int increment(final double key, final int count) { final int ix = hashIndex(key); Bucket l = _data[ix]; while(l != null) { if(l.v.key == key) { l.v.count += count; return l.v.id; } else l = l.n; } return addNewBucket(ix, key); } private int addNewBucket(final int ix, final double key) { Bucket ob = _data[ix]; _data[ix] = new Bucket(new DCounts(key, _size)); _data[ix].n = ob; final int id = _size++; if(_size >= LOAD_FACTOR * _data.length) resize(); return id; } /** * Get the value on a key, if the key is not inside a NullPointerException is thrown. * * @param key the key to lookup * @return count on key */ public int get(double key) { int ix = hashIndex(key); Bucket l = _data[ix]; while(!(l.v.key == key)) l = l.n; return l.v.count; } public int getOrDefault(double key, int def) { int ix = hashIndex(key); Bucket l = _data[ix]; while(l != null && !(l.v.key == key)) l = l.n; if(l == null) return def; return l.v.count; } public DCounts[] extractValues() { DCounts[] ret = new DCounts[_size]; int i = 0; for(Bucket e : _data) { while(e != null) { ret[i++] = e.v; e = e.n; } } return ret; } public void replaceWithUIDs() { int i = 0; for(Bucket e : _data) while(e != null) { e.v.count = i++; e = e.n; } } public void replaceWithUIDsNoZero() { int i = 0; for(Bucket e : _data) { while(e != null) { if(e.v.key != 0) e.v.count = i++; e = e.n; } } } public int[] getUnorderedCountsAndReplaceWithUIDs() { final int[] counts = new int[_size]; int i = 0; for(Bucket e : _data) while(e != null) { counts[i] = e.v.count; e.v.count = i++; e = e.n; } return counts; } public int[] getUnorderedCountsAndReplaceWithUIDsWithout0() { final int[] counts = new int[_size]; int i = 0; for(Bucket e : _data) { while(e != null) { if(e.v.key != 0) { counts[i] = e.v.count; e.v.count = i++; } e = e.n; } } return counts; } public double getMostFrequent(){ double f = 0; int fq = 0; for(Bucket e: _data){ while(e != null){ if(e.v.count > fq){ fq = e.v.count; f = e.v.key; } e = e.n; } } return f; } private void resize() { // check for integer overflow on resize if(_data.length > Integer.MAX_VALUE / RESIZE_FACTOR) return; // resize data array and copy existing contents Bucket[] olddata = _data; _data = new Bucket[_data.length * RESIZE_FACTOR]; _size = 0; // rehash all entries for(Bucket e : olddata) { while(e != null) { appendValue(e.v); e = e.n; } } } public double[] getDictionary() { final double[] ret = new double[_size]; for(Bucket e : _data) while(e != null) { ret[e.v.id] = e.v.key; e = e.n; } return ret; } private final int hashIndex(final double key) { // previous require pow2 size.: // long bits = Double.doubleToRawLongBits(key); // int h =(int)( bits ^ (bits >>> 32)); // h = h ^ (h >>> 20) ^ (h >>> 12); // h = h ^ (h >>> 7) ^ (h >>> 4); // return h & (_data.length - 1); // 100.809.414.955 instructions // Option 1 ... conflict on 1 vs -1 long bits = Double.doubleToLongBits(key); return Math.abs((int)(bits ^ (bits >>> 32)) % _data.length); // 102.356.926.448 instructions // Option 2 // long bits = Double.doubleToRawLongBits(key); // return (int) ((bits ^ (bits >> 32) % _data.length)); // basic double hash code (w/o object creation) // return Double.hashCode(key) % _data.length; // return (int) ((bits ^ (bits >>> 32)) % _data.length); // long bits = Double.doubleToLongBits(key); // return (int) Long.remainderUnsigned(bits, (long) _data.length); // long bits = Double.doubleToLongBits(key); // long bits = Double.doubleToRawLongBits(key); // return (int) (bits % (long) _data.length); // return h; // This function ensures that hashCodes that differ only by // constant multiples at each bit position have a bounded // number of collisions (approximately 8 at default load factor). } // private static int indexFor(int h, int length) { // return h & (length - 1); // } protected static class Bucket { protected DCounts v; protected Bucket n = null; protected Bucket(DCounts v) { this.v = v; } @Override public String toString() { if(n == null) return v.toString(); else return v.toString() + "->" + n.toString(); } } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getClass().getSimpleName() + this.hashCode()); for(int i = 0; i < _data.length; i++) if(_data[i] != null) sb.append(", " + _data[i]); return sb.toString(); } public void reset(int size) { int p2 = Util.getPow2(size); if(_data.length > 2 * p2) _data = new Bucket[p2]; else Arrays.fill(_data, null); _size = 0; } }
2,892
1,444
<gh_stars>1000+ package mage.cards.g; import java.util.UUID; import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.target.common.TargetCreaturePermanent; /** * * @author noxx */ public final class Ghostform extends CardImpl { public Ghostform(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}"); // Up to two target creatures can't be blocked this turn.. this.getSpellAbility().addEffect(new CantBeBlockedTargetEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2)); } private Ghostform(final Ghostform card) { super(card); } @Override public Ghostform copy() { return new Ghostform(this); } }
317
4,538
<reponame>wstong999/AliOS-Things /* * Copyright (C) 2018-2020 Alibaba Group Holding Limited */ #ifndef HAL_FLASH_H_ #define HAL_FLASH_H_ /** * Write data to OTP area on a chip from data buffer in RAM * * @param[in] in_buf Point to the data buffer that stores the data read from flash * @param[in] in_buf_len The length of the buffer * * @return 0 : On success, EIO : If an error occurred with any step */ int32_t hal_flash_write_triples(const void *in_buf, uint32_t in_buf_len); /** * Read data from OTP area on a chip to data buffer in RAM * * @param[in] out_buf Point to the data buffer that stores the data read from flash * @param[in] out_buf_len The length of the buffer * * @return 0 : On success, EIO : If an error occurred with any step */ int32_t hal_flash_read_triples(void *out_buf, uint32_t out_buf_len); /** * Write data to OTP area on a chip from data buffer in RAM * * @param[in] in_buf Point to the data buffer that stores the data read from flash * @param[in] in_buf_len The length of the buffer * * @return 0 : On success, EIO : If an error occurred with any step */ int32_t hal_flash_write_group_addr(const void *in_buf, uint32_t in_buf_len); /** * Read data from OTP area on a chip to data buffer in RAM * * @param[in] out_buf Point to the data buffer that stores the data read from flash * @param[in] out_buf_len The length of the buffer * * @return 0 : On success, EIO : If an error occurred with any step */ int32_t hal_flash_read_group_addr(void *out_buf, uint32_t out_buf_len); int32_t hal_flash_write_xtalcap_params(const void *in_buf, uint32_t in_buf_len); int32_t hal_flash_read_xtalcap_params(void *out_buf, uint32_t out_buf_len); int32_t hal_flash_read_mac_params(void *out_buf, uint32_t out_buf_len); int32_t hal_flash_write_mac_params(const void *in_buf, uint32_t in_buf_len); /** * Write data to OTP area on a chip from data buffer in RAM * * @param[in] in_buf Point to the data buffer that stores the data read from flash * @param[in] in_buf_len The length of the buffer * * @return 0 : On success, EIO : If an error occurred with any step */ int32_t hal_flash_write_sn_params(const void *in_buf, uint32_t in_buf_len); /** * Read data from OTP area on a chip to data buffer in RAM * * @param[in] out_buf Point to the data buffer that stores the data read from flash * @param[in] out_buf_len The length of the buffer * * @return 0 : On success, EIO : If an error occurred with any step */ int32_t hal_flash_read_sn_params(void *out_buf, uint32_t out_buf_len); #endif /* HAL_FLASH_H_ */
947
1,118
<gh_stars>1000+ {"deu":{"common":"Palau","official":"Palau"},"fin":{"common":"Palau","official":"Palaun tasavalta"},"fra":{"common":"Palaos (Palau)","official":"République des Palaos (Palau)"},"hrv":{"common":"Palau","official":"Republika Palau"},"ita":{"common":"Palau","official":"Repubblica di Palau"},"jpn":{"common":"パラオ","official":"パラオ共和国"},"nld":{"common":"Palau","official":"Republiek van Palau"},"por":{"common":"Palau","official":"República de Palau"},"rus":{"common":"Палау","official":"Республика Палау"},"spa":{"common":"Palau","official":"República de Palau"}}
212
4,335
<reponame>github0null/LiteOSv5.0_CMake<filename>arch/arm64/src/mmu.c<gh_stars>1000+ /* ---------------------------------------------------------------------------- * Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. * Description: MMU Config Implementation * Author: Huawei LiteOS Team * Create: 2019-01-01 * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * 2. 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. * 3. Neither the name of the copyright holder 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 "mmu_pri.h" #include "mmu.h" #include "board.h" #include "asm/dma.h" #include "los_base.h" #include "los_hwi.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ #define ALIGNED_4K __attribute__((aligned(MMU_4K))) ALIGNED_4K __attribute__((section(".bss.prebss.translation_table"))) UINT8 g_firstPageTable[FIRST_SECTION_TABLE_LEN]; static ALIGNED_4K UINT8 g_secondPageTableOs[SECOND_PAGE_TABLE_OS_LEN]; static ALIGNED_4K UINT8 g_secondPageTableApp[SECOND_PAGE_TABLE_APP_LEN]; static SENCOND_PAGE g_mmuOsPage = {0}; static SENCOND_PAGE g_mmuAppPage = {0}; #define PGD_ADDR (UINT64)g_firstPageTable #define PMD_ADDR0 (PGD_ADDR + PAGE_SIZE) #define PMD_ADDR1 (PMD_ADDR0 + PAGE_SIZE) #define PMD_ADDR2 (PMD_ADDR1 + PAGE_SIZE) #define ITEM_MASK ((1U << (SHIFT_4K - 3)) - 1) #define PMD_PAGE_GET(addr) (((addr) >> SHIFT_1G) * PAGE_SIZE + PMD_ADDR0) #define PMD_OFFSET_GET(addr) ((((addr) & (MMU_1G - 1)) >> SHIFT_2M) * 8) #define PMD_ADDR_GET(addr) (PMD_PAGE_GET(addr) + PMD_OFFSET_GET(addr)) #define PTE_TABLE_GET(addr) (*(UINT64 *)(PMD_ADDR_GET(addr)) >> SHIFT_4K << SHIFT_4K) #define BYTES_PER_ITEM 8 #define ITEM_TYPE_MASK 0x3 /* Difference of the output-address bit width between each level, 1G / 2M = 2^9, 2M / 4K = 2^9 */ #define ADDR_WIDTH_DIFF 9 typedef struct { UINT64 tbl; UINT64 flags; UINT64 phys; UINT64 start; UINT64 end; UINT64 blockShift; } BlockCB; STATIC INLINE VOID CreatPgdItem(UINT64 tbl, UINT64 pmdTableAddr) { *(UINT64 *)(tbl) = pmdTableAddr | MMU_PTE_L012_DESCRIPTOR_TABLE; } STATIC VOID CreatPmdTable(UINT64 pteTableAddr, UINT64 startAddr, UINT64 endAddr) { UINT64 tbl = PMD_PAGE_GET(startAddr); UINT64 indexStart = startAddr >> SHIFT_2M; UINT64 indexEnd = endAddr >> SHIFT_2M; UINT64 index; indexStart &= ITEM_MASK; indexEnd &= ITEM_MASK; indexEnd += ((endAddr - startAddr) >> SHIFT_1G) << ADDR_WIDTH_DIFF; for (index = indexStart; index <= indexEnd; ++index) { *(UINT64 *)(tbl + (index * BYTES_PER_ITEM)) = pteTableAddr | MMU_PTE_L012_DESCRIPTOR_TABLE; pteTableAddr += PAGE_SIZE; } v8_dma_clean_range(tbl + (indexStart * BYTES_PER_ITEM), tbl + (indexEnd * BYTES_PER_ITEM)); __asm__ __volatile__("tlbi vmalle1"); } STATIC VOID CreatPteTable(const MMU_PARAM *para) { UINT64 indexMax; UINT64 indexTemp; UINT64 phy = (para->startAddr >> SHIFT_4K) << SHIFT_4K; UINT64 offset = (para->startAddr - para->stPage->page_addr) >> SHIFT_4K; UINT64 tbl = para->stPage->page_descriptor_addr; if (para->endAddr <= para->startAddr) { return; } indexMax = (para->endAddr - 1 - para->startAddr) >> SHIFT_4K; phy |= para->uwFlag; for (indexTemp = 0; indexTemp <= indexMax; ++indexTemp, ++offset) { *(UINT64 *)(tbl + (offset * BYTES_PER_ITEM)) = phy | MMU_PTE_L3_DESCRIPTOR_PAGE; phy += PAGE_SIZE; } v8_dma_clean_range(tbl + ((offset - indexTemp) * BYTES_PER_ITEM), tbl + (offset * BYTES_PER_ITEM)); __asm__ __volatile__("tlbi vmalle1"); } STATIC VOID CreatBlockMap(const BlockCB *blockCB) { UINT64 tbl = blockCB->tbl; UINT64 flags = blockCB->flags; UINT64 phys = blockCB->phys; UINT64 start = blockCB->start; UINT64 end = blockCB->end; UINT64 blockShift = blockCB->blockShift; UINT64 offsetGB = (end - start) >> SHIFT_1G; phys = phys >> blockShift; start = start >> blockShift; start &= ITEM_MASK; phys = flags | (phys << blockShift); end = end >> blockShift; end &= ITEM_MASK; end += offsetGB << ADDR_WIDTH_DIFF; while (start <= end) { *(UINT64 *)(tbl + (start * BYTES_PER_ITEM)) = phys; start++; phys += ((UINT64)1UL << blockShift); } } VOID OsBlockMapsInit(UINT64 flags, UINT64 start, UINT64 end) { UINT64 startOffset; UINT64 endOffset; UINT64 pageSize; BlockCB blockCB; if ((start & (MMU_1G - 1)) != 0) { PRINT_ERR("%s, %d, the start of mapping addr is 0x%llx, should be aligned as 1G \n", __FUNCTION__, __LINE__, start); return; } end = ((end + (MMU_1G - 1)) & ~(MMU_1G - 1)); pageSize = (sizeof(g_firstPageTable) >> SHIFT_4K) - 1; startOffset = start >> SHIFT_1G; endOffset = end >> SHIFT_1G; if (endOffset > pageSize) { PRINT_ERR("%s, %d, the end of mapping addr is 0x%llx, should not be bigger than 0x%llx \n", __FUNCTION__, __LINE__, end, pageSize << SHIFT_1G); return; } for (; startOffset < endOffset; ++startOffset) { CreatPgdItem(PGD_ADDR + (startOffset * BYTES_PER_ITEM), PMD_ADDR0 + (startOffset * PAGE_SIZE)); blockCB.tbl = PMD_ADDR0 + (startOffset * PAGE_SIZE); blockCB.flags = flags; blockCB.phys = startOffset << SHIFT_1G; blockCB.start = startOffset << SHIFT_1G; blockCB.end = ((startOffset + 1) << SHIFT_1G) - 1; blockCB.blockShift = SHIFT_2M; CreatBlockMap(&blockCB); } } VOID OsBlockMapsSet(UINT64 flags, UINT64 start, UINT64 end) { UINT64 startOffset; BlockCB blockCB; UINT32 intSave; if ((start & ((1u << SHIFT_2M) - 1)) != 0) { PRINT_ERR("%s, %d, the start of mapping addr is 0x%llx, should be aligned as 2M \n", __FUNCTION__, __LINE__, start); return; } if (start >= end) { PRINT_ERR("%s, %d, input parameters are error: start: 0x%llx, end: 0x%llx\n", __FUNCTION__, __LINE__, start, end); return; } startOffset = start >> SHIFT_1G; intSave = LOS_IntLock(); blockCB.tbl = PMD_ADDR0 + (startOffset * PAGE_SIZE); blockCB.flags = flags; blockCB.phys = start; blockCB.start = start; blockCB.end = end - 1; blockCB.blockShift = SHIFT_2M; CreatBlockMap(&blockCB); LOS_IntRestore(intSave); } STATIC INLINE INT32 OsMMUFlagCheck(UINT64 flag) { switch (flag) { case MMU_PTE_CACHE_RO_FLAGS: case MMU_PTE_CACHE_RW_FLAGS: case MMU_PTE_CACHE_RW_XN_FLAGS: case MMU_PTE_NONCACHE_RO_FLAGS: case MMU_PTE_NONCACHE_RW_FLAGS: case MMU_PTE_NONCACHE_RW_XN_FLAGS: case MMU_INITIAL_MAP_STRONGLY_ORDERED: case MMU_INITIAL_MAP_DEVICE: break; default: PRINT_ERR("illegal mmu flag 0x%llx\n", flag); return LOS_NOK; } return LOS_OK; } VOID ArchMMUParamSet(MMU_PARAM *para) { UINT64 pmdStart, pmdEnd, pmdTmp; UINT32 intSave; if ((para == NULL) || (OsMMUFlagCheck(para->uwFlag) == LOS_NOK)) { PRINT_ERR("para is invalid\n"); return; } if (para->startAddr >= para->endAddr) { PRINT_ERR("wrong addr input para->startAddr[0x%llx] para->endAddr[0x%llx]\n", para->startAddr, para->endAddr); return; } if (para->uwArea == PMD_AREA) { pmdStart = PMD_ADDR_GET(para->startAddr); pmdEnd = PMD_ADDR_GET(para->endAddr); for (pmdTmp = pmdStart; pmdTmp < pmdEnd; pmdTmp += BYTES_PER_ITEM) { if (((*(UINTPTR *)pmdTmp) & ITEM_TYPE_MASK) != MMU_PTE_L012_DESCRIPTOR_BLOCK) { PRINT_ERR("not all mem belongs to pmd section(2M every item), descriptor types:0x%llx\n", ((*(UINTPTR *)pmdTmp) & ITEM_TYPE_MASK)); return; } else { PRINT_DEBUG("pmdTmp = 0x%llx : 0x%llx\n", pmdTmp, *(UINTPTR *)pmdTmp); } } OsBlockMapsSet(para->uwFlag | MMU_PTE_L012_DESCRIPTOR_BLOCK, para->startAddr, para->endAddr); PRINT_DEBUG("pmdStart = 0x%llx : 0x%llx\n", pmdStart, *(UINTPTR *)pmdStart); v8_dma_clean_range(pmdStart, pmdEnd); __asm__ __volatile__("tlbi vmalle1"); return; } if ((para->startAddr & (MMU_4K - 1)) != 0) { PRINT_ERR("para->startAddr[0x%llx] not aligned as 4K\n", para->startAddr); return; } if ((para->endAddr & (MMU_4K - 1)) != 0) { para->endAddr = ALIGN(para->endAddr, MMU_4K); } if ((para->startAddr < para->stPage->page_addr) || (para->endAddr > (para->stPage->page_length + para->stPage->page_addr))) { PRINT_ERR("addr input not belongs to this second page \n" "para->startAddr:0x%llx, para->stPage->page_addr:0x%llx\n", para->startAddr, para->stPage->page_addr); PRINT_ERR("para->endAddr:0x%llx, (para->stPage->page_length + para->stPage->page_addr):0x%llx\n", para->endAddr, para->stPage->page_length + para->stPage->page_addr); return; } intSave = LOS_IntLock(); CreatPteTable(para); LOS_IntRestore(intSave); } #define SECOND_PAGE_TABLE_MAPPING_LEN(table) ((sizeof(table) >> 3) << 12) VOID OsKernelSecPteInit(UINTPTR startAddr, UINTPTR len, UINT64 flag) { g_mmuOsPage.page_addr = startAddr; g_mmuOsPage.page_length = len; g_mmuOsPage.page_descriptor_addr = (UINTPTR)g_secondPageTableOs; if (g_mmuOsPage.page_length > SECOND_PAGE_TABLE_MAPPING_LEN(g_secondPageTableOs)) { PRINT_ERR("the mapping size of os second page is 0x%llx, sholud be not bigger than 0x%llx\n", g_mmuOsPage.page_length, (UINT64)SECOND_PAGE_TABLE_MAPPING_LEN(g_secondPageTableOs)); return; } ArchSecPageEnable(&g_mmuOsPage, flag); } VOID OsAppSecPteInit(UINTPTR startAddr, UINTPTR len, UINT64 flag) { g_mmuAppPage.page_addr = startAddr; g_mmuAppPage.page_length = len; g_mmuAppPage.page_descriptor_addr = (UINTPTR)g_secondPageTableApp; if (g_mmuAppPage.page_length > SECOND_PAGE_TABLE_MAPPING_LEN(g_secondPageTableApp)) { PRINT_ERR("the mapping size of app second page is 0x%llx, sholud be not bigger than 0x%llx\n", g_mmuAppPage.page_length, (UINT64)SECOND_PAGE_TABLE_MAPPING_LEN(g_secondPageTableApp)); return; } ArchSecPageEnable(&g_mmuAppPage, flag); } VOID ArchSecPageEnable(SENCOND_PAGE *page, UINT64 flag) { UINT32 intSave; MMU_PARAM para; if (page == NULL) { PRINT_ERR("second page table(stPage) can't be NULL\n"); return; } if (OsMMUFlagCheck(flag) == LOS_NOK) { return; } para.startAddr = page->page_addr; para.endAddr = page->page_addr + page->page_length; para.uwFlag = flag; para.stPage = page; intSave = LOS_IntLock(); CreatPteTable(&para); CreatPmdTable(page->page_descriptor_addr, page->page_addr, (page->page_addr + page->page_length) - 1); LOS_IntRestore(intSave); } VOID RemapCachedMemAttr(UINTPTR physAddr, size_t size, UINTPTR flag) { MMU_PARAM para; if (physAddr < SYS_MEM_BASE) return; para.startAddr = physAddr; para.endAddr = physAddr + size; para.uwFlag = flag; para.stPage = (SENCOND_PAGE *)&g_mmuAppPage; para.uwArea = PTE_AREA; ArchMMUParamSet(&para); } VOID OsCachedRemap(UINTPTR physAddr, size_t size) { RemapCachedMemAttr(physAddr, size, MMU_PTE_CACHE_RW_XN_FLAGS); } VOID OsNoCachedRemap(UINTPTR physAddr, size_t size) { RemapCachedMemAttr(physAddr, size, MMU_PTE_NONCACHE_RW_XN_FLAGS); } VOID ArchCodeProtect(VOID) { MMU_PARAM para; para.startAddr = (unsigned long)&__text_start; para.endAddr = (unsigned long)&__ram_data_start; para.uwFlag = MMU_PTE_CACHE_RO_FLAGS; para.stPage = (SENCOND_PAGE *)&g_mmuOsPage; para.uwArea = PTE_AREA; PRINTK("para.startAddr = 0x%llx para.endAddr = 0x%llx\n", para.startAddr, para.endAddr); ArchMMUParamSet(&para); } #ifdef __cplusplus #if __cplusplus } #endif #endif
6,161
348
{"nom":"Schwenheim","circ":"7ème circonscription","dpt":"Bas-Rhin","inscrits":610,"abs":359,"votants":251,"blancs":15,"nuls":4,"exp":232,"res":[{"nuance":"LR","nom":"<NAME>","voix":155},{"nuance":"REM","nom":"<NAME>","voix":77}]}
90
16,989
<reponame>jobechoi/bazel<gh_stars>1000+ // Copyright 2017 The Bazel Authors. 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. package com.google.devtools.build.lib.profiler.callcounts; import com.google.common.collect.Interner; import com.google.common.collect.Interners; import com.google.perftools.profiles.ProfileProto.Function; import com.google.perftools.profiles.ProfileProto.Line; import com.google.perftools.profiles.ProfileProto.Location; import com.google.perftools.profiles.ProfileProto.Profile; import com.google.perftools.profiles.ProfileProto.Sample; import com.google.perftools.profiles.ProfileProto.ValueType; import java.io.FileOutputStream; import java.io.IOException; import java.time.Instant; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import java.util.zip.GZIPOutputStream; /** * Developer utility. Add calls to {@link Callcounts#registerCall} in places that you want to count * call occurrences with call stacks. At the end of the command, a pprof-compatible file will be * dumped to the path specified by --call_count_output_path (see also {@link CallcountsModule}). */ public class Callcounts { private static int maxCallstackDepth; // Every Nth call is actually logged private static int samplePeriod; /** * We use some variance to avoid patterns where the same calls get logged over and over. * * <p>Without a little variance, we could end up having call patterns that line up with the sample * period, leading to the same calls getting sampled over and over again. For instance, consider * 90 calls to method A followed by 10 calls to method B, over and over. If our sample period was * 100 then we could end up in a situation where either only method A or (worse) only method B * gets sampled. */ private static int sampleVariance; private static final Random random = new Random(); private static final AtomicLong currentSampleCount = new AtomicLong(); private static final AtomicLong nextSampleCount = new AtomicLong(); private static final Interner<Callstack> callstacks = Interners.newBuilder().weak().concurrencyLevel(8).build(); private static final Map<Callstack, Long> callstackCounts = new ConcurrentHashMap<>(); static class Callstack { final StackTraceElement[] stackTraceElements; Callstack(StackTraceElement[] stackTraceElements) { this.stackTraceElements = stackTraceElements; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Callstack entry = (Callstack) o; return Arrays.equals(stackTraceElements, entry.stackTraceElements); } @Override public int hashCode() { return Arrays.hashCode(stackTraceElements); } } /** Call to register a call trace at the current call location */ public static void registerCall() { // All of this is totally thread-unsafe for speed // The worst that can happen is we occasionally over-sample if (currentSampleCount.incrementAndGet() < nextSampleCount.get()) { return; } long count = 0; synchronized (Callcounts.class) { // Check again if somebody else already got here first // This greatly improves performance compared to eager locking if (currentSampleCount.get() < nextSampleCount.get()) { return; } count = currentSampleCount.get(); resetSampleTarget(); } StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); int skip = 2; // Otherwise we show up ourselves int len = Math.min(stackTrace.length - skip, maxCallstackDepth); if (len <= 0) { return; } StackTraceElement[] entries = new StackTraceElement[len]; for (int i = 0; i < len; ++i) { entries[i] = stackTrace[i + skip]; } Callstack callstack = new Callstack(entries); callstack = callstacks.intern(callstack); callstackCounts.put(callstack, callstackCounts.getOrDefault(callstack, 0L) + count); } static void resetSampleTarget() { currentSampleCount.set(0); nextSampleCount.set( samplePeriod + (sampleVariance > 0 ? random.nextInt(sampleVariance * 2) - sampleVariance : 0)); } static void init(int samplePeriod, int sampleVariance, int maxCallstackDepth) { Callcounts.samplePeriod = samplePeriod; Callcounts.sampleVariance = sampleVariance; Callcounts.maxCallstackDepth = maxCallstackDepth; resetSampleTarget(); } static void reset() { callstackCounts.clear(); } static void dump(String path) throws IOException { Profile profile = createProfile(); try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(new FileOutputStream(path))) { profile.writeTo(gzipOutputStream); } } static Profile createProfile() { Profile.Builder profile = Profile.newBuilder(); StringTable stringTable = new StringTable(profile); profile.addSampleType( ValueType.newBuilder() .setType(stringTable.get("calls")) .setUnit(stringTable.get("count")) .build()); FunctionTable functionTable = new FunctionTable(profile, stringTable); LocationTable locationTable = new LocationTable(profile, functionTable); for (Map.Entry<Callstack, Long> entry : callstackCounts.entrySet()) { Sample.Builder sample = Sample.newBuilder(); sample.addValue(entry.getValue()); for (StackTraceElement stackTraceElement : entry.getKey().stackTraceElements) { String name = stackTraceElement.getClassName() + "." + stackTraceElement.getMethodName(); int line = stackTraceElement.getLineNumber(); sample.addLocationId(locationTable.get(name, line)); } profile.addSample(sample); } Instant instant = Instant.now(); profile.setTimeNanos(instant.getEpochSecond() * 1_000_000_000); return profile.build(); } private static class StringTable { final Profile.Builder profile; final Map<String, Long> table = new HashMap<>(); long index = 0; StringTable(Profile.Builder profile) { this.profile = profile; get(""); // 0 is reserved for the empty string } long get(String str) { return table.computeIfAbsent( str, key -> { profile.addStringTable(key); return index++; }); } } private static class FunctionTable { final Profile.Builder profile; final StringTable stringTable; final Map<String, Long> table = new HashMap<>(); long index = 1; // 0 is reserved FunctionTable(Profile.Builder profile, StringTable stringTable) { this.profile = profile; this.stringTable = stringTable; } long get(String function) { return table.computeIfAbsent( function, key -> { Function fn = Function.newBuilder().setId(index).setName(stringTable.get(function)).build(); profile.addFunction(fn); return index++; }); } } private static class LocationTable { final Profile.Builder profile; final FunctionTable functionTable; final Map<String, Long> table = new HashMap<>(); long index = 1; // 0 is reserved LocationTable(Profile.Builder profile, FunctionTable functionTable) { this.profile = profile; this.functionTable = functionTable; } long get(String function, long line) { return table.computeIfAbsent( function + "#" + line, key -> { Location location = Location.newBuilder() .setId(index) .addLine( Line.newBuilder() .setFunctionId(functionTable.get(function)) .setLine(line) .build()) .build(); profile.addLocation(location); return index++; }); } } }
3,076
501
#!/usr/bin/env python # # Author: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # ''' An example of higher moment self-consistency in renormalization of self-energy in AGF2. Note that only the default AGF2 is efficiently implemented (corresponding to AGF2(1,0) in the literature, and equivalent to AGF2(None,0)). Higher moments do not support density-fitting or parallelism. Default AGF2 corresponds to the AGF2(1,0) method outlined in the papers: - <NAME>, <NAME> and <NAME>, J. Chem. Theory Comput., 16, 1090 (2020). - <NAME> and <NAME>, J. Chem. Theory Comput., 16, 6294 (2020). ''' from __future__ import print_function from pyscf import gto, scf, agf2, mp mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='6-31g') mf = scf.RHF(mol) mf.conv_tol = 1e-12 mf.run() # Get the canonical MP2 mp2 = mp.MP2(mf) mp2.run() # We can use very high moment calculations to converge to traditional GF2 limit. # We can also use the zeroth iteration to quantify the AGF2 error by comparison # to the MP2 energy. gf2_56 = agf2.AGF2(mf, nmom=(5,6)) gf2_56.build_se() e_mp2 = gf2_56.energy_mp2() print('Canonical MP2 Ecorr: ', mp2.e_corr) print('AGF2(%s,%s) MP2 Ecorr: '%gf2_56.nmom, e_mp2) print('Error: ', abs(mp2.e_corr - e_mp2)) # Run a high moment AGF2(5,6) calculation and compare to AGF2 (AGF2 as # default in pyscf is technically AGF2(None,0)). See # second reference for more details. gf2_56.run() gf2 = agf2.AGF2(mf) gf2.run() print('E(corr):') print('AGF2(%s,%s): '%gf2_56.nmom, gf2_56.e_corr) print('AGF2(1,0): ', gf2.e_corr) print('IP:') print('AGF2(%s,%s): '%gf2_56.nmom, gf2_56.ipagf2(nroots=1)[0]) print('AGF2(1,0): ', gf2.ipagf2(nroots=1)[0])
727
1,671
<filename>ambry-rest/src/test/java/com/github/ambry/rest/MockPublicAccessLogger.java /** * Copyright 2016 LinkedIn Corp. 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. */ package com.github.ambry.rest; public class MockPublicAccessLogger extends PublicAccessLogger { private StringBuilder publicAccessLogger = new StringBuilder(); private String lastPublicAccessLogEntry = new String(); public MockPublicAccessLogger(String[] requestHeaders, String[] responseHeaders) { super(requestHeaders, responseHeaders); } @Override public void logError(String message) { lastPublicAccessLogEntry = "Error:" + message; publicAccessLogger.append(lastPublicAccessLogEntry); } @Override public void logInfo(String message) { lastPublicAccessLogEntry = "Info:" + message; publicAccessLogger.append(lastPublicAccessLogEntry); } public String getLastPublicAccessLogEntry() { return lastPublicAccessLogEntry; } }
388
482
import logging from datetime import datetime, timedelta from ipaddress import ip_address from typing import Dict, Iterable, Optional, TypeVar from blacksheep import URL, Cookie client_logger = logging.getLogger("blacksheep.client") class InvalidCookie(Exception): def __init__(self, message): super().__init__(message) class InvalidCookieDomain(InvalidCookie): def __init__(self): super().__init__("Invalid domain attribute") class MissingSchemeInURL(ValueError): def __init__(self): super().__init__("An URL with scheme is required.") def not_ip_address(value: str): try: ip_address(value) except ValueError: return True return False class StoredCookie: __slots__ = ("cookie", "persistent", "creation_time", "expiry_time") def __init__(self, cookie: Cookie): # https://tools.ietf.org/html/rfc6265#section-5.3 self.cookie = cookie self.creation_time = datetime.utcnow() expiry = None if cookie.max_age > -1: # https://tools.ietf.org/html/rfc6265#section-5.2.2 # note: cookie.max_age here is ensured to be int because this is ensured # in the Cookie class max_age = int(cookie.max_age) if max_age <= 0: expiry = datetime.min else: expiry = self.creation_time + timedelta(seconds=max_age) elif cookie.expires: expiry = cookie.expires self.expiry_time = expiry self.persistent = True if expiry else False @property def name(self): return self.cookie.name def is_expired(self) -> bool: expiration = self.expiry_time if expiration and expiration < datetime.utcnow(): return True # NB: it's a 'session cookie'; in other words # it expires when the session is closed return False # cookies are stored by host name, path, and name StoredCookieContainer = Dict[str, Dict[str, Dict[str, StoredCookie]]] T = TypeVar("T") class CookieJar: def __init__(self): # cookies with specific domain self._domain_cookies: StoredCookieContainer = {} # cookies without specific domain self._host_only_cookies: StoredCookieContainer = {} @staticmethod def _get_url_host(request_url: URL) -> str: assert request_url.host is not None return request_url.host.lower().decode() @staticmethod def _get_url_path(request_url: URL) -> str: if request_url.path: return request_url.path.lower().decode() return "/" def get_domain(self, request_url: URL, cookie: Cookie) -> str: # https://tools.ietf.org/html/rfc6265#section-4.1.2.3 request_domain = self._get_url_host(request_url) if not cookie.domain: return request_domain cookie_domain = cookie.domain.lstrip(".").lower() if not not_ip_address(cookie_domain): # ignore return request_domain if cookie_domain.endswith("."): # ignore the domain attribute; return request_domain if not request_domain.endswith(cookie_domain): client_logger.warning( f"A response for {request_url.value} tried to set " f"a cookie with domain {cookie_domain}; this could " f"be a malicious action." ) raise InvalidCookieDomain() return cookie_domain @staticmethod def get_path(request_url: URL, cookie: Cookie) -> str: if cookie.path: return cookie.path.lower() return CookieJar.get_cookie_default_path(request_url) @staticmethod def get_cookie_default_path(request_url: URL) -> str: # https://tools.ietf.org/html/rfc6265#section-5.1.4 uri_path = request_url.path if not uri_path or not uri_path.startswith(b"/") or uri_path.count(b"/") == 1: return "/" return uri_path[0 : uri_path.rfind(b"/")].decode() @staticmethod def domain_match(domain: str, value: str) -> bool: # https://tools.ietf.org/html/rfc6265#section-5.1.3 lower_domain = domain.lower() lower_value = value.lower() if value.count(".") == 0: return False if lower_domain == lower_value: return True if lower_value.endswith(lower_domain): return lower_value[-len(lower_domain) - 1] == "." and not_ip_address( lower_value ) return False @staticmethod def path_match(request_path: str, cookie_path: str) -> bool: # https://tools.ietf.org/html/rfc6265#section-5.1.4 lower_request_path = request_path.lower() lower_cookie_path = cookie_path.lower() if lower_request_path == lower_cookie_path: return True if ( lower_request_path.startswith(lower_cookie_path) and lower_cookie_path[-1] == "/" ): return True if ( lower_request_path.startswith(lower_cookie_path) and lower_request_path[len(lower_cookie_path)] == "/" ): return True return False def get_cookies_for_url(self, url: URL) -> Iterable[Cookie]: if url.schema is None: raise MissingSchemeInURL() return self.get_cookies( url.schema.decode(), self._get_url_host(url), self._get_url_path(url) ) def _get_cookies_by_path( self, schema: str, path: str, cookies_by_path: Dict[str, Dict[str, StoredCookie]], ) -> Iterable[Cookie]: for cookie_path, cookies in cookies_by_path.items(): if CookieJar.path_match(path, cookie_path): for cookie in self._get_cookies_checking_exp(schema, cookies): yield cookie.clone() @staticmethod def _get_cookies_checking_exp( schema: str, cookies: Dict[str, StoredCookie] ) -> Iterable[Cookie]: for cookie_name, stored_cookie in cookies.copy().items(): if stored_cookie.is_expired(): del cookies[cookie_name] continue cookie = stored_cookie.cookie if cookie.secure and schema != "https": # skip cookie for this request continue yield cookie def get_cookies(self, schema: str, domain: str, path: str) -> Iterable[Cookie]: for cookies_domain, cookies_by_path in self._host_only_cookies.items(): if cookies_domain == domain: yield from self._get_cookies_by_path(schema, path, cookies_by_path) for cookies_domain, cookies_by_path in self._domain_cookies.items(): if CookieJar.domain_match(cookies_domain, domain): yield from self._get_cookies_by_path(schema, path, cookies_by_path) @staticmethod def _ensure_dict_container( container: Dict[str, Dict[str, T]], key: str ) -> Dict[str, T]: try: return container[key] except KeyError: new_container = {} container[key] = new_container return new_container def _set_ensuring_container( self, root_container: dict, domain: str, path: str, stored_cookie: StoredCookie, ) -> None: domain_container = self._ensure_dict_container(root_container, domain) path_container = self._ensure_dict_container(domain_container, path) domain_container[path] = path_container path_container[stored_cookie.name.lower()] = stored_cookie @staticmethod def _get( container: dict, domain: str, path: str, cookie_name: str ) -> Optional[StoredCookie]: try: return container[domain][path][cookie_name] except KeyError: return None @staticmethod def _remove(container: dict, domain: str, path: str, cookie_name: str) -> bool: try: del container[domain][path][cookie_name] except KeyError: return False return True def get(self, domain: str, path: str, cookie_name: str) -> Optional[StoredCookie]: return self._get( self._host_only_cookies, domain, path, cookie_name ) or self._get(self._domain_cookies, domain, path, cookie_name) def remove(self, domain: str, path: str, cookie_name: str) -> bool: return self._remove( self._host_only_cookies, domain, path, cookie_name ) or self._remove(self._domain_cookies, domain, path, cookie_name) def add(self, request_url: URL, cookie: Cookie) -> None: domain = self.get_domain(request_url, cookie) path = self.get_path(request_url, cookie) cookie_name = cookie.name.lower() stored_cookie = StoredCookie(cookie) if cookie.domain: container = self._domain_cookies else: container = self._host_only_cookies # handle existing cookie # https://tools.ietf.org/html/rfc6265#page-23 existing_cookie = self.get(domain, path, cookie_name) if existing_cookie: if existing_cookie.cookie.http_only and not cookie.http_only: # ignore return stored_cookie.creation_time = existing_cookie.creation_time if stored_cookie.is_expired(): # remove existing cookie with the same name; if applicable; if existing_cookie: self.remove(domain, path, cookie_name) return self._set_ensuring_container(container, domain, path, stored_cookie) async def cookies_middleware(request, next_handler): cookie_jar = request.context.cookies for cookie in cookie_jar.get_cookies_for_url(request.url): request.set_cookie(cookie.name, cookie.value) response = await next_handler(request) if b"set-cookie" in response.headers: for cookie in response.cookies.values(): try: cookie_jar.add(request.url, cookie) except InvalidCookie as invalid_cookie_error: client_logger.debug( f"Rejected cookie for {request.url}; " f"the cookie is invalid: " f"{str(invalid_cookie_error)}" ) return response
4,641
2,209
<gh_stars>1000+ #!/usr/bin/env python2 """ word_freq.py """ from __future__ import print_function import sys def main(argv): try: iters = int(argv[1]) except IndexError: iters = 1000 text = sys.stdin.read() words = {} for i in xrange(iters): for word in text.split(): if word in words: words[word] += 1 else: words[word] = 1 for word in words: print("%d %s" % (words[word], word)) if __name__ == '__main__': try: main(sys.argv) except RuntimeError as e: print('FATAL: %s' % e, file=sys.stderr) sys.exit(1)
262
385
<reponame>lydGit/StockChart-MPAndroidChart package com.android.stockapp.ui.mpchartexample.notimportant; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import androidx.annotation.NonNull; import com.android.stockapp.R; import java.util.List; /** * Created by <NAME> on 07/12/15. */ class MyAdapter extends ArrayAdapter<ContentItem> { private final Typeface mTypeFaceLight; private final Typeface mTypeFaceRegular; MyAdapter(Context context, List<ContentItem> objects) { super(context, 0, objects); mTypeFaceLight = Typeface.createFromAsset(context.getAssets(), "OpenSans-Light.ttf"); mTypeFaceRegular = Typeface.createFromAsset(context.getAssets(), "OpenSans-Regular.ttf"); } @SuppressLint("InflateParams") @NonNull @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { ContentItem c = getItem(position); ViewHolder holder; holder = new ViewHolder(); if (c != null && c.isSection) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_section, null); } else { convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, null); } holder.tvName = convertView.findViewById(R.id.tvName); holder.tvDesc = convertView.findViewById(R.id.tvDesc); convertView.setTag(holder); if (c != null && c.isSection) holder.tvName.setTypeface(mTypeFaceRegular); else holder.tvName.setTypeface(mTypeFaceLight); holder.tvDesc.setTypeface(mTypeFaceLight); holder.tvName.setText(c != null ? c.name : null); holder.tvDesc.setText(c != null ? c.desc : null); return convertView; } private class ViewHolder { TextView tvName, tvDesc; } }
807
427
//===-- StreamFile.h --------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_StreamFile_h_ #define liblldb_StreamFile_h_ // C Includes // C++ Includes #include <string> // Other libraries and framework includes // Project includes #include "lldb/Core/Stream.h" #include "lldb/Host/File.h" namespace lldb_private { class StreamFile : public Stream { public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ StreamFile(); StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order); StreamFile(int fd, bool transfer_ownership); StreamFile(const char *path); StreamFile(const char *path, uint32_t options, uint32_t permissions = lldb::eFilePermissionsFileDefault); StreamFile(FILE *fh, bool transfer_ownership); ~StreamFile() override; File &GetFile() { return m_file; } const File &GetFile() const { return m_file; } void Flush() override; size_t Write(const void *s, size_t length) override; protected: //------------------------------------------------------------------ // Classes that inherit from StreamFile can see and modify these //------------------------------------------------------------------ File m_file; private: DISALLOW_COPY_AND_ASSIGN(StreamFile); }; } // namespace lldb_private #endif // liblldb_StreamFile_h_
475
370
/** @file overflow.h * @brief Arithmetic operations with overflow checks * * The operations are implemented with compiler builtins or equivalent where * possible, so the overflow check will typically just require a check of the * processor's overflow or carry flag. */ /* Copyright (C) 2018 <NAME> * * 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, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XAPIAN_INCLUDED_OVERFLOW_H #define XAPIAN_INCLUDED_OVERFLOW_H #ifndef PACKAGE # error config.h must be included first in each C++ source file #endif #include <type_traits> /** Addition with overflow checking. * * Add @a a and @a b in infinite precision, and store the result in * @a res. * * Where possible, compiler built-ins or intrinsics are used to try to ensure * minimal overhead from the overflow check. * * Currently only supported when types involved are unsigned. * * @return true if the result can be represented exactly in @a res, false * otherwise. */ template<typename T1, typename T2, typename R> typename std::enable_if<std::is_unsigned<T1>::value && std::is_unsigned<T2>::value && std::is_unsigned<R>::value, bool>::type add_overflows(T1 a, T2 b, R& res) { #if HAVE_DECL___BUILTIN_ADD_OVERFLOW return __builtin_add_overflow(a, b, &res); #else // Use a local variable to test for overflow so we don't need to worry if // res could be modified by another thread between us setting and testing // it. R r = R(a) + R(b); res = r; return (sizeof(R) <= sizeof(T1) || sizeof(R) <= sizeof(T2)) && r < R(b); #endif } /** Multiplication with overflow checking. * * Multiply @a a and @a b in infinite precision, and store the result in * @a res. * * Where possible, compiler built-ins or intrinsics are used to try to ensure * minimal overhead from the overflow check. * * Currently only supported when types involved are unsigned. * * @return true if the result can be represented exactly in @a res, false * otherwise. */ template<typename T1, typename T2, typename R> typename std::enable_if<std::is_unsigned<T1>::value && std::is_unsigned<T2>::value && std::is_unsigned<R>::value, bool>::type mul_overflows(T1 a, T2 b, R& res) { #if HAVE_DECL___BUILTIN_MUL_OVERFLOW return __builtin_mul_overflow(a, b, &res); #else // Use a local variable to test for overflow so we don't need to worry if // res could be modified by another thread between us setting and testing // it. R r = R(a) * R(b); res = r; return sizeof(R) < sizeof(T1) + sizeof(T2) && a != 0 && T2(r / R(a)) != b; #endif } #endif // XAPIAN_INCLUDED_OVERFLOW_H
1,066
380
<gh_stars>100-1000 /** * Copyright 2019 Airbnb. Licensed under Apache-2.0. See LICENSE in the project root for license * information. */ package com.airbnb.dynein.api; import lombok.AllArgsConstructor; @AllArgsConstructor public enum JobScheduleType { IMMEDIATE(1), SCHEDULED(2), SQS_DELAYED(3); int type; }
117
700
<reponame>arjenroodselaar/skidl from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib SKIDL_lib_version = '0.0.1' gennum = SchLib(tool=SKIDL).add_parts(*[ Part(name='GS2962',dest=TEMPLATE,tool=SKIDL,do_erc=True), Part(name='GS4910B',dest=TEMPLATE,tool=SKIDL,do_erc=True,aliases=['GS4911B']), Part(name='GS9020',dest=TEMPLATE,tool=SKIDL,ref_prefix='U',num_units=1,do_erc=True,pins=[ Pin(num='1',name='VDD',do_erc=True), Pin(num='2',name='GND',do_erc=True), Pin(num='3',name='GND',do_erc=True), Pin(num='4',name='VDD',do_erc=True), Pin(num='5',name='VDD_SDI',do_erc=True), Pin(num='6',name='SDI',do_erc=True), Pin(num='7',name='SDI',do_erc=True), Pin(num='8',name='VDD_SDI',do_erc=True), Pin(num='9',name='VDD_SCI',do_erc=True), Pin(num='10',name='SCI',do_erc=True), Pin(num='20',name='P5',func=Pin.BIDIR,do_erc=True), Pin(num='30',name='GND',do_erc=True), Pin(num='40',name='FL0',func=Pin.BIDIR,do_erc=True), Pin(num='50',name='GND',do_erc=True), Pin(num='60',name='DOUT9',func=Pin.OUTPUT,do_erc=True), Pin(num='70',name='SDO',func=Pin.OUTPUT,do_erc=True), Pin(num='80',name='ANC_DATA',func=Pin.OUTPUT,do_erc=True), Pin(num='11',name='SCI',do_erc=True), Pin(num='21',name='SCL/P4',func=Pin.BIDIR,do_erc=True), Pin(num='31',name='RESET',do_erc=True), Pin(num='41',name='S1',func=Pin.BIDIR,do_erc=True), Pin(num='51',name='VDD',do_erc=True), Pin(num='61',name='V',func=Pin.OUTPUT,do_erc=True), Pin(num='71',name='SDO',func=Pin.OUTPUT,do_erc=True), Pin(num='12',name='VDD_SCI',do_erc=True), Pin(num='22',name='SDA/P3',func=Pin.BIDIR,do_erc=True), Pin(num='32',name='STD3',func=Pin.OUTPUT,do_erc=True), Pin(num='42',name='S0',func=Pin.BIDIR,do_erc=True), Pin(num='52',name='DOUT1',func=Pin.OUTPUT,do_erc=True), Pin(num='62',name='H',func=Pin.OUTPUT,do_erc=True), Pin(num='72',name='SGND',do_erc=True), Pin(num='13',name='VDD',do_erc=True), Pin(num='23',name='A2/P2',func=Pin.BIDIR,do_erc=True), Pin(num='33',name='STD2',func=Pin.OUTPUT,do_erc=True), Pin(num='43',name='F_R/W',do_erc=True), Pin(num='53',name='DOUT2',func=Pin.OUTPUT,do_erc=True), Pin(num='63',name='F0',func=Pin.OUTPUT,do_erc=True), Pin(num='73',name='VBLANKS/L',do_erc=True), Pin(num='14',name='GND',do_erc=True), Pin(num='24',name='A1/P1',func=Pin.BIDIR,do_erc=True), Pin(num='34',name='STD1',func=Pin.OUTPUT,do_erc=True), Pin(num='44',name='INTERRUPT',func=Pin.OUTPUT,do_erc=True), Pin(num='54',name='DOUT3',func=Pin.OUTPUT,do_erc=True), Pin(num='64',name='F1',func=Pin.OUTPUT,do_erc=True), Pin(num='74',name='BYPASS_EDH',do_erc=True), Pin(num='15',name='HOSTIF_MODE',do_erc=True), Pin(num='25',name='A0/P0',func=Pin.BIDIR,do_erc=True), Pin(num='35',name='STD0',func=Pin.OUTPUT,do_erc=True), Pin(num='45',name='FLYWDIS',do_erc=True), Pin(num='55',name='DOUT4',func=Pin.OUTPUT,do_erc=True), Pin(num='65',name='F2',func=Pin.OUTPUT,do_erc=True), Pin(num='75',name='SDOMODE',do_erc=True), Pin(num='16',name='FIFOE/S',do_erc=True), Pin(num='26',name='R/W',do_erc=True), Pin(num='36',name='FL4',func=Pin.BIDIR,do_erc=True), Pin(num='46',name='NO_EDH',func=Pin.OUTPUT,do_erc=True), Pin(num='56',name='DOUT5',func=Pin.OUTPUT,do_erc=True), Pin(num='66',name='FLAG_MAP',do_erc=True), Pin(num='76',name='BLANK_EN',do_erc=True), Pin(num='17',name='CRC_MODE',do_erc=True), Pin(num='27',name='A/D',do_erc=True), Pin(num='37',name='FL3',func=Pin.BIDIR,do_erc=True), Pin(num='47',name='FIFO_RESET',func=Pin.OUTPUT,do_erc=True), Pin(num='57',name='DOUT6',func=Pin.OUTPUT,do_erc=True), Pin(num='67',name='GND',do_erc=True), Pin(num='77',name='ANC_CHKSM',do_erc=True), Pin(num='18',name='P7',func=Pin.BIDIR,do_erc=True), Pin(num='28',name='CS',do_erc=True), Pin(num='38',name='FL2',func=Pin.BIDIR,do_erc=True), Pin(num='48',name='PCLKOUT',func=Pin.OUTPUT,do_erc=True), Pin(num='58',name='DOUT7',func=Pin.OUTPUT,do_erc=True), Pin(num='68',name='VDD',do_erc=True), Pin(num='78',name='CLIP_TRS',do_erc=True), Pin(num='19',name='P6',func=Pin.BIDIR,do_erc=True), Pin(num='29',name='VDD',do_erc=True), Pin(num='39',name='FL1',func=Pin.BIDIR,do_erc=True), Pin(num='49',name='DOUT0',func=Pin.OUTPUT,do_erc=True), Pin(num='59',name='DOUT8',func=Pin.OUTPUT,do_erc=True), Pin(num='69',name='SVDD',do_erc=True), Pin(num='79',name='TRS_ERR',func=Pin.OUTPUT,do_erc=True)]), Part(name='GS9025',dest=TEMPLATE,tool=SKIDL,ref_prefix='U',num_units=1,do_erc=True,pins=[ Pin(num='1',name='DDI',do_erc=True), Pin(num='2',name='DDI',do_erc=True), Pin(num='3',name='VCC_75',do_erc=True), Pin(num='4',name='VCC',do_erc=True), Pin(num='5',name='VEE',do_erc=True), Pin(num='6',name='SDI',do_erc=True), Pin(num='7',name='SDI',do_erc=True), Pin(num='8',name='VCC',do_erc=True), Pin(num='9',name='VEE',do_erc=True), Pin(num='10',name='CD_ADJ',do_erc=True), Pin(num='20',name='RVCO',do_erc=True), Pin(num='30',name='VEE',do_erc=True), Pin(num='40',name='SSI/CD',func=Pin.OUTPUT,do_erc=True), Pin(num='11',name='AGC-',do_erc=True), Pin(num='21',name='CBG',do_erc=True), Pin(num='31',name='SDO',func=Pin.OUTPUT,do_erc=True), Pin(num='41',name='A/D',do_erc=True), Pin(num='12',name='AGC+',do_erc=True), Pin(num='22',name='VCC',do_erc=True), Pin(num='32',name='SDO',func=Pin.OUTPUT,do_erc=True), Pin(num='42',name='SMPTE',do_erc=True), Pin(num='13',name='VCC',do_erc=True), Pin(num='23',name='SS2',func=Pin.BIDIR,do_erc=True), Pin(num='33',name='VEE',do_erc=True), Pin(num='43',name='OEM',func=Pin.OUTPUT,do_erc=True), Pin(num='14',name='VEE',do_erc=True), Pin(num='24',name='SS1',func=Pin.BIDIR,do_erc=True), Pin(num='34',name='VEE',do_erc=True), Pin(num='44',name='VCC_75',do_erc=True), Pin(num='15',name='LF+',do_erc=True), Pin(num='25',name='SS0',func=Pin.BIDIR,do_erc=True), Pin(num='35',name='VCC',do_erc=True), Pin(num='16',name='LFS',do_erc=True), Pin(num='26',name='AUTO/MAN',do_erc=True), Pin(num='36',name='CLK_EN',do_erc=True), Pin(num='17',name='LF-',do_erc=True), Pin(num='27',name='VEE',do_erc=True), Pin(num='37',name='VEE',do_erc=True), Pin(num='18',name='VEE',do_erc=True), Pin(num='28',name='SCO',func=Pin.OUTPUT,do_erc=True), Pin(num='38',name='COSC',do_erc=True), Pin(num='19',name='RVCO_RTN',do_erc=True), Pin(num='29',name='SCO',func=Pin.OUTPUT,do_erc=True), Pin(num='39',name='LOCK',func=Pin.OUTPUT,do_erc=True)]), Part(name='GS9032',dest=TEMPLATE,tool=SKIDL,ref_prefix='U',num_units=1,do_erc=True,pins=[ Pin(num='1',name='PD9',do_erc=True), Pin(num='2',name='PD8',do_erc=True), Pin(num='3',name='PD7',do_erc=True), Pin(num='4',name='PD6',do_erc=True), Pin(num='5',name='PD5',do_erc=True), Pin(num='6',name='PD4',do_erc=True), Pin(num='7',name='PD3',do_erc=True), Pin(num='8',name='PD2',do_erc=True), Pin(num='9',name='PD1',do_erc=True), Pin(num='10',name='PD0',do_erc=True), Pin(num='20',name='LOCK_DET',func=Pin.OUTPUT,do_erc=True), Pin(num='30',name='R_SET1',do_erc=True), Pin(num='40',name='LBWC',do_erc=True), Pin(num='11',name='PCLKIN',do_erc=True), Pin(num='21',name='SS0',do_erc=True), Pin(num='31',name='BYPASS',do_erc=True), Pin(num='41',name='LF+',do_erc=True), Pin(num='12',name='VEE3',do_erc=True), Pin(num='22',name='R_SET0',do_erc=True), Pin(num='32',name='AUTO/MAN',do_erc=True), Pin(num='42',name='LF-',do_erc=True), Pin(num='13',name='VCC3',do_erc=True), Pin(num='23',name='VEE',do_erc=True), Pin(num='33',name='RESET',do_erc=True), Pin(num='43',name='VEE',do_erc=True), Pin(num='14',name='C_OSC',do_erc=True), Pin(num='24',name='SDO0',func=Pin.OUTPUT,do_erc=True), Pin(num='34',name='VCC1',do_erc=True), Pin(num='44',name='SYNC_DIS',do_erc=True), Pin(num='15',name='SS2',do_erc=True), Pin(num='25',name='SDO0',func=Pin.OUTPUT,do_erc=True), Pin(num='35',name='VEE1',do_erc=True), Pin(num='16',name='SS1',do_erc=True), Pin(num='26',name='VEE',do_erc=True), Pin(num='36',name='R_VCO+',do_erc=True), Pin(num='17',name='VCC2',do_erc=True), Pin(num='27',name='SDO1',func=Pin.OUTPUT,do_erc=True), Pin(num='37',name='C_BG',do_erc=True), Pin(num='18',name='VEE2',do_erc=True), Pin(num='28',name='SDO1',func=Pin.OUTPUT,do_erc=True), Pin(num='38',name='R_VCO-',do_erc=True), Pin(num='19',name='SDO1_ENABLE',do_erc=True), Pin(num='29',name='VEE',do_erc=True), Pin(num='39',name='VEE',do_erc=True)])])
5,776
1,056
<filename>javafx/javafx2.editor/src/org/netbeans/modules/javafx2/editor/JavaFXEditorUtils.java<gh_stars>1000+ /* * 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.javafx2.editor; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.netbeans.api.lexer.Token; import org.netbeans.api.lexer.TokenId; import org.netbeans.api.lexer.TokenSequence; import org.netbeans.modules.csl.api.CompletionProposal; /** * * @author <NAME> <<EMAIL>> */ public final class JavaFXEditorUtils { /** * The FXML ns URI */ public static final String FXML_FX_NAMESPACE = "http://javafx.com/fxml"; // NOI18N public static final String FXML_FX_NAMESPACE_CURRENT = "http://javafx.com/fxml/1"; // NOI18N public static final String FXML_FX_PREFIX = "fx"; // NOI18N public static final String FXML_MIME_TYPE = "text/x-fxml+xml"; // NOI18N public static final String FXML_FILE_EXTENSION = "fxml"; // NOI18N public static final String JAVA_MIME_TYPE = "text/x-java"; // NOI18N public static final String FXML_NODE_CLASS = "javafx.scene.Node"; // NOI18N private JavaFXEditorUtils() { } // Copied from web.common LexerUtils to not have web module dependency public static List<CompletionProposal> filterCompletionProposals(List<CompletionProposal> proposals, CharSequence prefix, boolean ignoreCase) { List<CompletionProposal> filtered = new ArrayList<CompletionProposal>(); for (CompletionProposal proposal : proposals) { if (startsWith(proposal.getInsertPrefix(), prefix, ignoreCase, false)) { filtered.add(proposal); } } return filtered; } /** * @param optimized - first sequence is lowercase, one call to * Character.toLowerCase() only */ public static boolean startsWith(CharSequence text1, CharSequence prefix, boolean ignoreCase, boolean optimized) { if (text1.length() < prefix.length()) { return false; } else { return equals(text1.subSequence(0, prefix.length()), prefix, ignoreCase, optimized); } } /** * @param optimized - first sequence is lowercase, one call to * Character.toLowerCase() only */ public static boolean equals(CharSequence text1, CharSequence text2, boolean ignoreCase, boolean optimized) { if (text1.length() != text2.length()) { return false; } else { //compare content for (int i = 0; i < text1.length(); i++) { char ch1 = ignoreCase && !optimized ? Character.toLowerCase(text1.charAt(i)) : text1.charAt(i); char ch2 = ignoreCase ? Character.toLowerCase(text2.charAt(i)) : text2.charAt(i); if (ch1 != ch2) { return false; } } return true; } } public static Token followsToken(TokenSequence ts, Collection<? extends TokenId> searchedIds, boolean backwards, boolean repositionBack, TokenId... skipIds) { Collection<TokenId> skip = Arrays.asList(skipIds); int index = ts.index(); while (backwards ? ts.movePrevious() : ts.moveNext()) { Token token = ts.token(); TokenId id = token.id(); if (searchedIds.contains(id)) { if (repositionBack) { int idx = ts.moveIndex(index); boolean moved = ts.moveNext(); assert idx == 0 && moved; } return token; } if (!skip.contains(id)) { break; } } return null; } }
1,804
921
<reponame>vsch/idea-markdown // Copyright (c) 2015-2020 <NAME> <<EMAIL>> Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.vladsch.md.nav.parser.cache; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.vladsch.flexmark.util.misc.DelimitedBuilder; import com.vladsch.flexmark.util.sequence.Escaping; import com.vladsch.md.nav.MdFileType; import com.vladsch.md.nav.parser.cache.data.CachedDataKey; import com.vladsch.md.nav.parser.cache.data.ProjectCachedData; import com.vladsch.md.nav.parser.cache.data.dependency.RestartableProjectFileDependency; import com.vladsch.md.nav.parser.cache.data.transaction.CachedTransactionContext; import com.vladsch.md.nav.parser.cache.data.transaction.IndentingLogger; import com.vladsch.md.nav.psi.element.MdFile; import com.vladsch.md.nav.psi.element.MdImageLinkRef; import com.vladsch.md.nav.psi.element.MdLinkRefElement; import com.vladsch.md.nav.psi.element.MdWikiLinkRef; import com.vladsch.md.nav.psi.util.MdLinkType; import com.vladsch.md.nav.settings.MdApplicationSettings; import com.vladsch.md.nav.settings.MdDebugSettings; import com.vladsch.md.nav.util.FileRef; import com.vladsch.md.nav.util.ImageLinkRef; import com.vladsch.md.nav.util.LinkRef; import com.vladsch.md.nav.util.PathInfo; import com.vladsch.md.nav.util.ProjectFileRef; import com.vladsch.md.nav.util.WikiLinkRef; import com.vladsch.plugin.util.HelpersKt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; import java.util.function.Predicate; import static com.vladsch.flexmark.util.misc.Utils.removeSuffix; import static com.vladsch.md.nav.util.PathInfo.isFileURI; /** * Cache for resolved link address targets for links and images * <p> * There are two caches. * <p> * One does not add the file as dependency so is not cleared when the file is changed. This is used to allow re-use of links across file mods * <p> * The other is the current link cache which contains all resolved links in the current file and is re-computed when file is modified. * This cache uses {@link MdCachedFileElements} to scan for links and removes any persistent cached links which no longer match a link in the file * and adds any links which survived the mod * <p> * When a link target is resolved, the link type, address text and resolved target is added to the cache * subsequent requests for identical link type and address resolution returns cached value for resolved link * <p> * Only single resolve values can be cached this way. Multi resolve and completion has to use Link resolver as before */ public class MdCachedResolvedLinks { public static final VirtualFileManager FILE_MANAGER = VirtualFileManager.getInstance(); static final Logger LOG_CACHE_DETAIL = IndentingLogger.LOG_COMPUTE_DETAIL; static final Logger LOG_CACHE = IndentingLogger.LOG_COMPUTE_RESULT; static byte F_VIRTUAL_FILE = 0x01; static byte F_PROJECT_FILE = 0x02; static byte F_UNDEFINED = 0x04; static byte F_UNDEFINED_MARKDOWN = 0x08; static class CachedLink { final @NotNull MdLinkType myLinkType; // link type final @NotNull String myLinkAddress; // original link address text final @NotNull String myTargetLinkAddress; // resolved target address final byte myFlags; static CachedLink cacheLink(@NotNull MdLinkType linkType, @NotNull String linkAddress, @NotNull String targetLinkAddress, boolean isVirtualFile, boolean isProjectFile) { byte flags = (byte) (isVirtualFile && isFileURI(targetLinkAddress) ? isProjectFile ? F_PROJECT_FILE | F_VIRTUAL_FILE : F_VIRTUAL_FILE : 0); return new CachedLink(linkType, linkAddress, targetLinkAddress, flags); } static CachedLink cacheUndefinedLink(@NotNull MdLinkType linkType, @NotNull String linkAddress, boolean isMarkdown) { byte flags = (byte) (isMarkdown ? F_UNDEFINED | F_UNDEFINED_MARKDOWN : F_UNDEFINED); return new CachedLink(linkType, linkAddress, "", flags); } CachedLink(@NotNull MdLinkType linkType, @NotNull String linkAddress, @NotNull String targetLinkAddress, byte flags) { myLinkType = linkType; myLinkAddress = linkAddress; myTargetLinkAddress = targetLinkAddress; myFlags = flags; } boolean isVirtualFile() { return (myFlags & F_VIRTUAL_FILE) != 0; } boolean isProjectFile() { return (myFlags & F_PROJECT_FILE) != 0; } boolean isUndefined() { return (myFlags & F_UNDEFINED) != 0; } boolean isMarkdown() { return (myFlags & F_UNDEFINED_MARKDOWN) != 0; } boolean isValid() { // if file URI check if resolves to file or directory if (isVirtualFile()) { return FILE_MANAGER.findFileByUrl(myTargetLinkAddress) != null; } return true; } @Nullable VirtualFile getVirtualFile() { // if file URI and resolves to virtual file if (isVirtualFile()) { return FILE_MANAGER.findFileByUrl(myTargetLinkAddress); } return null; } } static class CachedLinkTarget { final @NotNull String myTargetLinkAddress; // resolved target address final byte myFlags; CachedLinkTarget(@NotNull String targetLinkAddress, byte flags) { myTargetLinkAddress = targetLinkAddress; myFlags = flags; } boolean isVirtualFile() { return (myFlags & F_VIRTUAL_FILE) != 0; } boolean isProjectFile() { return (myFlags & F_PROJECT_FILE) != 0; } boolean isUndefined() { return (myFlags & F_UNDEFINED) != 0; } boolean isMarkdown() { return (myFlags & F_UNDEFINED_MARKDOWN) != 0; } boolean isValid() { // if file URI check if resolves to file or directory if (isVirtualFile()) { return FILE_MANAGER.findFileByUrl(myTargetLinkAddress) != null; } return true; } @Nullable VirtualFile getVirtualFile() { // if file URI and resolves to virtual file if (isVirtualFile()) { return FILE_MANAGER.findFileByUrl(myTargetLinkAddress); } return null; } } static class CachedLinkData { final @NotNull ArrayList<CachedLinkTarget> myCachedLinkTargets = new ArrayList<>(); // holds target link address & flags final @NotNull HashMap<String, Integer> myCachedLinkTargetIndexMap = new HashMap<>(); // holds paths of all virtual file targets to indices final @NotNull HashMap<String, Integer> myLinks = new HashMap<>(); // linkAddress to index into cachedLinkTargets final @NotNull HashMap<String, Integer> myImages = new HashMap<>(); // linkAddress to index into cachedLinkTargets final @NotNull HashMap<String, Integer> myWikis = new HashMap<>(); // linkAddress to index into cachedLinkTargets final @NotNull HashSet<String> myUndefinedExtensions = new HashSet<>(); // undefined extensions final @NotNull HashSet<String> myUndefinedNames = new HashSet<>(); // undefined file names with extensions @NotNull String myFilePath = ""; boolean myHaveUndefinedMarkdown = false; boolean myIsValid = true; boolean myNextIsValid = true; CachedLinkData() { } void copyFrom(@NotNull CachedLinkData other) { myFilePath = other.myFilePath; myHaveUndefinedMarkdown = other.myHaveUndefinedMarkdown; myIsValid = other.myIsValid; myNextIsValid = other.myNextIsValid; myCachedLinkTargets.clear(); myCachedLinkTargets.addAll(other.myCachedLinkTargets); myCachedLinkTargetIndexMap.clear(); myCachedLinkTargetIndexMap.putAll(other.myCachedLinkTargetIndexMap); myLinks.clear(); myLinks.putAll(other.myLinks); myImages.clear(); myImages.putAll(other.myImages); myWikis.clear(); myWikis.putAll(other.myWikis); myUndefinedExtensions.clear(); myUndefinedExtensions.addAll(other.myUndefinedExtensions); myUndefinedNames.clear(); myUndefinedNames.addAll(other.myUndefinedNames); } int addCachedLinkTarget(@NotNull String targetLinkAddress, byte flags) { int index = myCachedLinkTargetIndexMap.computeIfAbsent(targetLinkAddress, k -> { int i = myCachedLinkTargets.size(); myCachedLinkTargets.add(new CachedLinkTarget(k, flags)); return i; }); return index; } @Nullable CachedLink getCachedLink(@NotNull MdLinkType linkType, @NotNull String linkAddress, @Nullable Integer index) { if (index != null) { if (index >= 0) { CachedLinkTarget target = myCachedLinkTargets.get(index); if (target != null) { return new CachedLink(linkType, linkAddress, target.myTargetLinkAddress, target.myFlags); } } else { // undefined link return new CachedLink(linkType, linkAddress, "", index == -2 ? (byte) (F_UNDEFINED | F_UNDEFINED_MARKDOWN) : F_UNDEFINED); } } return null; } @Nullable CachedLink getCachedLink(@NotNull MdLinkType linkType, @NotNull String linkAddress) { HashMap<String, Integer> cachedLinks = getCachedLinkMap(linkType); return getCachedLink(linkType, linkAddress, cachedLinks.get(linkAddress)); } /** * Test if link address has a cached link * NOTE: Cannot just test is link address exists in corresponding index map. The cached link target at that index could have been removed. * * @param linkType link type * @param linkAddress link address * * @return true if have cached key */ boolean hasCachedLink(@NotNull MdLinkType linkType, @NotNull String linkAddress) { return getCachedLink(linkType, linkAddress) != null; } boolean addCachedLink(@NotNull CachedLink cachedLink) { HashMap<String, Integer> cachedLinks = getCachedLinkMap(cachedLink.myLinkType); if (getCachedLink(cachedLink.myLinkType, cachedLink.myLinkAddress) == null) { int index; if (cachedLink.isUndefined()) { if (cachedLink.isMarkdown()) myHaveUndefinedMarkdown = true; PathInfo pathInfo = new PathInfo(cachedLink.myLinkAddress); myUndefinedExtensions.add(pathInfo.getExt()); myUndefinedNames.add(pathInfo.getFileNameNoQuery()); index = cachedLink.isMarkdown() ? -2 : -1; } else { index = addCachedLinkTarget(cachedLink.myTargetLinkAddress, cachedLink.myFlags); } cachedLinks.put(cachedLink.myLinkAddress, index); return true; } return false; } HashMap<String, Integer> getCachedLinkMap(MdLinkType linkType) { switch (linkType) { case LINK: return myLinks; case IMAGE: return myImages; case WIKI: return myWikis; default: throw new IllegalStateException("Unhandled MdLinkType: " + linkType); } } /** * NOTE: only removes link address from links, images or wikis map to facilitate log of links no longer on the page * does not create a valid cached link data state for all other flags and values * * @param cachedLink cached link to remove */ void removeCachedLink(@NotNull CachedLink cachedLink) { HashMap<String, Integer> cachedLinks = getCachedLinkMap(cachedLink.myLinkType); cachedLinks.remove(cachedLink.myLinkAddress); } boolean isNewVirtualFile(CachedLink cachedLink) { return !myCachedLinkTargetIndexMap.containsKey(cachedLink.myTargetLinkAddress); } boolean isNewVirtualFile(@NotNull String targetUrl) { return !myCachedLinkTargetIndexMap.containsKey(targetUrl); } public void forAllCachedLinks(MdLinkType linkType, Consumer<CachedLink> consumer) { HashMap<String, Integer> cachedLinks = getCachedLinkMap(linkType); for (Map.Entry<String, Integer> entry : cachedLinks.entrySet()) { CachedLink cachedLink = getCachedLink(linkType, entry.getKey(), entry.getValue()); if (cachedLink != null) { consumer.accept(cachedLink); } } } public boolean removeCachedLinkIf(MdLinkType linkType, Predicate<Map.Entry<String, Integer>> consumer) { HashMap<String, Integer> cachedLinks = getCachedLinkMap(linkType); return cachedLinks.entrySet().removeIf(consumer); } public boolean hasUndefinedLinks() { return !myUndefinedNames.isEmpty(); } /** * Removes the string from cached link target index map and sets old index to null * NOTE: does not remove the linkAddresses which map to this index. * Getting cached link for those addresses will result in null, meaning no key * * @param targetLinkUrl target url to remove * * @return true if there was such a link */ public boolean removeCachedLinkTarget(String targetLinkUrl) { Integer index = myCachedLinkTargetIndexMap.get(targetLinkUrl); if (index == null) return false; myCachedLinkTargets.set(index, null); myCachedLinkTargetIndexMap.remove(targetLinkUrl); return true; } } /** * Persistent links, not invalidated, computes to empty */ final static CachedDataKey<MdFile, CachedLinkData> CACHED_PERSISTENT_LINKS = new CachedDataKey<MdFile, CachedLinkData>("CACHED_PERSISTENT_LINKS") { @NotNull @Override public CachedLinkData compute(@NotNull CachedTransactionContext<MdFile> context) { return new CachedLinkData(); } @Override public boolean isValid(@NotNull CachedLinkData value) { return true; } }; @SuppressWarnings("unchecked") public static final Class<MdLinkRefElement>[] LINK_REF_CLASSES = new Class[] { MdLinkRefElement.class }; private static MdApplicationSettings ourApplicationSettings; @NotNull static MdDebugSettings getDebugSettings() { if (ourApplicationSettings == null) { ourApplicationSettings = MdApplicationSettings.getInstance(); } return ourApplicationSettings.getDebugSettings(); } /** * Cached links, invalidated by file changes, reload resolved links from CACHED_PERSISTENT_LINKS on compute */ final static CachedDataKey<MdFile, CachedLinkData> CACHED_LINKS = new CachedDataKey<MdFile, CachedLinkData>("CACHED_LINKS") { @NotNull @Override public CachedLinkData compute(@NotNull CachedTransactionContext<MdFile> context) { MdFile file = context.getDataOwner(); context.addDependency(file); String filePath = file.getVirtualFile().getPath(); CachedLinkData persistentLinks = CachedData.get(file, CACHED_PERSISTENT_LINKS); CachedLinkData cachedLinkData = new CachedLinkData(); cachedLinkData.myFilePath = filePath; PsiManager psiManager = PsiManager.getInstance(file.getProject()); if (getDebugSettings().getUseFileLinkCache()) { if (persistentLinks.myFilePath.isEmpty() || persistentLinks.myFilePath.equals(filePath)) { DelimitedBuilder out = LOG_CACHE_DETAIL.isDebugEnabled() ? new DelimitedBuilder("\n") : null; if (out != null) out.append("Computing CACHED_LINKS: for ").append(filePath).mark(); MdCachedFileElements.findChildrenOfAnyType(file, false, false, false, LINK_REF_CLASSES, link -> { String linkText = Escaping.unescapeString(link.getText(), true); if (!linkText.isEmpty()) { MdLinkType linkType; String decodedText; if (link instanceof MdImageLinkRef) { decodedText = ImageLinkRef.urlDecode(linkText); linkType = MdLinkType.IMAGE; } else if (link instanceof MdWikiLinkRef) { decodedText = WikiLinkRef.linkAsFile(linkText); linkType = MdLinkType.WIKI; } else { // treat as link ref decodedText = LinkRef.urlDecode(linkText); linkType = MdLinkType.LINK; } String linkTextForCache = removeSuffix(new PathInfo(decodedText).getFilePathNoQuery(), "/"); CachedLink cachedLink = persistentLinks.getCachedLink(linkType, linkTextForCache); if (cachedLink != null) { // NOTE: undefined links get invalidated when file content is regenerated if (!cachedLink.isUndefined()) { boolean isValid = true; if (cachedLink.isVirtualFile()) { VirtualFile virtualFile = cachedLink.getVirtualFile(); if (virtualFile != null && virtualFile.isValid()) { if (cachedLink.isProjectFile()) { PsiFile psiFile = psiManager.findFile(virtualFile); if (psiFile != null) { context.addDependency(psiFile); if (out != null) out.append(" Adding file dependency on psiFile: ").append(psiFile.getVirtualFile().getPath()).mark(); } } else { context.addDependency(virtualFile); if (out != null) out.append(" Adding file dependency on virtualFile: ").append(virtualFile.getPath()).mark(); } } else { isValid = false; } } if (isValid) { cachedLinkData.addCachedLink(cachedLink); if (out != null) out.append(" Keeping cached link type: ").append(linkType).append(" link: ").append(linkTextForCache).append(" to ").append(cachedLink.myTargetLinkAddress).mark(); } else { if (out != null) { persistentLinks.removeCachedLink(cachedLink); out.append(" Removing invalidated cached link type: ").append(linkType).append(" link: ").append(linkTextForCache).append(" to ").append(cachedLink.myTargetLinkAddress).mark(); } } } } else { if (out != null) out.append(" No cached link for type: ").append(linkType).append(" link: ").append(linkTextForCache).mark(); } } }); if (out != null) { // list what is no longer on the page persistentLinks.forAllCachedLinks(MdLinkType.IMAGE, cachedLink -> { if (!cachedLink.isUndefined() && !cachedLinkData.myImages.containsKey(cachedLink.myLinkAddress)) { out.append(" Removing not in page link type: ").append(MdLinkType.IMAGE).append(" link: ").append(cachedLink.myLinkAddress).append(" to ").append(cachedLink.myTargetLinkAddress).mark(); } }); persistentLinks.forAllCachedLinks(MdLinkType.WIKI, cachedLink -> { if (!cachedLink.isUndefined() && !cachedLinkData.myWikis.containsKey(cachedLink.myLinkAddress)) { out.append(" Removing not in page link type: ").append(MdLinkType.WIKI).append(" link: ").append(cachedLink.myLinkAddress).append(" to ").append(cachedLink.myTargetLinkAddress).mark(); } }); persistentLinks.forAllCachedLinks(MdLinkType.LINK, cachedLink -> { if (!cachedLink.isUndefined() && !cachedLinkData.myLinks.containsKey(cachedLink.myLinkAddress)) { out.append(" Removing not in page link type: ").append(MdLinkType.LINK).append(" link: ").append(cachedLink.myLinkAddress).append(" to ").append(cachedLink.myTargetLinkAddress).mark(); } }); LOG_CACHE_DETAIL.debug(out.toString()); } } else { HelpersKt.debug(LOG_CACHE, () -> String.format(" No links kept, file path changed from %s to %s", persistentLinks.myFilePath, filePath)); } // NOTE: always have dependency on project files since at any time an undefined link can become defined or dependency could be added or invalidated by content change context.addDependency(new LinkProjectFilePredicate(file, cachedLinkData)); HelpersKt.debug(LOG_CACHE, () -> String.format("Kept CACHED_LINKS: links: %d, images: %d wikis: %d for %s@%x", cachedLinkData.myLinks.size(), cachedLinkData.myImages.size(), cachedLinkData.myWikis.size(), filePath, file.hashCode())); } persistentLinks.copyFrom(cachedLinkData); return cachedLinkData; } /** * Always valid because stores only basic types * @param value cached link data * @return true */ @Override public boolean isValid(@NotNull CachedLinkData value) { return true; } }; static class LinkProjectFilePredicate extends RestartableProjectFileDependency { @NotNull CachedLinkData cachedLinkData; public LinkProjectFilePredicate(@NotNull MdFile file, @NotNull CachedLinkData cachedLinkData) { super(file); this.cachedLinkData = cachedLinkData; } @Override public boolean test(@NotNull PsiFile psiFile) { boolean isValid = cachedLinkData.myIsValid; VirtualFile virtualFile = psiFile.getVirtualFile(); if (isValid) { if (!cachedLinkData.myFilePath.equals(virtualFile.getPath())) { if (cachedLinkData.isNewVirtualFile(virtualFile.getUrl())) { String extension = virtualFile.getExtension(); if (cachedLinkData.hasUndefinedLinks()) { if (cachedLinkData.myUndefinedExtensions.contains(extension)) { isValid = false; HelpersKt.debug(LOG_CACHE, () -> String.format("Invalidating CACHED_LINKS: has undefined ext: %s, for %s", extension, cachedLinkData.myFilePath)); } } // NOTE: wiki links can have multi-resolve issues but only for markdown files which they evaluate based on file name without extension, ignoring subdirectory path if (isValid && psiFile.getFileType() == MdFileType.INSTANCE) { if (!cachedLinkData.myWikis.isEmpty()) { // OPTIMIZE: can check if undefined names or defined wiki link address can possibly resolve to psiFile in question isValid = false; // NOTE: need to remove all wiki links so they all get re-computed cachedLinkData.getCachedLinkMap(MdLinkType.WIKI).clear(); HelpersKt.debug(LOG_CACHE, () -> String.format("Invalidating CACHED_LINKS: have wiki links: %d, for %s@%x", cachedLinkData.myWikis.size(), cachedLinkData.myFilePath, myFile.hashCode())); } } } } } if (!cachedLinkData.myNextIsValid) { isValid = false; } if (!isValid) { // need to remove any links which point to this file so they are re-computed just in case if (cachedLinkData.removeCachedLinkTarget(virtualFile.getUrl())) { // Not a new dependency, this is a light virtual file need to check if timestamp changed long modificationCount = virtualFile.getModificationCount(); long modificationStamp = virtualFile.getModificationStamp(); HelpersKt.debug(LOG_CACHE, () -> String.format("Removing link targets for file: %s, modCount: %d, modTimestamp: %d in %s@%x", virtualFile.getName(), modificationCount, modificationStamp, myFile.getName(), myFile.hashCode())); CachedLinkData persistentLinks = CachedData.get((MdFile) myFile, CACHED_PERSISTENT_LINKS); persistentLinks.copyFrom(cachedLinkData); } cachedLinkData.myIsValid = false; cachedLinkData.myNextIsValid = false; } // Project project = psiFile.getProject(); // if (!isValid && !project.isDisposed()) { // ApplicationManager.getApplication().invokeLater(() -> { // if (!project.isDisposed()) { // DaemonCodeAnalyzer.getInstance(project).restart(myFile); // HelpersKt.debug(LOG_CACHE, () -> String.format("CachedLinkData: Restarted code analyzer for %s", cachedLinkData.myFilePath)); // } // }); // } return isValid; } } public static boolean hasCachedLink(@NotNull MdFile containingFile, @NotNull LinkRef linkRef) { if (getDebugSettings().getUseFileLinkCache()) { String linkRefFilePath = linkRef.getFilePath(); if (linkRefFilePath.isEmpty()) { return false; } else { String linkRefPathForCache = removeSuffix(linkRef.linkToFile(linkRef.getFilePathNoQuery()), "/"); MdLinkType linkType = getLinkType(linkRef); return CachedData.get(containingFile, CACHED_LINKS).getCachedLink(linkType, linkRefPathForCache) != null; } } return false; } @NotNull private static MdLinkType getLinkType(@NotNull LinkRef linkRef) { MdLinkType linkType; if (linkRef instanceof ImageLinkRef) linkType = MdLinkType.IMAGE; else if (linkRef instanceof WikiLinkRef) linkType = MdLinkType.WIKI; else linkType = MdLinkType.LINK; return linkType; } @Nullable public static PathInfo getCachedLink(@NotNull MdFile containingFile, @NotNull LinkRef linkRef) { String linkRefFilePath = linkRef.isNormalized() ? linkRef.getFilePath() : Escaping.unescapeString(linkRef.getFilePath()); if (linkRefFilePath.isEmpty()) { return null; } else if (getDebugSettings().getUseFileLinkCache()) { String linkRefPathForCache = removeSuffix(linkRef.linkToFile(linkRef.getFilePathNoQuery()), "/"); MdLinkType linkType = getLinkType(linkRef); CachedLink cachedLink = CachedData.get(containingFile, CACHED_LINKS).getCachedLink(linkType, linkRefPathForCache); if (cachedLink != null && !cachedLink.isUndefined()) { if (cachedLink.isVirtualFile()) { VirtualFile virtualFile = cachedLink.getVirtualFile(); if (virtualFile != null && virtualFile.isValid()) { HelpersKt.debug(LOG_CACHE_DETAIL, () -> String.format("Got cached file type: %s link: %s to %s", linkType, linkRefPathForCache, cachedLink.myTargetLinkAddress)); if (cachedLink.isProjectFile()) { return new ProjectFileRef(virtualFile, containingFile.getProject()); } else { return new FileRef(virtualFile); } } else { HelpersKt.debug(LOG_CACHE_DETAIL, () -> String.format("Skipping cached file type: %s link: %s to %s, no virtual file", linkType, linkRefPathForCache, cachedLink.myTargetLinkAddress)); } } else { // URL HelpersKt.debug(LOG_CACHE_DETAIL, () -> String.format("Got cached URL type: %s link: %s to %s", linkType, linkRefPathForCache, cachedLink.myTargetLinkAddress)); return new PathInfo(cachedLink.myTargetLinkAddress); } } } return null; } public static void addCachedLink(@NotNull MdFile containingFile, @NotNull LinkRef linkRef, @NotNull PathInfo targetRef) { String linkRefFilePath = linkRef.isNormalized() ? linkRef.getFilePath() : Escaping.unescapeString(linkRef.getFilePath()); if (!linkRefFilePath.isEmpty() && getDebugSettings().getUseFileLinkCache()) { String linkRefPathForCache = removeSuffix(linkRef.linkToFile(linkRef.getFilePathNoQuery()), "/"); MdLinkType linkType = getLinkType(linkRef); CachedLinkData persistentLinks = CachedData.get(containingFile, CACHED_PERSISTENT_LINKS); CachedLinkData cachedLinkData = CachedData.get(containingFile, CACHED_LINKS); CachedLink cachedLink; boolean updateDependencies = false; String targetRefFilePath = targetRef.getFilePath(); if (targetRef instanceof FileRef) { VirtualFile virtualFile = targetRef.getVirtualFile(); if (virtualFile != null) { updateDependencies = true; cachedLink = CachedLink.cacheLink(linkType, linkRefPathForCache, virtualFile.getUrl(), true, targetRef instanceof ProjectFileRef); } else { cachedLink = CachedLink.cacheLink(linkType, linkRefPathForCache, targetRefFilePath, false, false); } } else { cachedLink = CachedLink.cacheLink(linkType, linkRefPathForCache, targetRefFilePath, false, false); } if (updateDependencies) { // NOTE: Need to invalidate the data so that new dependencies will be used but only if not already in the link if (cachedLinkData.isNewVirtualFile(cachedLink)) { // invalidate on next project file notification cachedLinkData.myNextIsValid = false; HelpersKt.debug(LOG_CACHE_DETAIL, () -> String.format("Next Invalidation on new dependency for %s link type: %s link: %s to %s", containingFile.getName(), linkType, linkRefPathForCache, cachedLink.myTargetLinkAddress)); } } ReentrantLock lock = ProjectCachedData.fileCachedData(containingFile).getKeyLock(CACHED_LINKS); boolean cachedLinkAdded; try { lock.lock(); cachedLinkAdded = cachedLinkData.addCachedLink(cachedLink); persistentLinks.addCachedLink(cachedLink); } finally { lock.unlock(); } if (cachedLinkAdded) { HelpersKt.debug(LOG_CACHE_DETAIL, () -> String.format("Add cached link for %s type: %s link: %s to %s", containingFile.getName(), linkType, linkRefFilePath, cachedLink.myTargetLinkAddress)); } } } public static void addUndefinedCachedLink(@NotNull MdFile containingFile, @NotNull LinkRef linkRef) { String linkRefFilePath = linkRef.isNormalized() ? linkRef.getFilePath() : Escaping.unescapeString(linkRef.getFilePath()); if (!linkRefFilePath.isEmpty() && getDebugSettings().getUseFileLinkCache()) { String linkRefPathForCache = removeSuffix(linkRef.linkToFile(linkRef.getFilePathNoQuery()), "/"); MdLinkType linkType = getLinkType(linkRef); CachedLinkData cachedLinkData = CachedData.get(containingFile, CACHED_LINKS); if (!cachedLinkData.hasCachedLink(linkType, linkRefPathForCache)) { CachedLinkData persistentLinks = CachedData.get(containingFile, CACHED_PERSISTENT_LINKS); // NOTE: using the cached data set/data key lock so only compute or mods to this data key for this file will block another thread ReentrantLock lock = ProjectCachedData.fileCachedData(containingFile).getKeyLock(CACHED_LINKS); boolean cachedLinkAdded; try { lock.lock(); // FIX: markdown extensions can be added so this test is insufficient. need to test FileTypeRegistry for extension being markdown CachedLink cachedLink = CachedLink.cacheUndefinedLink(linkType, linkRefPathForCache, linkRef.isMarkdownExt()); cachedLinkAdded = cachedLinkData.addCachedLink(cachedLink); persistentLinks.addCachedLink(cachedLink); } finally { lock.unlock(); } if (cachedLinkAdded) { HelpersKt.debug(LOG_CACHE_DETAIL, () -> String.format("Add undefined cached link type: %s link: %s", linkType, linkRefPathForCache)); } } } } }
16,413
763
package org.batfish.question.differentialreachability; import com.google.auto.service.AutoService; import org.batfish.common.Answerer; import org.batfish.common.plugin.IBatfish; import org.batfish.common.plugin.Plugin; import org.batfish.datamodel.questions.Question; import org.batfish.question.QuestionPlugin; /** Plugin for answer {@link DifferentialReachabilityQuestion}. */ @AutoService(Plugin.class) public class DifferentialReachabilityPlugin extends QuestionPlugin { @Override protected Answerer createAnswerer(Question question, IBatfish batfish) { return new DifferentialReachabilityAnswerer(question, batfish); } @Override protected Question createQuestion() { return new DifferentialReachabilityQuestion(); } }
215
446
/* ======================================== * Pressure5 - Pressure5.h * Created 8/12/11 by SPIAdmin * Copyright (c) 2011 __MyCompanyName__, All rights reserved * ======================================== */ #ifndef __Pressure5_H #define __Pressure5_H #ifndef __audioeffect__ #include "audioeffectx.h" #endif #include <set> #include <string> #include <math.h> enum { kParamA = 0, kParamB = 1, kParamC = 2, kParamD = 3, kParamE = 4, kParamF = 5, kNumParameters = 6 }; // const int kNumPrograms = 0; const int kNumInputs = 2; const int kNumOutputs = 2; const unsigned long kUniqueId = 'prs5'; //Change this to what the AU identity is! class Pressure5 : public AudioEffectX { public: Pressure5(audioMasterCallback audioMaster); ~Pressure5(); virtual bool getEffectName(char* name); // The plug-in name virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg virtual bool getVendorString(char* text); // Vendor info virtual VstInt32 getVendorVersion(); // Version number virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); virtual void getProgramName(char *name); // read the name from the host virtual void setProgramName(char *name); // changes the name of the preset displayed in the host virtual VstInt32 getChunk (void** data, bool isPreset); virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); virtual float getParameter(VstInt32 index); // get the parameter value at the specified index virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) virtual void getParameterName(VstInt32 index, char *text); // name of the parameter virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value virtual VstInt32 canDo(char *text); private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; double muVary; double muAttack; double muNewSpeed; double muSpeedA; double muSpeedB; double muCoefficientA; double muCoefficientB; bool flip; //Pressure enum { fix_freq, fix_reso, fix_a0, fix_a1, fix_a2, fix_b1, fix_b2, fix_sL1, fix_sL2, fix_sR1, fix_sR2, fix_lastSampleL, fix_lastSampleR, fix_total }; long double fixA[fix_total]; long double fixB[fix_total]; //fixed frequency biquad filter for ultrasonics, stereo long double lastSampleL; long double intermediateL[16]; bool wasPosClipL; bool wasNegClipL; long double lastSampleR; long double intermediateR[16]; bool wasPosClipR; bool wasNegClipR; //Stereo ClipOnly2 double slewMax; //to adust mewiness uint32_t fpdL; uint32_t fpdR; //default stuff float A; float B; float C; float D; float E; float F; //parameters. Always 0-1, and we scale/alter them elsewhere. }; #endif
1,302
6,457
<gh_stars>1000+ // License: Apache 2.0. See LICENSE file in root directory. // Copyright(c) 2015 Intel Corporation. All Rights Reserved. #pragma once #include "types.h" #include "context-libusb.h" #include <chrono> #include <libusb.h> namespace librealsense { namespace platform { static usb_status libusb_status_to_rs(int sts) { switch (sts) { case LIBUSB_SUCCESS: return RS2_USB_STATUS_SUCCESS; case LIBUSB_ERROR_IO: return RS2_USB_STATUS_IO; case LIBUSB_ERROR_INVALID_PARAM: return RS2_USB_STATUS_INVALID_PARAM; case LIBUSB_ERROR_ACCESS: return RS2_USB_STATUS_ACCESS; case LIBUSB_ERROR_NO_DEVICE: return RS2_USB_STATUS_NO_DEVICE; case LIBUSB_ERROR_NOT_FOUND: return RS2_USB_STATUS_NOT_FOUND; case LIBUSB_ERROR_BUSY: return RS2_USB_STATUS_BUSY; case LIBUSB_ERROR_TIMEOUT: return RS2_USB_STATUS_TIMEOUT; case LIBUSB_ERROR_OVERFLOW: return RS2_USB_STATUS_OVERFLOW; case LIBUSB_ERROR_PIPE: return RS2_USB_STATUS_PIPE; case LIBUSB_ERROR_INTERRUPTED: return RS2_USB_STATUS_INTERRUPTED; case LIBUSB_ERROR_NO_MEM: return RS2_USB_STATUS_NO_MEM; case LIBUSB_ERROR_NOT_SUPPORTED: return RS2_USB_STATUS_NOT_SUPPORTED; case LIBUSB_ERROR_OTHER: return RS2_USB_STATUS_OTHER; default: return RS2_USB_STATUS_OTHER; } } class handle_libusb { public: handle_libusb(std::shared_ptr<usb_context> context, libusb_device* device, std::shared_ptr<usb_interface_libusb> interface) : _first_interface(interface), _context(context), _handle(nullptr) { auto sts = libusb_open(device, &_handle); if(sts != LIBUSB_SUCCESS) { auto rs_sts = libusb_status_to_rs(sts); std::stringstream msg; msg << "failed to open usb interface: " << (int)interface->get_number() << ", error: " << usb_status_to_string.at(rs_sts); LOG_ERROR(msg.str()); throw std::runtime_error(msg.str()); } claim_interface_or_throw(interface->get_number()); for(auto&& i : interface->get_associated_interfaces()) claim_interface_or_throw(i->get_number()); _context->start_event_handler(); } ~handle_libusb() { _context->stop_event_handler(); for(auto&& i : _first_interface->get_associated_interfaces()) libusb_release_interface(_handle, i->get_number()); libusb_close(_handle); } libusb_device_handle* get() { return _handle; } private: void claim_interface_or_throw(uint8_t interface) { auto rs_sts = claim_interface(interface); if(rs_sts != RS2_USB_STATUS_SUCCESS) throw std::runtime_error(to_string() << "Unable to claim interface " << (int)interface << ", error: " << usb_status_to_string.at(rs_sts)); } usb_status claim_interface(uint8_t interface) { //libusb_set_auto_detach_kernel_driver(h, true); if (libusb_kernel_driver_active(_handle, interface) == 1)//find out if kernel driver is attached if (libusb_detach_kernel_driver(_handle, interface) == 0)// detach driver from device if attached. LOG_DEBUG("handle_libusb - detach kernel driver"); auto sts = libusb_claim_interface(_handle, interface); if(sts != LIBUSB_SUCCESS) { auto rs_sts = libusb_status_to_rs(sts); LOG_ERROR("failed to claim usb interface: " << (int)interface << ", error: " << usb_status_to_string.at(rs_sts)); return rs_sts; } return RS2_USB_STATUS_SUCCESS; } std::shared_ptr<usb_context> _context; std::shared_ptr<usb_interface_libusb> _first_interface; libusb_device_handle* _handle; }; } }
2,269
454
import rdkit.Chem as Chem from rdkit.Chem import AllChem import autograd.numpy as np def smiles_to_fps(data, fp_length, fp_radius): return stringlist2intarray(np.array([smile_to_fp(s, fp_length, fp_radius) for s in data])) def smile_to_fp(s, fp_length, fp_radius): m = Chem.MolFromSmiles(s) return (AllChem.GetMorganFingerprintAsBitVect( m, fp_radius, nBits=fp_length)).ToBitString() def stringlist2intarray(A): '''This function will convert from a list of strings "10010101" into in integer numpy array.''' return np.array([list(s) for s in A], dtype=int)
235
852
<gh_stars>100-1000 #include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h" #include "FWCore/Utilities/interface/typelookup.h" TYPELOOKUP_DATA_REG(SiStripRecHitMatcher);
77
1,755
<filename>packages/seacas/libraries/exodus/src/ex_put_partial_attr.c /* * Copyright(C) 1999-2020 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * * See packages/seacas/LICENSE for details */ /***************************************************************************** * * expatt - ex_put_partial_attr * * entry conditions - * input parameters: * int exoid exodus file id * int blk_type block type * int blk_id block id * float* attrib array of attributes * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" // for ex_err, ex_name_of_object, etc #include "exodusII_int.h" // for ex__check_valid_file_id, etc /*! * writes the attributes for an edge/face/element block * \param exoid exodus file id * \param blk_type block type * \param blk_id block id * \param start_entity the starting index (1-based) of the attribute to be written * \param num_entity the number of entities to write attributes * \param attrib array of attributes */ int ex_put_partial_attr(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int64_t start_entity, int64_t num_entity, const void *attrib) { int status; int attrid; int blk_id_ndx = 0; int numattrdim; size_t start[2], count[2]; size_t num_attr; char errmsg[MAX_ERR_LENGTH]; EX_FUNC_ENTER(); if (ex__check_valid_file_id(exoid, __func__) == EX_FATAL) { EX_FUNC_LEAVE(EX_FATAL); } if (blk_type != EX_NODAL) { /* Determine index of blk_id in VAR_ID_EL_BLK array */ blk_id_ndx = ex__id_lkup(exoid, blk_type, blk_id); if (blk_id_ndx <= 0) { ex_get_err(NULL, NULL, &status); if (status != 0) { if (status == EX_NULLENTITY) { snprintf(errmsg, MAX_ERR_LENGTH, "Warning: no attributes allowed for NULL %s %" PRId64 " in file id %d", ex_name_of_object(blk_type), blk_id, exoid); ex_err_fn(exoid, __func__, errmsg, EX_NULLENTITY); EX_FUNC_LEAVE(EX_WARN); /* no attributes for this block */ } snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: no %s id %" PRId64 " in in file id %d", ex_name_of_object(blk_type), blk_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); EX_FUNC_LEAVE(EX_FATAL); } } } switch (blk_type) { case EX_SIDE_SET: status = nc_inq_varid(exoid, VAR_SSATTRIB(blk_id_ndx), &attrid); break; case EX_NODE_SET: status = nc_inq_varid(exoid, VAR_NSATTRIB(blk_id_ndx), &attrid); break; case EX_EDGE_SET: status = nc_inq_varid(exoid, VAR_ESATTRIB(blk_id_ndx), &attrid); break; case EX_FACE_SET: status = nc_inq_varid(exoid, VAR_FSATTRIB(blk_id_ndx), &attrid); break; case EX_ELEM_SET: status = nc_inq_varid(exoid, VAR_ELSATTRIB(blk_id_ndx), &attrid); break; case EX_NODAL: status = nc_inq_varid(exoid, VAR_NATTRIB, &attrid); break; case EX_EDGE_BLOCK: status = nc_inq_varid(exoid, VAR_EATTRIB(blk_id_ndx), &attrid); break; case EX_FACE_BLOCK: status = nc_inq_varid(exoid, VAR_FATTRIB(blk_id_ndx), &attrid); break; case EX_ELEM_BLOCK: status = nc_inq_varid(exoid, VAR_ATTRIB(blk_id_ndx), &attrid); break; default: snprintf(errmsg, MAX_ERR_LENGTH, "Internal ERROR: unrecognized object type in switch: %d in file id %d", blk_type, exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); EX_FUNC_LEAVE(EX_FATAL); /* number of attributes not defined */ } if (status != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to locate attribute variable for %s %" PRId64 " in file id %d", ex_name_of_object(blk_type), blk_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); EX_FUNC_LEAVE(EX_FATAL); } /* Determine number of attributes */ switch (blk_type) { case EX_SIDE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_SS(blk_id_ndx), &numattrdim); break; case EX_NODE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NS(blk_id_ndx), &numattrdim); break; case EX_EDGE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ES(blk_id_ndx), &numattrdim); break; case EX_FACE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FS(blk_id_ndx), &numattrdim); break; case EX_ELEM_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ELS(blk_id_ndx), &numattrdim); break; case EX_NODAL: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NBLK, &numattrdim); break; case EX_EDGE_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_EBLK(blk_id_ndx), &numattrdim); break; case EX_FACE_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx), &numattrdim); break; case EX_ELEM_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx), &numattrdim); break; default: /* No need for error message, handled in previous switch; just to quiet * compiler. */ EX_FUNC_LEAVE(EX_FATAL); } if (status != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: number of attributes not defined for %s %" PRId64 " in file id %d", ex_name_of_object(blk_type), blk_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); EX_FUNC_LEAVE(EX_FATAL); /* number of attributes not defined */ } if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get number of attributes for %s %" PRId64 " in file id %d", ex_name_of_object(blk_type), blk_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); EX_FUNC_LEAVE(EX_FATAL); } /* write out the attributes */ start[0] = --start_entity; start[1] = 0; count[0] = num_entity; count[1] = num_attr; if (count[0] == 0) { start[0] = 0; } if (ex__comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, attrid, start, count, attrib); } else { status = nc_put_vara_double(exoid, attrid, start, count, attrib); } if (status != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put attributes for %s %" PRId64 " in file id %d", ex_name_of_object(blk_type), blk_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); EX_FUNC_LEAVE(EX_FATAL); } EX_FUNC_LEAVE(EX_NOERR); }
3,139
1,305
<gh_stars>1000+ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ /* ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) <NAME>, 1997 *** *** As an unpublished work pursuant to Title 17 of the United *** *** States Code. All rights reserved. *** ********************************************************************** ********************************************************************** **********************************************************************/ package java.awt.color; import sun.java2d.cmm.Profile; import sun.java2d.cmm.ProfileDeferralInfo; /** * * The ICC_ProfileRGB class is a subclass of the ICC_Profile class * that represents profiles which meet the following criteria: * <ul> * <li>The profile's color space type is RGB.</li> * <li>The profile includes the <code>redColorantTag</code>, * <code>greenColorantTag</code>, <code>blueColorantTag</code>, * <code>redTRCTag</code>, <code>greenTRCTag</code>, * <code>blueTRCTag</code>, and <code>mediaWhitePointTag</code> tags.</li> * </ul> * The <code>ICC_Profile</code> <code>getInstance</code> method will * return an <code>ICC_ProfileRGB</code> object when these conditions are met. * Three-component, matrix-based input profiles and RGB display profiles are * examples of this type of profile. * <p> * This profile class provides color transform matrices and lookup tables * that Java or native methods can use directly to * optimize color conversion in some cases. * <p> * To transform from a device profile color space to the CIEXYZ Profile * Connection Space, each device color component is first linearized by * a lookup through the corresponding tone reproduction curve (TRC). * The resulting linear RGB components are converted to the CIEXYZ PCS * using a a 3x3 matrix constructed from the RGB colorants. * <pre> * * &nbsp; linearR = redTRC[deviceR] * * &nbsp; linearG = greenTRC[deviceG] * * &nbsp; linearB = blueTRC[deviceB] * * &nbsp; _ _ _ _ _ _ * &nbsp;[ PCSX ] [ redColorantX greenColorantX blueColorantX ] [ linearR ] * &nbsp;[ ] [ ] [ ] * &nbsp;[ PCSY ] = [ redColorantY greenColorantY blueColorantY ] [ linearG ] * &nbsp;[ ] [ ] [ ] * &nbsp;[_ PCSZ _] [_ redColorantZ greenColorantZ blueColorantZ _] [_ linearB _] * * </pre> * The inverse transform is performed by converting PCS XYZ components to linear * RGB components through the inverse of the above 3x3 matrix, and then converting * linear RGB to device RGB through inverses of the TRCs. */ public class ICC_ProfileRGB extends ICC_Profile { static final long serialVersionUID = 8505067385152579334L; /** * Used to get a gamma value or TRC for the red component. */ public static final int REDCOMPONENT = 0; /** * Used to get a gamma value or TRC for the green component. */ public static final int GREENCOMPONENT = 1; /** * Used to get a gamma value or TRC for the blue component. */ public static final int BLUECOMPONENT = 2; /** * Constructs an new <code>ICC_ProfileRGB</code> from a CMM ID. * * @param p The CMM ID for the profile. * */ ICC_ProfileRGB(Profile p) { super(p); } /** * Constructs a new <code>ICC_ProfileRGB</code> from a * ProfileDeferralInfo object. * * @param pdi */ ICC_ProfileRGB(ProfileDeferralInfo pdi) { super(pdi); } /** * Returns an array that contains the components of the profile's * <CODE>mediaWhitePointTag</CODE>. * * @return A 3-element <CODE>float</CODE> array containing the x, y, * and z components of the profile's <CODE>mediaWhitePointTag</CODE>. */ public float[] getMediaWhitePoint() { return super.getMediaWhitePoint(); } /** * Returns a 3x3 <CODE>float</CODE> matrix constructed from the * X, Y, and Z components of the profile's <CODE>redColorantTag</CODE>, * <CODE>greenColorantTag</CODE>, and <CODE>blueColorantTag</CODE>. * <p> * This matrix can be used for color transforms in the forward * direction of the profile--from the profile color space * to the CIEXYZ PCS. * * @return A 3x3 <CODE>float</CODE> array that contains the x, y, and z * components of the profile's <CODE>redColorantTag</CODE>, * <CODE>greenColorantTag</CODE>, and <CODE>blueColorantTag</CODE>. */ public float[][] getMatrix() { float[][] theMatrix = new float[3][3]; float[] tmpMatrix; tmpMatrix = getXYZTag(ICC_Profile.icSigRedColorantTag); theMatrix[0][0] = tmpMatrix[0]; theMatrix[1][0] = tmpMatrix[1]; theMatrix[2][0] = tmpMatrix[2]; tmpMatrix = getXYZTag(ICC_Profile.icSigGreenColorantTag); theMatrix[0][1] = tmpMatrix[0]; theMatrix[1][1] = tmpMatrix[1]; theMatrix[2][1] = tmpMatrix[2]; tmpMatrix = getXYZTag(ICC_Profile.icSigBlueColorantTag); theMatrix[0][2] = tmpMatrix[0]; theMatrix[1][2] = tmpMatrix[1]; theMatrix[2][2] = tmpMatrix[2]; return theMatrix; } /** * Returns a gamma value representing the tone reproduction curve * (TRC) for a particular component. The component parameter * must be one of REDCOMPONENT, GREENCOMPONENT, or BLUECOMPONENT. * <p> * If the profile * represents the TRC for the corresponding component * as a table rather than a single gamma value, an * exception is thrown. In this case the actual table * can be obtained through the {@link #getTRC(int)} method. * When using a gamma value, * the linear component (R, G, or B) is computed as follows: * <pre> * * &nbsp; gamma * &nbsp; linearComponent = deviceComponent * *</pre> * @param component The <CODE>ICC_ProfileRGB</CODE> constant that * represents the component whose TRC you want to retrieve * @return the gamma value as a float. * @exception ProfileDataException if the profile does not specify * the corresponding TRC as a single gamma value. */ public float getGamma(int component) { float theGamma; int theSignature; switch (component) { case REDCOMPONENT: theSignature = ICC_Profile.icSigRedTRCTag; break; case GREENCOMPONENT: theSignature = ICC_Profile.icSigGreenTRCTag; break; case BLUECOMPONENT: theSignature = ICC_Profile.icSigBlueTRCTag; break; default: throw new IllegalArgumentException("Must be Red, Green, or Blue"); } theGamma = super.getGamma(theSignature); return theGamma; } /** * Returns the TRC for a particular component as an array. * Component must be <code>REDCOMPONENT</code>, * <code>GREENCOMPONENT</code>, or <code>BLUECOMPONENT</code>. * Otherwise the returned array * represents a lookup table where the input component value * is conceptually in the range [0.0, 1.0]. Value 0.0 maps * to array index 0 and value 1.0 maps to array index length-1. * Interpolation might be used to generate output values for * input values that do not map exactly to an index in the * array. Output values also map linearly to the range [0.0, 1.0]. * Value 0.0 is represented by an array value of 0x0000 and * value 1.0 by 0xFFFF. In other words, the values are really unsigned * <code>short</code> values even though they are returned in a * <code>short</code> array. * * If the profile has specified the corresponding TRC * as linear (gamma = 1.0) or as a simple gamma value, this method * throws an exception. In this case, the {@link #getGamma(int)} * method should be used to get the gamma value. * * @param component The <CODE>ICC_ProfileRGB</CODE> constant that * represents the component whose TRC you want to retrieve: * <CODE>REDCOMPONENT</CODE>, <CODE>GREENCOMPONENT</CODE>, or * <CODE>BLUECOMPONENT</CODE>. * * @return a short array representing the TRC. * @exception ProfileDataException if the profile does not specify * the corresponding TRC as a table. */ public short[] getTRC(int component) { short[] theTRC; int theSignature; switch (component) { case REDCOMPONENT: theSignature = ICC_Profile.icSigRedTRCTag; break; case GREENCOMPONENT: theSignature = ICC_Profile.icSigGreenTRCTag; break; case BLUECOMPONENT: theSignature = ICC_Profile.icSigBlueTRCTag; break; default: throw new IllegalArgumentException("Must be Red, Green, or Blue"); } theTRC = super.getTRC(theSignature); return theTRC; } }
3,795
3,428
<reponame>ghalimi/stdlib<gh_stars>1000+ {"id":"01153","group":"easy-ham-2","checksum":{"type":"MD5","value":"8f1eda9dda5ecf5698e94a08217173b1"},"text":"From <EMAIL> Tue Jul 23 10:55:58 2002\nReturn-Path: <<EMAIL>>\nDelivered-To: <EMAIL>.com\nReceived: from localhost (localhost [127.0.0.1])\n\tby phobos.labs.netnoteinc.com (Postfix) with ESMTP id 9E10F440CD\n\tfor <jm@localhost>; Tue, 23 Jul 2002 05:55:58 -0400 (EDT)\nReceived: from dogma.slashnull.org [2192.168.3.115]\n\tby localhost with IMAP (fetchmail-5.9.0)\n\tfor jm@localhost (single-drop); Tue, 23 Jul 2002 10:55:58 +0100 (IST)\nReceived: from egwn.net (ns2.egwn.net [172.16.58.3]) by\n dogma.slashnull.org (8.11.6/8.11.6) with ESMTP id g6N9v6407760 for\n <<EMAIL>>; Tue, 23 Jul 2002 10:57:06 +0100\nReceived: from auth02.nl.egwn.net (localhost [127.0.0.1]) by egwn.net\n (8.11.6/8.11.6/EGWN) with ESMTP id g6N9q3C27992; Tue, 23 Jul 2002 11:52:04\n +0200\nReceived: from python (gw01.es3.egwn.net [212.9.66.13]) (authenticated) by\n egwn.net (8.11.6/8.11.6/EGWN) with ESMTP id g6N9peC27840 for\n <<EMAIL>>; Tue, 23 Jul 2002 11:51:41 +0200\nFrom: <NAME> <<EMAIL>>\nTo: <EMAIL>\nSubject: Re: central management\nMessage-Id: <<EMAIL>>\nIn-Reply-To: <<EMAIL>>\nReferences: <<EMAIL>>\n <<EMAIL>>\nOrganization: Electronic Group Interactive\nX-Mailer: Sylpheed version 0.7.8claws (GTK+ 1.2.10; i386-redhat-linux)\nReply-BY: Tue, 24 Jul 2000 19:02:00 +1000\nX-Operating-System: GNU/Linux power!\nX-Message-Flag: Try using a real operating system : GNU/Linux power!\nMIME-Version: 1.0\nContent-Type: text/plain; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\nX-Mailscanner: Found to be clean, Found to be clean\nSender: <EMAIL>\nErrors-To: <EMAIL>\nX-Beenthere: [email protected]\nX-Mailman-Version: 2.0.11\nPrecedence: bulk\nReply-To: <EMAIL>\nList-Help: <mailto:<EMAIL>?subject=help>\nList-Post: <mailto:<EMAIL>>\nList-Subscribe: <http://lists.freshrpms.net/mailman/listinfo/rpm-zzzlist>,\n <mailto:<EMAIL>?subject=subscribe>\nList-Id: Freshrpms RPM discussion list <rpm-zzzlist.freshrpms.net>\nList-Unsubscribe: <http://lists.freshrpms.net/mailman/listinfo/rpm-zzzlist>,\n <mailto:<EMAIL>?subject=unsubscribe>\nList-Archive: <http://lists.freshrpms.net/pipermail/rpm-zzzlist/>\nX-Original-Date: Tue, 23 Jul 2002 11:50:21 +0200\nDate: Tue, 23 Jul 2002 11:50:21 +0200\n\nOnce upon a time, Brian wrote :\n\n> I was thinkinf about an addition of another file: apt-repositories.\n> Stick it on apt.freshmeat.net (the center of the apt universe, IMHO)\n> and every time a new repository is added, the RPM can be rebuilt. \n> Heck, if I could get out of my depression, I could make the whole\n> submission process automated....even making the RPM...\n\nWell, I already keep a list of known apt repositories on\nhttp://freshrpms.net/apt/ although I haven't added the ones that were\ntalked about lately (actually I've been very busy over the week-end and I'm\nsick right now...).\n\nYou could make the whole submission automated, even making the rpm?\n<subliminal message>\nhttp://rpmforge.net/ needs *you*!\n</subliminal message>\n\nMatthias\n\n-- \n<NAME> World Trade Center\n------------- Edificio Norte 4 Planta\nSystem and Network Engineer 08039 Barcelona, Spain\nElectronic Group Interactive Phone : +34 936 00 23 23\n\n_______________________________________________\nRPM-List mailing list <<EMAIL>>\nhttp://lists.freshrpms.net/mailman/listinfo/rpm-list\n\n\n"}
1,464
712
<gh_stars>100-1000 # Copyright 2018-2020 Xanadu Quantum Technologies 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. """ Tests for the templates utility functions. """ # pylint: disable=protected-access,cell-var-from-loop import pytest import numpy as np from pennylane.templates.utils import ( check_wires, check_shape, check_shapes, get_shape, check_number_of_layers, check_is_in_options, check_type, ) ######################################### # Inputs WIRES_PASS = [(0, [0]), ([4], [4]), ([1, 2], [1, 2])] WIRES_FAIL = [[-1], ["a"], lambda x: x, None] SHAPE_PASS = [ (0.231, (), None), ([[1.0, 2.0], [3.0, 4.0]], (2, 2), None), ([-2.3], (1,), None), ([-2.3, 3.4], (4,), "max"), ([-2.3, 3.4], (1,), "min"), ([-2.3], (1,), "max"), ([-2.3], (1,), "min"), ([[-2.3, 3.4], [1.0, 0.2]], (3, 3), "max"), ([[-2.3, 3.4, 1.0], [1.0, 0.2, 1.0]], (1, 2), "min"), ] SHAPE_LST_PASS = [ ([0.231, 0.1], [(), ()], None), ([[1.0, 2.0], [4.0]], [(2,), (1,)], None), ([[-2.3], -1.0], [(1,), ()], None), ([[-2.3, 0.1], -1.0], [(1,), ()], "min"), ([[-2.3, 0.1], -1.0], [(3,), ()], "max"), ] SHAPE_FAIL = [ (0.231, (1,), None), ([[1.0, 2.0], [3.0, 4.0]], (2,), None), ([-2.3], (4, 5), None), ([-2.3, 3.4], (4,), "min"), ([-2.3, 3.4], (1,), "max"), ([[-2.3, 3.4], [1.0, 0.2]], (3, 3), "min"), ([[-2.3, 3.4, 1.0], [1.0, 0.2, 1.0]], (1, 2), "max"), ] GET_SHAPE_PASS = [ (0.231, ()), (complex(1, 0), ()), (1, ()), ([[1.0, 2.0], [3.0, 4.0]], (2, 2)), ([-2.3], (1,)), ([-2.3, 3.4], (2,)), ([-2.3], (1,)), ([[-2.3, 3.4, 1.0], [1.0, 0.2, 1.0]], (2, 3)), ] GET_SHAPE_FAIL = [("a",), (None,)] SHAPE_LST_FAIL = [ ([[0.231, 0.1]], [[()], [(3, 4)]], None), ([[1.0, 2.0], [4.0]], [(1,), (1,)], None), ([[-2.3], -1.0], [(1, 2), (1,)], None), ([[-2.3, 0.1], -1.0], [(1,), ()], "max"), ([[-2.3, 0.1], -1.0], [(3,), ()], "min"), ] LAYERS_PASS = [ ([[1], [2], [3]], 1), ([[[1], [2], [3]], [[1], [2], [3]]], 3), ] LAYERS_FAIL = [ ([[[1], [2], [3]], 1], 5), ([[[1], [2], [3]], [[1], [2]]], 4), ] OPTIONS_PASS = [("a", ["a", "b"])] OPTIONS_FAIL = [("c", ["a", "b"])] TYPE_PASS = [ (["a"], list, type(None)), (1, int, type(None)), ("a", int, str), ] TYPE_FAIL = [ ("a", list, type(None)), (type(None), int, list), ] ############################## class TestInputChecks: """Test private functions that check the input of templates.""" @pytest.mark.parametrize("wires, target", WIRES_PASS) def test_check_wires(self, wires, target): """Tests that wires check returns correct wires list and its length.""" res = check_wires(wires=wires) assert res == target @pytest.mark.parametrize("wires", WIRES_FAIL) def test_check_wires_exception(self, wires): """Tests that wires check fails if ``wires`` is not a positive integer or iterable of positive integers.""" with pytest.raises(ValueError, match="wires must be a positive integer"): check_wires(wires=wires) @pytest.mark.parametrize("inpt, target_shape", GET_SHAPE_PASS) def test_get_shape(self, inpt, target_shape): """Tests that ``get_shape`` returns correct shape.""" shape = get_shape(inpt) assert shape == target_shape @pytest.mark.parametrize("inpt", GET_SHAPE_FAIL) def test_get_shape_exception(self, inpt): """Tests that ``get_shape`` fails if unkown type of arguments.""" with pytest.raises(ValueError, match="could not extract shape of object"): get_shape(inpt) @pytest.mark.parametrize("inpt, target_shape, bound", SHAPE_PASS) def test_check_shape(self, inpt, target_shape, bound): """Tests that shape check succeeds for valid arguments.""" check_shape(inpt, target_shape, bound=bound, msg="XXX") @pytest.mark.parametrize("inpt, target_shape, bound", SHAPE_LST_PASS) def test_check_shape_list_of_inputs(self, inpt, target_shape, bound): """Tests that list version of shape check succeeds for valid arguments.""" check_shapes(inpt, target_shape, bounds=[bound] * len(inpt), msg="XXX") @pytest.mark.parametrize("inpt, target_shape, bound", SHAPE_FAIL) def test_check_shape_exception(self, inpt, target_shape, bound): """Tests that shape check fails for invalid arguments.""" with pytest.raises(ValueError, match="XXX"): check_shape(inpt, target_shape, bound=bound, msg="XXX") @pytest.mark.parametrize("inpt, target_shape, bound", SHAPE_LST_FAIL) def test_check_shape_list_of_inputs_exception(self, inpt, target_shape, bound): """Tests that list version of shape check succeeds for valid arguments.""" with pytest.raises(ValueError, match="XXX"): check_shapes(inpt, target_shape, bounds=[bound] * len(inpt), msg="XXX") @pytest.mark.parametrize("hp, opts", OPTIONS_PASS) def test_check_options(self, hp, opts): """Tests that option check succeeds for valid arguments.""" check_is_in_options(hp, opts, msg="XXX") @pytest.mark.parametrize("hp, opts", OPTIONS_FAIL) def test_check_options_exception(self, hp, opts): """Tests that option check throws error for invalid arguments.""" with pytest.raises(ValueError, match="XXX"): check_is_in_options(hp, opts, msg="XXX") @pytest.mark.parametrize("hp, typ, alt", TYPE_PASS) def test_check_type(self, hp, typ, alt): """Tests that type check succeeds for valid arguments.""" check_type(hp, [typ, alt], msg="XXX") @pytest.mark.parametrize("hp, typ, alt", TYPE_FAIL) def test_check_type_exception(self, hp, typ, alt): """Tests that type check throws error for invalid arguments.""" with pytest.raises(ValueError, match="XXX"): check_type(hp, [typ, alt], msg="XXX") @pytest.mark.parametrize("inpt, repeat", LAYERS_PASS) def test_check_num_layers(self, inpt, repeat): """Tests that layer check returns correct number of layers.""" n_layers = check_number_of_layers(inpt) assert n_layers == repeat @pytest.mark.parametrize("inpt, repeat", LAYERS_FAIL) def test_check_num_layers_exception(self, inpt, repeat): """Tests that layer check throws exception if number of layers not consistent.""" with pytest.raises(ValueError, match="The first dimension of all parameters"): check_number_of_layers(inpt)
3,085
550
<filename>play-1.2.4/framework/src/play/data/binding/types/DateBinder.java package play.data.binding.types; import play.data.binding.TypeBinder; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import play.data.binding.AnnotationHelper; import play.libs.I18N; /** * Binder that support Date class. */ public class DateBinder implements TypeBinder<Date> { public static final String ISO8601 = "'ISO8601:'yyyy-MM-dd'T'HH:mm:ssZ"; public Date bind(String name, Annotation[] annotations, String value, Class actualClass, Type genericType) throws Exception { if (value == null || value.trim().length() == 0) { return null; } Date date = AnnotationHelper.getDateAs(annotations, value); if (date != null) { return date; } try { SimpleDateFormat sdf = new SimpleDateFormat(I18N.getDateFormat()); sdf.setLenient(false); return sdf.parse(value); } catch (ParseException e) { // Ignore } try { SimpleDateFormat sdf = new SimpleDateFormat(ISO8601); sdf.setLenient(false); return sdf.parse(value); } catch (Exception e) { throw new IllegalArgumentException("Cannot convert [" + value + "] to a Date: " + e.toString()); } } }
598
363
<filename>app/src/main/java/cn/sddman/download/thread/UpdatePlayUIProcess.java package cn.sddman.download.thread; import android.os.Handler; import android.os.Message; import com.aplayer.aplayerandroid.APlayerAndroid; import cn.sddman.download.common.Const; import cn.sddman.download.mvp.v.PlayerView; public class UpdatePlayUIProcess implements Runnable { private PlayerView playerView; private Handler handler; private APlayerAndroid aPlayer; public UpdatePlayUIProcess(PlayerView playerView, Handler handler,APlayerAndroid aPlayer){ this.playerView=playerView; this.handler=handler; this.aPlayer=aPlayer; } @Override public void run() { while (playerView.ismIsNeedUpdateUIProgress()) { if (!playerView.ismIsTouchingSeekbar()) { int currentPlayTime = 0; int durationTime = 0; if (null != aPlayer) { currentPlayTime = aPlayer.getPosition(); durationTime = aPlayer.getDuration(); } Message msg = handler.obtainMessage(Const.UI_UPDATE_PLAY_STATION, currentPlayTime, durationTime); handler.sendMessage(msg); } try { Thread.sleep(Const.TIMER_UPDATE_INTERVAL_TIME); } catch (InterruptedException e) { } } } }
609
1,350
<gh_stars>1000+ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.synapse.generated; import com.azure.core.util.Context; import com.azure.resourcemanager.synapse.models.GeoBackupPolicyName; /** Samples for SqlPoolGeoBackupPolicies Get. */ public final class SqlPoolGeoBackupPoliciesGetSamples { /* * x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/GetSqlPoolGeoBackupPolicy.json */ /** * Sample code: Get Sql pool geo backup policy. * * @param manager Entry point to SynapseManager. */ public static void getSqlPoolGeoBackupPolicy(com.azure.resourcemanager.synapse.SynapseManager manager) { manager .sqlPoolGeoBackupPolicies() .getWithResponse( "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE); } }
387
319
<reponame>marek-trmac/pycycle __author__ = 'wutwut'
25
868
<gh_stars>100-1000 // Copyright (C) 2019 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. #ifndef FLARE_BASE_ENDIAN_H_ #define FLARE_BASE_ENDIAN_H_ #ifdef _MSC_VER #include <stdlib.h> // `_byteswap_*` #endif #include <cstddef> #include <cstdint> // Per [spec](https://en.cppreference.com/w/cpp/types/endian) `std::endian` is // defined in `<bit>`, but GCC 8.2 does not have this header yet. (Neither does // MSVC 16.3) #if __has_include(<bit>) #include <bit> #else #include <type_traits> // `std::endian` is here in earlier compilers. #endif namespace flare { namespace endian { namespace detail { // For all types not overloaded explicitly, we'll raise an error here. template <class T> T SwapEndian(T) = delete; inline std::byte SwapEndian(std::byte v) { return v; } inline std::int8_t SwapEndian(std::int8_t v) { return v; } inline std::uint8_t SwapEndian(std::uint8_t v) { return v; } #ifdef _MSC_VER inline std::int16_t SwapEndian(std::int16_t v) { return _byteswap_ushort(v); } inline std::int32_t SwapEndian(std::int32_t v) { return _byteswap_ulong(v); } inline std::int64_t SwapEndian(std::int64_t v) { return _byteswap_uint64(v); } inline std::uint16_t SwapEndian(std::uint16_t v) { return _byteswap_ushort(v); } inline std::uint32_t SwapEndian(std::uint32_t v) { return _byteswap_ulong(v); } inline std::uint64_t SwapEndian(std::uint64_t v) { return _byteswap_uint64(v); } #else inline std::int16_t SwapEndian(std::int16_t v) { return __builtin_bswap16(v); } inline std::int32_t SwapEndian(std::int32_t v) { return __builtin_bswap32(v); } inline std::int64_t SwapEndian(std::int64_t v) { return __builtin_bswap64(v); } inline std::uint16_t SwapEndian(std::uint16_t v) { return __builtin_bswap16(v); } inline std::uint32_t SwapEndian(std::uint32_t v) { return __builtin_bswap32(v); } inline std::uint64_t SwapEndian(std::uint64_t v) { return __builtin_bswap64(v); } #endif } // namespace detail // Convert `T` between big endian and native endian. // // `T` must be specify explicitly so as not to introduce unintended implicit // type conversion. // // If `v` is a big endian value, a native endian one is returned. If `v` is a // native endian one, a big endian one is returned. template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline T SwapForBigEndian(std::common_type_t<T> v) { if constexpr (std::endian::native == std::endian::big) { return v; } else { return detail::SwapEndian(v); } } // Convert `T` between little endian and native endian. template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline T SwapForLittleEndian(std::common_type_t<T> v) { if constexpr (std::endian::native == std::endian::little) { return v; } else { return detail::SwapEndian(v); } } } // namespace endian // Convert native endian to big endian. // // `T` must be specify explicitly so as not to introduce unintended implicit // type conversion. template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline auto FromBigEndian(std::common_type_t<T> v) { return endian::SwapForBigEndian<T>(v); } // Convert big endian to native endian. template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline auto ToBigEndian(std::common_type_t<T> v) { return endian::SwapForBigEndian<T>(v); } // Convert native endian to little endian. template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline auto FromLittleEndian(std::common_type_t<T> v) { return endian::SwapForLittleEndian<T>(v); } // Convert little endian to native endian. template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline auto ToLittleEndian(std::common_type_t<T> v) { return endian::SwapForLittleEndian<T>(v); } // Inplace version of conversions above. // // For inplace version, we do not require the caller to specify `T` explicitly // as the output & input type are guaranteed to be the same (i.e., `T`). template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline void FromBigEndian(T* v) { *v = FromBigEndian<T>(*v); } template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline void ToBigEndian(T* v) { *v = ToBigEndian<T>(*v); } template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline void FromLittleEndian(T* v) { *v = FromLittleEndian<T>(*v); } template <class T, class = std::enable_if_t<std::is_integral_v<T>>> inline void ToLittleEndian(T* v) { *v = ToLittleEndian<T>(*v); } // BigToNative / NativeToBig? Why would you want that anyway? } // namespace flare #endif // FLARE_BASE_ENDIAN_H_
1,901
2,151
<gh_stars>1000+ # 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. import os import unittest from telemetry import decorators from telemetry.core import util from core import find_dependencies class FindDependenciesTest(unittest.TestCase): @decorators.Disabled('chromeos') # crbug.com/818230 def testFindPythonDependencies(self): try: dog_object_path = os.path.join( util.GetUnittestDataDir(), 'dependency_test_dir', 'dog', 'dog', 'dog_object.py') cat_module_path = os.path.join( util.GetUnittestDataDir(), 'dependency_test_dir', 'other_animals', 'cat', 'cat') cat_module_init_path = os.path.join(cat_module_path, '__init__.py') cat_object_path = os.path.join(cat_module_path, 'cat_object.py') self.assertEquals( set(p for p in find_dependencies.FindPythonDependencies(dog_object_path)), {dog_object_path, cat_module_path, cat_module_init_path, cat_object_path}) except ImportError: # crbug.com/559527 pass @decorators.Disabled('chromeos') # crbug.com/818230 def testFindPythonDependenciesWithNestedImport(self): try: moose_module_path = os.path.join( util.GetUnittestDataDir(), 'dependency_test_dir', 'other_animals', 'moose', 'moose') moose_object_path = os.path.join(moose_module_path, 'moose_object.py') horn_module_path = os.path.join(moose_module_path, 'horn') horn_module_init_path = os.path.join(horn_module_path, '__init__.py') horn_object_path = os.path.join(horn_module_path, 'horn_object.py') self.assertEquals( set(p for p in find_dependencies.FindPythonDependencies(moose_object_path)), {moose_object_path, horn_module_path, horn_module_init_path, horn_object_path}) except ImportError: # crbug.com/559527 pass
847
789
<reponame>advantageous/qbit<gh_stars>100-1000 package io.advantageous.qbit.service.discovery.impl; import io.advantageous.boon.core.IO; import io.advantageous.boon.core.Sys; import io.advantageous.boon.json.JsonSerializer; import io.advantageous.boon.json.JsonSerializerFactory; import io.advantageous.qbit.concurrent.PeriodicScheduler; import io.advantageous.qbit.service.discovery.*; import io.advantageous.qbit.service.discovery.spi.ServiceDiscoveryFileSystemProvider; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; import java.util.List; import java.util.UUID; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import static io.advantageous.boon.core.IO.puts; import static io.advantageous.qbit.service.discovery.EndpointDefinition.*; import static org.junit.Assert.assertEquals; /** * created by rick on 5/20/15. */ public class ServiceDiscoveryWithFileSystemTest { ServiceDiscovery serviceDiscovery; AtomicInteger servicePoolChangedCalled; AtomicInteger serviceAdded; AtomicInteger serviceRemoved; AtomicReference<String> servicePoolChangedServiceName; AtomicReference<String> servicePoolChangedServiceNameFromListener; File dir; ServiceChangedEventChannel eventChannel = new ServiceChangedEventChannel() { @Override public void servicePoolChanged(String serviceName) { servicePoolChangedCalled.incrementAndGet(); servicePoolChangedServiceName.set(serviceName); } }; ServicePoolListener servicePoolListener = new ServicePoolListener() { @Override public void servicePoolChanged(String serviceName) { servicePoolChangedServiceNameFromListener.set(serviceName); puts(serviceName); } @Override public void serviceAdded(String serviceName, EndpointDefinition endpointDefinition) { puts("serviceAdded", serviceName, serviceAdded.incrementAndGet()); } @Override public void serviceRemoved(String serviceName, EndpointDefinition endpointDefinition) { puts("serviceRemoved", serviceName); serviceRemoved.incrementAndGet(); } @Override public void servicesAdded(String serviceName, int count) { puts("servicesAdded", serviceName, count); } @Override public void servicesRemoved(String serviceName, int count) { puts("servicesRemoved", serviceName, count); } }; @Before public void setup() throws Exception { dir = File.createTempFile("testSome", "testSome").getParentFile(); servicePoolChangedCalled = new AtomicInteger(); serviceAdded = new AtomicInteger(); serviceRemoved = new AtomicInteger(); servicePoolChangedServiceName = new AtomicReference<>(); servicePoolChangedServiceNameFromListener = new AtomicReference<>(); ServiceDiscoveryFileSystemProvider provider = new ServiceDiscoveryFileSystemProvider(dir, 50); serviceDiscovery = ServiceDiscoveryBuilder.serviceDiscoveryBuilder() .setPeriodicScheduler(createPeriodicScheduler(10)) .setServiceChangedEventChannel(eventChannel) .setServicePoolListener(servicePoolListener) .setServiceDiscoveryProvider(provider) .setPollForServicesIntervalSeconds(1).build(); serviceDiscovery.start(); } @Test public void testNewServices() throws Exception { String serviceName = "fooBar"; EndpointDefinition endpointDefinition1 = serviceDefinition(serviceName, "host1"); EndpointDefinition endpointDefinition2 = serviceDefinition(serviceName, "host2"); EndpointDefinition endpointDefinition3 = serviceDefinition(serviceName, "host3"); List<EndpointDefinition> fooServices = serviceDefinitions( endpointDefinition1, endpointDefinition2, endpointDefinition3 ); write(fooServices); Sys.sleep(3_000); loadServices(serviceName); Sys.sleep(3_000); assertEquals(serviceName, servicePoolChangedServiceName.get()); assertEquals(serviceName, servicePoolChangedServiceNameFromListener.get()); } private void write(List<EndpointDefinition> fooServices) throws Exception { JsonSerializer jsonSerializer = new JsonSerializerFactory().create(); String json = jsonSerializer.serialize(fooServices).toString(); File outputFile = new File(dir, "fooBar.json"); IO.write(outputFile.toPath(), json); } @Test public void testAddThenRemove() throws Exception { String serviceName = "fooBar"; EndpointDefinition endpointDefinition1 = serviceDefinitionWithId(serviceName, "host1", UUID.randomUUID().toString()); EndpointDefinition endpointDefinition2 = serviceDefinitionWithId(serviceName, "host2", UUID.randomUUID().toString()); EndpointDefinition endpointDefinition3 = serviceDefinitionWithId(serviceName, "host3", UUID.randomUUID().toString()); EndpointDefinition endpointDefinition4 = serviceDefinitionWithId(serviceName, "host4", UUID.randomUUID().toString()); List<EndpointDefinition> fooServices = serviceDefinitions( endpointDefinition1, endpointDefinition2, endpointDefinition3 ); write(fooServices); loadServices(serviceName); /* Now remove one. */ serviceAdded.set(0); Sys.sleep(100); fooServices = serviceDefinitions( endpointDefinition1, endpointDefinition3 ); write(fooServices); Sys.sleep(2_000); loadServices(serviceName); assertEquals(1, serviceRemoved.get()); assertEquals(0, serviceAdded.get()); /* Now add the one we just removed back back and add another new one. */ serviceAdded.set(0); serviceRemoved.set(0); Sys.sleep(100); fooServices = serviceDefinitions( endpointDefinition1, endpointDefinition2, endpointDefinition3, endpointDefinition4 ); write(fooServices); Sys.sleep(2_000); loadServices(serviceName); assertEquals(0, serviceRemoved.get()); assertEquals(2, serviceAdded.get()); } private void loadServices(String serviceName) { for (int index = 0; index < 10; index++) { Sys.sleep(1000); final List<EndpointDefinition> endpointDefinitions = serviceDiscovery.loadServices(serviceName); puts(endpointDefinitions); if (endpointDefinitions.size() > 0) { break; } } Sys.sleep(100); } @After public void tearDown() { serviceDiscovery.stop(); } public PeriodicScheduler createPeriodicScheduler(int poolSize) { final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(poolSize, r -> { Thread thread = new Thread(r); thread.setDaemon(true); thread.setName("PeriodicTasks"); return thread; }); return new PeriodicScheduler() { @Override public ScheduledFuture repeat(Runnable runnable, int interval, TimeUnit timeUnit) { return scheduledExecutorService.scheduleAtFixedRate(runnable, interval, interval, timeUnit); } @Override public void start() { } @Override public void stop() { scheduledExecutorService.shutdown(); } }; } }
3,206
588
/*============================================================================= Library: CppMicroServices Copyright (c) The CppMicroServices developers. See the COPYRIGHT file at the top-level directory of this distribution and at https://github.com/CppMicroServices/CppMicroServices/COPYRIGHT . 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 "ReferenceManagerImpl.hpp" #include "cppmicroservices/ServiceReference.h" #include "cppmicroservices/logservice/LogService.hpp" #include "cppmicroservices/servicecomponent/ComponentConstants.hpp" namespace cppmicroservices { namespace scrimpl { using namespace cppmicroservices::logservice; void ReferenceManagerBaseImpl::BindingPolicyStaticGreedy::ServiceAdded( const ServiceReferenceBase& reference) { if (!reference) { Log("BindingPolicyStaticGreedy::ServiceAdded called with an invalid " "service reference"); return; } // If no service is bound, reactivate the component to bind to the better target service. // Otherwise, check if the service is a higher rank and if so, reactivate the component to bind // to the better target service auto replacementNeeded = false; ServiceReference<void> serviceToUnbind; if (mgr.IsSatisfied()) { // either a service is bound or the service reference is optional auto boundRefsHandle = mgr.boundRefs.lock(); // acquire lock on boundRefs if (boundRefsHandle->find(reference) == boundRefsHandle->end()) { // Means that reference is to a different service than what's bound, so unbind the // old service and then bind to the new service. if (!boundRefsHandle->empty()) { // We only need to unbind if there's actually a bound ref. const ServiceReferenceBase& minBound = *(boundRefsHandle->begin()); if (minBound < reference) { // And we only need to unbind if the new reference is a better match than the // current best match (i.e. boundRefs are stored in reverse order with the best // match in the first position). replacementNeeded = true; serviceToUnbind = minBound; // remember which service to unbind. } } else { // A replacement is needed if there are no bounds refs // and the service reference is optional. replacementNeeded = mgr.IsOptional(); } } } auto notifySatisfied = ShouldNotifySatisfied(); std::vector<RefChangeNotification> notifications; if (replacementNeeded) { Log("Notify UNSATISFIED for reference " + mgr.metadata.name); notifications.emplace_back( mgr.metadata.name, RefEvent::BECAME_UNSATISFIED, reference); // The following "clear and copy" strategy is sufficient for // updating the boundRefs for static binding policy if (serviceToUnbind) { ClearBoundRefs(); } notifySatisfied = mgr.UpdateBoundRefs(); } if (notifySatisfied) { Log("Notify SATISFIED for reference " + mgr.metadata.name); notifications.emplace_back( mgr.metadata.name, RefEvent::BECAME_SATISFIED, reference); } mgr.BatchNotifyAllListeners(notifications); } void ReferenceManagerBaseImpl::BindingPolicyStaticGreedy::ServiceRemoved( const ServiceReferenceBase& reference) { StaticRemoveService(reference); } } }
1,167
678
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/iPodUI.framework/iPodUI */ #import <iPodUI/iPodUI-Structs.h> #import <iPodUI/IUArrayCellConfiguration.h> @class UIColor, UIFont; @interface IUHyperlinkCellConfiguration : IUArrayCellConfiguration { CGSize _labelSize; // 80 = 0x50 UIColor *_titleColor; // 88 = 0x58 UIFont *_titleFont; // 92 = 0x5c UIColor *_titleShadowColor; // 96 = 0x60 } @property(retain, nonatomic) UIColor *titleShadowColor; // G=0x226b9; S=0x226c9; @synthesize=_titleShadowColor @property(retain, nonatomic) UIFont *titleFont; // G=0x226a9; S=0x22409; @synthesize=_titleFont @property(retain, nonatomic) UIColor *titleColor; // G=0x22675; S=0x22685; @synthesize=_titleColor + (BOOL)showsUntruncationCallout; // 0x2249d + (float)rowHeightForGlobalContext:(id)globalContext; // 0x221dd // declared property setter: - (void)setTitleShadowColor:(id)color; // 0x226c9 // declared property getter: - (id)titleShadowColor; // 0x226b9 // declared property getter: - (id)titleFont; // 0x226a9 // declared property setter: - (void)setTitleColor:(id)color; // 0x22685 // declared property getter: - (id)titleColor; // 0x22675 - (BOOL)getShadowColor:(id *)color offset:(CGSize *)offset forLabelAtIndex:(unsigned)index withModifiers:(unsigned)modifiers; // 0x22605 - (id)fontForLabelAtIndex:(unsigned)index; // 0x225f5 - (id)colorForLabelAtIndex:(unsigned)index withModifiers:(unsigned)modifiers; // 0x225bd - (void)reloadLayoutInformation; // 0x224a1 // declared property setter: - (void)setTitleFont:(id)font; // 0x22409 - (void)dealloc; // 0x22395 - (id)initWithTitle:(id)title; // 0x2220d - (id)init; // 0x221f9 @end
648
14,668
// 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. #ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_SCREEN_STATE_ENABLED_PROVIDER_H_ #define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_SCREEN_STATE_ENABLED_PROVIDER_H_ #include "ash/quick_pair/feature_status_tracker/base_enabled_provider.h" #include "base/scoped_observation.h" #include "ui/display/manager/display_configurator.h" namespace ash { namespace quick_pair { // Observes whether the screen state of any display is on. class ScreenStateEnabledProvider : public BaseEnabledProvider, public display::DisplayConfigurator::Observer { public: ScreenStateEnabledProvider(); ~ScreenStateEnabledProvider() override; // display::DisplayConfigurator::Observer void OnDisplayModeChanged( const display::DisplayConfigurator::DisplayStateList& display_states) override; private: base::ScopedObservation<display::DisplayConfigurator, display::DisplayConfigurator::Observer> configurator_observation_{this}; }; } // namespace quick_pair } // namespace ash #endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_SCREEN_STATE_ENABLED_PROVIDER_H_
436
396
<reponame>datastreaming/skyline-1 import logging import traceback from time import time from ast import literal_eval import settings from skyline_functions import get_redis_conn_decoded from functions.settings.get_custom_stale_period import custom_stale_period from functions.settings.get_external_settings import get_external_settings from functions.thunder.send_event import thunder_send_event # @added 20210603 - Branch #1444: thunder def thunder_no_data(current_skyline_app, log=True): """ Determine when a top level namespace stops receiving data. :param current_skyline_app: the app calling the function :param log: whether to log or not, optional, defaults to True :type current_skyline_app: str :type log: boolean :return: namespaces_no_data_dict :rtype: dict """ namespaces_no_data_dict = {} function_str = 'metrics_manager :: functions.thunder.no_data.thunder_no_data' if log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) else: current_logger = None now = int(time()) try: redis_conn_decoded = get_redis_conn_decoded(current_skyline_app) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get Redis connection - %s' % ( function_str, e)) return namespaces_no_data_dict metrics_last_timestamp_dict = {} hash_key = 'analyzer.metrics.last_timeseries_timestamp' try: metrics_last_timestamp_dict = redis_conn_decoded.hgetall(hash_key) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get Redis hash key %s - %s' % ( function_str, hash_key, e)) if not metrics_last_timestamp_dict: return namespaces_no_data_dict # @added 20210720 - Branch #1444: thunder # Remove any entries that have been specified remove_namespace = None remove_namespace_key = 'webapp.thunder.remove.namespace.metrics.last_timeseries_timestamp' try: remove_namespace = redis_conn_decoded.get(remove_namespace_key) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get Redis key %s - %s' % ( function_str, remove_namespace_key, e)) if remove_namespace: if log: current_logger.info('%s :: for removal of no_data on namespace %s requested' % ( function_str, remove_namespace)) try: redis_conn_decoded.delete(remove_namespace_key) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to delete Redis key %s - %s' % ( function_str, remove_namespace_key, e)) metrics_removed_from_key = [] for base_name in list(metrics_last_timestamp_dict.keys()): if base_name.startswith(remove_namespace): try: redis_conn_decoded.hdel(hash_key, base_name) metrics_removed_from_key.append(base_name) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to delete %s from Redis hash key %s - %s' % ( function_str, base_name, hash_key, e)) if log: current_logger.info('%s :: %s metrics for namesapce %s removed from Redis hash key %s' % ( function_str, len(metrics_removed_from_key), remove_namespace, hash_key)) if len(metrics_removed_from_key) > 0: level = 'notice' event_type = 'no_data' message = '%s - %s - was removed from the no_data check' % ( level, remove_namespace) status = 'removed' thunder_event = { 'level': level, 'event_type': event_type, 'message': message, 'app': current_skyline_app, 'metric': None, 'source': current_skyline_app, 'timestamp': time(), 'expiry': 59, 'data': { 'namespace': remove_namespace, 'last_timestamp': 0, 'recovered_after_seconds': 0, 'total_recent_metrics': 0, 'total_stale_metrics': 0, 'total_metrics': len(metrics_removed_from_key), 'status': status, }, } submitted = False try: submitted = thunder_send_event(current_skyline_app, thunder_event, log=True) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error('error :: %s :: error encountered with thunder_send_event - %s' % ( function_str, e)) if submitted: if log: current_logger.info('%s :: send thunder event for removal of no_data on namespace %s' % ( function_str, remove_namespace)) # Update with the new data metrics_last_timestamp_dict = {} try: metrics_last_timestamp_dict = redis_conn_decoded.hgetall(hash_key) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get Redis hash key %s - %s' % ( function_str, hash_key, e)) metrics_last_timestamps = [] parent_namespaces = [] unique_base_names = list(metrics_last_timestamp_dict.keys()) last_traceback = None last_error = None error_count = 0 for base_name in unique_base_names: try: parent_namespace = base_name.split('.')[0] metrics_last_timestamps.append([base_name, int(metrics_last_timestamp_dict[base_name])]) if len(parent_namespace) > 0: parent_namespaces.append(parent_namespace) except Exception as e: last_traceback = traceback.format_exc() last_error = e error_count += 1 if last_error: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error('error :: %s :: errors %s encounterd while creating metrics_last_timestamps, last reported error - %s' % ( function_str, str(error_count), last_error)) current_logger.error('error :: %s :: last reported Traceback' % ( function_str)) current_logger.error('%s' % (str(last_traceback))) external_settings = {} try: external_settings = get_external_settings(current_skyline_app) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: get_external_settings failed - %s' % ( function_str, e)) external_parent_namespaces_stale_periods = {} if external_settings: for config_id in list(external_settings.keys()): no_data_stale_period = None try: alert_on_no_data = external_settings[config_id]['alert_on_no_data']['enabled'] except KeyError: alert_on_no_data = False if alert_on_no_data: try: no_data_stale_period = external_settings[config_id]['alert_on_no_data']['stale_period'] except KeyError: no_data_stale_period = False namespace = None if no_data_stale_period: try: namespace = external_settings[config_id]['namespace'] except KeyError: namespace = False try: expiry = external_settings[config_id]['alert_on_no_data']['expiry'] except KeyError: expiry = 1800 if namespace and no_data_stale_period and expiry: external_parent_namespaces_stale_periods[parent_namespace] = {} external_parent_namespaces_stale_periods[parent_namespace]['stale_period'] = int(no_data_stale_period) external_parent_namespaces_stale_periods[parent_namespace]['expiry'] = int(expiry) external_parent_namespaces = [] if external_parent_namespaces: external_parent_namespaces = list(external_parent_namespaces.keys()) parent_namespaces = list(set(parent_namespaces)) # @added 20210620 - Branch #1444: thunder # Feature #4076: CUSTOM_STALE_PERIOD # Handle multi level namespaces # Sort the list by the namespaces with the most elements to the least as # first match wins parent_namespace_metrics_processed = [] custom_stale_period_namespaces = [] if settings.CUSTOM_STALE_PERIOD: custom_stale_period_namespaces = list(settings.CUSTOM_STALE_PERIOD.keys()) custom_stale_period_namespaces_elements_list = [] for custom_stale_period_namespace in custom_stale_period_namespaces: namespace_elements = len(custom_stale_period_namespace.split('.')) custom_stale_period_namespaces_elements_list.append([custom_stale_period_namespace, namespace_elements]) sorted_custom_stale_period_namespaces = sorted(custom_stale_period_namespaces_elements_list, key=lambda x: (x[1]), reverse=True) if sorted_custom_stale_period_namespaces: custom_stale_period_namespaces = [x[0] for x in sorted_custom_stale_period_namespaces] # Order by setting priority parent_namespaces = external_parent_namespaces + custom_stale_period_namespaces + parent_namespaces for parent_namespace in parent_namespaces: stale_period = int(settings.STALE_PERIOD) # Determine if there is a CUSTOM_STALE_PERIOD for the namespace namespace_stale_period = 0 try: # DEBUG # namespace_stale_period = custom_stale_period(current_skyline_app, parent_namespace, external_settings, log=False) namespace_stale_period = custom_stale_period(current_skyline_app, parent_namespace, external_settings, log=True) if namespace_stale_period: if namespace_stale_period != stale_period: if log: current_logger.info('%s :: \'%s.\' namespace has custom stale period of %s' % ( function_str, parent_namespace, str(namespace_stale_period))) stale_period = int(namespace_stale_period) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: failed running custom_stale_period - %s' % e) expiry = 1800 if log: current_logger.info('%s :: checking \'%s.\' namespace metrics are receiving data' % ( function_str, parent_namespace)) # If there is an external_settings entry for the namespace determine the # stale_period and expiry if parent_namespace in external_parent_namespaces: try: stale_period = external_parent_namespaces[parent_namespace]['stale_period'] except KeyError: stale_period = int(settings.STALE_PERIOD) if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.warn('warning :: %s :: failed to get the stale_period for %s from external_settings, using default' % ( function_str, parent_namespace)) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get stale_period for %s from external_settings - %s' % ( function_str, parent_namespace, e)) try: expiry = external_parent_namespaces[parent_namespace]['expiry'] except KeyError: expiry = 1800 if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.warn('warning :: %s :: failed to get the expiry for %s from external_settings, using default' % ( function_str, str(expiry))) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get expiry for %s from external_settings - %s' % ( function_str, parent_namespace, e)) if log: current_logger.info('%s :: \'%s.\' namespace using external_setting stale_period of %s and expiry of %s' % ( function_str, parent_namespace, str(stale_period), str(expiry))) # Allow to test thunder_test_alert_key_data = None thunder_test_alert_key = 'thunder.test.alert.no_data.%s' % parent_namespace try: thunder_test_alert_key_data = redis_conn_decoded.get(thunder_test_alert_key) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get Redis key %s - %s' % ( function_str, thunder_test_alert_key, e)) if thunder_test_alert_key_data: try: thunder_test_data = literal_eval(thunder_test_alert_key_data) stale_period = thunder_test_data['stale_period'] expiry = thunder_test_data['expiry'] if log: current_logger.info('%s :: THUNDER NO_DATA TEST REQUESTED FOR - \'%s.\' namespace using TEST stale_period of %s and expiry of %s' % ( function_str, parent_namespace, str(stale_period), str(expiry))) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get stale_period and expiry for Redis key %s - %s' % ( function_str, thunder_test_alert_key, e)) # metrics that are in the parent namespace parent_namespace_metrics = [item for item in metrics_last_timestamps if str(item[0]).startswith(parent_namespace)] # @added 20210620 - Branch #1444: thunder # Feature #4076: CUSTOM_STALE_PERIOD # Handle multi level namespaces by filtering out metrics that have # already been processed in a longer parent_namespace if log: current_logger.info('%s :: parent_namespace_metrics has %s metrics' % ( function_str, str(len(parent_namespace_metrics)))) parent_namespace_metrics = [item for item in parent_namespace_metrics if item[0] not in parent_namespace_metrics_processed] if parent_namespace_metrics: parent_namespace_metric_names = [item[0] for item in parent_namespace_metrics] parent_namespace_metrics_processed = parent_namespace_metrics_processed + parent_namespace_metric_names if log: current_logger.info('%s :: parent_namespace_metrics has %s metrics after filetring out processed metrics' % ( function_str, str(len(parent_namespace_metrics)))) total_metrics = len(parent_namespace_metrics) if parent_namespace_metrics: parent_namespace_metrics_timestamps = [int(item[1]) for item in parent_namespace_metrics] if parent_namespace_metrics_timestamps: parent_namespace_metrics_timestamps.sort() most_recent_timestamp = parent_namespace_metrics_timestamps[-1] last_received_seconds_ago = now - most_recent_timestamp if most_recent_timestamp < (now - stale_period): namespaces_no_data_dict[parent_namespace] = {} namespaces_no_data_dict[parent_namespace]['last_timestamp'] = most_recent_timestamp namespaces_no_data_dict[parent_namespace]['expiry'] = expiry namespaces_no_data_dict[parent_namespace]['total_recent_metrics'] = 0 namespaces_no_data_dict[parent_namespace]['total_stale_metrics'] = total_metrics namespaces_no_data_dict[parent_namespace]['total_metrics'] = total_metrics if thunder_test_alert_key_data: namespaces_no_data_dict[parent_namespace]['test'] = True else: namespaces_no_data_dict[parent_namespace]['test'] = False if log: current_logger.warn('warning :: %s :: %s \'%s.\' namespace metrics not receiving data, last data received %s seconds ago' % ( function_str, str(total_metrics), parent_namespace, str(last_received_seconds_ago))) else: if log: current_logger.info('%s :: \'%s.\' namespace metrics receiving data, last data received %s seconds ago - OK' % ( function_str, parent_namespace, str(last_received_seconds_ago))) # Alert recovered if thunder alert key exists thunder_alert_key_exists = False thunder_alert_key = 'thunder.alert.no_data.%s' % parent_namespace try: thunder_alert_key_exists = redis_conn_decoded.get(thunder_alert_key) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error(traceback.format_exc()) current_logger.error('error :: %s :: failed to get Redis key %s - %s' % ( function_str, thunder_alert_key, e)) if thunder_alert_key_exists: seconds_no_data = int(float(most_recent_timestamp)) - int(float(thunder_alert_key_exists)) stale_timestamps = [ts for ts in parent_namespace_metrics_timestamps if int(ts) < (now - stale_period)] total_stale_metrics = len(stale_timestamps) total_recent_metrics = total_metrics - total_stale_metrics parent_namespace_metrics if log: current_logger.info('%s :: recovery of no_data on namespace %s after %s seconds, with total_recent_metrics: %s, total_stale_metrics: %s, total_metrics: %s' % ( function_str, parent_namespace, str(seconds_no_data), str(total_recent_metrics), str(total_stale_metrics), str(total_metrics))) level = 'notice' event_type = 'no_data' message = '%s - %s - metric data being received recovered after %s seconds' % ( level, parent_namespace, str(seconds_no_data)) status = 'recovered' thunder_event = { 'level': level, 'event_type': event_type, 'message': message, 'app': current_skyline_app, 'metric': None, 'source': current_skyline_app, 'timestamp': time(), 'expiry': 59, 'data': { 'namespace': parent_namespace, 'last_timestamp': most_recent_timestamp, 'recovered_after_seconds': seconds_no_data, 'total_recent_metrics': total_recent_metrics, 'total_stale_metrics': total_stale_metrics, 'total_metrics': total_metrics, 'status': status, }, } submitted = False try: submitted = thunder_send_event(current_skyline_app, thunder_event, log=True) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error('error :: %s :: error encounterd with thunder_send_event - %s' % ( function_str, e)) if submitted: if log: current_logger.info('%s :: send thunder event for recovery of no_data on namespace %s after %s seconds' % ( function_str, parent_namespace, str(seconds_no_data))) if namespaces_no_data_dict: parent_namespaces = list(namespaces_no_data_dict.keys()) for parent_namespace in parent_namespaces: level = 'alert' event_type = 'no_data' message = '%s - %s - no metric data being received' % ( level, parent_namespace) status = 'All metrics stop receiving data' thunder_test_alert_key_data = False try: thunder_test_alert_key_data = namespaces_no_data_dict[parent_namespace]['test'] except KeyError: thunder_test_alert_key_data = False if thunder_test_alert_key_data: message = '%s - %s - no metric data being received - TEST' % ( level, parent_namespace) status = 'All metrics stop receiving data - TEST' thunder_event = { 'level': level, 'event_type': event_type, 'message': message, 'app': current_skyline_app, 'metric': None, 'source': current_skyline_app, 'timestamp': time(), 'expiry': namespaces_no_data_dict[parent_namespace]['expiry'], 'data': { 'namespace': parent_namespace, 'last_timestamp': namespaces_no_data_dict[parent_namespace]['last_timestamp'], 'total_recent_metrics': namespaces_no_data_dict[parent_namespace]['total_recent_metrics'], 'total_stale_metrics': namespaces_no_data_dict[parent_namespace]['total_stale_metrics'], 'total_metrics': namespaces_no_data_dict[parent_namespace]['total_metrics'], 'status': status, }, } submitted = False try: submitted = thunder_send_event(current_skyline_app, thunder_event, log=True) except Exception as e: if not log: current_skyline_app_logger = current_skyline_app + 'Log' current_logger = logging.getLogger(current_skyline_app_logger) current_logger.error('error :: %s :: error encounterd with thunder_send_event - %s' % ( function_str, e)) if submitted: if log: current_logger.info('%s :: send thunder event for no_data on namespace %s' % ( function_str, parent_namespace)) return namespaces_no_data_dict
13,050
369
<reponame>zuxqoj/cdap /* * Copyright © 2017 <NAME>, 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. */ package io.cdap.cdap.app.runtime.spark.python; import io.cdap.cdap.common.lang.jar.BundleJarUtil; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.zip.ZipOutputStream; /** * Helper class for PySpark execution. * * This class is intentionally written in this module and used by SparkRuntimeService, so that this module * jar is always getting included in distributed cache via dependency tracing. */ public final class PySparkUtil { /** * Create an archive file that contains all CDAP PySpark libraries. */ public static File createPySparkLib(File tempDir) throws IOException, URISyntaxException { // Find the python/cdap/pyspark/__init__.py file URL initPyURL = PySparkUtil.class.getClassLoader().getResource("cdap/pyspark/__init__.py"); if (initPyURL == null) { // This can't happen since we package the library throw new IOException("Missing CDAP cdap/pyspark/__init__.py from classloader"); } // If the scripts come from jar already, just return the jar file. // This is the case in normal CDAP distribution. if ("jar".equals(initPyURL.getProtocol())) { // A JAR URL is in the format of `jar:file:///jarpath!/pathtoentry` return new File(URI.create(initPyURL.getPath().substring(0, initPyURL.getPath().indexOf("!/")))); } // If the python script comes from file, create a zip file that has everything under it File libFile = new File(tempDir, "cdap-pyspark-lib.zip"); try (ZipOutputStream output = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(libFile)))) { // Directory pointing to "cdap/". File basePathDir = new File(initPyURL.toURI()).getParentFile().getParentFile(); BundleJarUtil.addToArchive(basePathDir, true, output); } return libFile; } }
819
1,299
/* * Copyright 2015 Netflix, 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. * */ package io.reactivex.netty.threads; import io.netty.channel.EventLoopGroup; import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.reactivex.netty.RxNetty; import java.util.concurrent.atomic.AtomicReference; /** * An implementation of {@link RxEventLoopProvider} that returns the same {@link EventLoopGroup} instance for both * client and server. */ public class SingleNioLoopProvider extends RxEventLoopProvider { private final EventLoopGroup eventLoop; private final EventLoopGroup clientEventLoop; private final EventLoopGroup parentEventLoop; private final AtomicReference<EventLoopGroup> nativeEventLoop; private final AtomicReference<EventLoopGroup> nativeClientEventLoop; private final AtomicReference<EventLoopGroup> nativeParentEventLoop; private final int parentEventLoopCount; private final int childEventLoopCount; public SingleNioLoopProvider() { this(Runtime.getRuntime().availableProcessors()); } public SingleNioLoopProvider(int threadCount) { eventLoop = new NioEventLoopGroup(threadCount, new RxDefaultThreadFactory("rxnetty-nio-eventloop")); clientEventLoop = new PreferCurrentEventLoopGroup(eventLoop); parentEventLoop = eventLoop; parentEventLoopCount = childEventLoopCount = threadCount; nativeEventLoop = new AtomicReference<>(); nativeClientEventLoop = new AtomicReference<>(); nativeParentEventLoop = nativeEventLoop; } public SingleNioLoopProvider(int parentEventLoopCount, int childEventLoopCount) { this.parentEventLoopCount = parentEventLoopCount; this.childEventLoopCount = childEventLoopCount; parentEventLoop = new NioEventLoopGroup(parentEventLoopCount, new RxDefaultThreadFactory("rxnetty-nio-eventloop")); eventLoop = new NioEventLoopGroup(childEventLoopCount, new RxDefaultThreadFactory("rxnetty-nio-eventloop")); clientEventLoop = new PreferCurrentEventLoopGroup(eventLoop); nativeParentEventLoop = new AtomicReference<>(); nativeEventLoop = new AtomicReference<>(); nativeClientEventLoop = new AtomicReference<>(); } @Override public EventLoopGroup globalClientEventLoop() { return clientEventLoop; } @Override public EventLoopGroup globalServerEventLoop() { return eventLoop; } @Override public EventLoopGroup globalServerParentEventLoop() { return parentEventLoop; } @Override public EventLoopGroup globalClientEventLoop(boolean nativeTransport) { if (nativeTransport && RxNetty.isUsingNativeTransport()) { return getNativeClientEventLoop(); } return globalClientEventLoop(); } @Override public EventLoopGroup globalServerEventLoop(boolean nativeTransport) { if (nativeTransport && RxNetty.isUsingNativeTransport()) { return getNativeEventLoop(); } return globalServerEventLoop(); } @Override public EventLoopGroup globalServerParentEventLoop(boolean nativeTransport) { if (nativeTransport && RxNetty.isUsingNativeTransport()) { return getNativeParentEventLoop(); } return globalServerParentEventLoop(); } private EventLoopGroup getNativeParentEventLoop() { if (nativeParentEventLoop == nativeEventLoop) { // Means using same event loop for acceptor and worker pool. return getNativeEventLoop(); } EventLoopGroup eventLoopGroup = nativeParentEventLoop.get(); if (null == eventLoopGroup) { EventLoopGroup newEventLoopGroup = new EpollEventLoopGroup(parentEventLoopCount, new RxDefaultThreadFactory( "rxnetty-epoll-eventloop")); if (!nativeParentEventLoop.compareAndSet(null, newEventLoopGroup)) { newEventLoopGroup.shutdownGracefully(); } } return nativeParentEventLoop.get(); } private EventLoopGroup getNativeEventLoop() { EventLoopGroup eventLoopGroup = nativeEventLoop.get(); if (null == eventLoopGroup) { EventLoopGroup newEventLoopGroup = new EpollEventLoopGroup(childEventLoopCount, new RxDefaultThreadFactory( "rxnetty-epoll-eventloop")); if (!nativeEventLoop.compareAndSet(null, newEventLoopGroup)) { newEventLoopGroup.shutdownGracefully(); } } return nativeEventLoop.get(); } private EventLoopGroup getNativeClientEventLoop() { EventLoopGroup eventLoopGroup = nativeClientEventLoop.get(); if (null == eventLoopGroup) { EventLoopGroup newEventLoopGroup = new EpollEventLoopGroup(childEventLoopCount, new RxDefaultThreadFactory( "rxnetty-epoll-eventloop")); newEventLoopGroup = new PreferCurrentEventLoopGroup(newEventLoopGroup); if (!nativeClientEventLoop.compareAndSet(null, newEventLoopGroup)) { newEventLoopGroup.shutdownGracefully(); } } return nativeClientEventLoop.get(); } }
2,233
1,210
/* * Tencent is pleased to support the open source community by making GameAISDK available. * This source code file is licensed under the GNU General Public License Version 3. * For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package. * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. */ #ifndef GAME_AI_SDK_IMGPROC_COMM_IMGREG_RECOGNIZER_CMULTCOLORVARREG_H_ #define GAME_AI_SDK_IMGPROC_COMM_IMGREG_RECOGNIZER_CMULTCOLORVARREG_H_ #include <string> #include <vector> #include "Comm/ImgReg/Recognizer/IComnBaseReg.h" #define DIRECTION_SIZE 12 // ************************************************************************************** // CMultColorVarReg Structure Define // ************************************************************************************** struct tagMultColorVarRegElement { std::string strImageFilePath; std::string szDirectionNames[DIRECTION_SIZE] = { "HurtDown", "HurtDownLeft", "HurtDownRight", "HurtUp", "HurtUpLeft", "HurtUpRight", "HurtLeft", "HurtLeftDown", "HurtLeftUp", "HurtRight", "HurtRightDown", "HurtRightUp" }; tagMultColorVarRegElement() { strImageFilePath = ""; } }; struct tagMultColorVarRegResult { int nState; float colorMeanVar[DIRECTION_SIZE]; tagMultColorVarRegResult() { nState = 0; } }; // ************************************************************************************** // CMultColorVarRegCalculate Class Define // ************************************************************************************** class CMultColorVarRegCalculate { public: CMultColorVarRegCalculate(); ~CMultColorVarRegCalculate(); int Initialize(const int nTaskID, const tagMultColorVarRegElement &stParam); int Predict(const cv::Mat &oSrcImg, const int nFrameIdx, tagMultColorVarRegResult &stResult); int Release(); private: int m_nTaskID; cv::Rect m_oROI; cv::Mat m_oTmplImg[DIRECTION_SIZE]; cv::Mat m_oTmplMask[DIRECTION_SIZE]; double m_szColorMean[DIRECTION_SIZE][3]; }; // ************************************************************************************** // CMultColorVarRegParam Class Define // ************************************************************************************** class CMultColorVarRegParam : public IComnBaseRegParam { public: CMultColorVarRegParam() { m_oVecElements.clear(); } virtual ~CMultColorVarRegParam() {} public: std::vector<tagMultColorVarRegElement> m_oVecElements; }; // ************************************************************************************** // CMultColorVarRegResult Class Define // ************************************************************************************** class CMultColorVarRegResult : public IComnBaseRegResult { public: CMultColorVarRegResult() { m_nResultNum = 0; } virtual ~CMultColorVarRegResult() {} void SetResult(tagMultColorVarRegResult szResults[], int *pResultNum) { m_nResultNum = *pResultNum; for (int i = 0; i < *pResultNum; i++) { m_szResults[i] = szResults[i]; } } tagMultColorVarRegResult* GetResult(int *pResultNum) { *pResultNum = m_nResultNum; return m_szResults; } private: int m_nResultNum; tagMultColorVarRegResult m_szResults[MAX_ELEMENT_SIZE]; }; // ************************************************************************************** // CMultColorVarReg Class Define // ************************************************************************************** class CMultColorVarReg : public IComnBaseReg { public: CMultColorVarReg(); ~CMultColorVarReg(); // interface virtual int Initialize(IRegParam *pParam); virtual int Predict(const tagRegData &stData, IRegResult *pResult); virtual int Release(); private: std::vector<tagMultColorVarRegElement> m_oVecParams; std::vector<CMultColorVarRegCalculate> m_oVecMethods; }; #endif // GAME_AI_SDK_IMGPROC_COMM_IMGREG_RECOGNIZER_CMULTCOLORVARREG_H_
1,578
26,932
#include <stdint.h> uint64_t unsandbox(pid_t pid); int sandbox(pid_t pid, uint64_t sb); int rootify(pid_t pid);
50
406
<filename>CSES/Tree Algorithms/Subordinates.cpp /** 🍪 thew6rst 🍪 11.02.2021 19:18:21 **/ #ifdef W #include "k_II.h" #else #include <bits/stdc++.h> using namespace std; #endif #define pb emplace_back #define all(x) x.begin(), x.end() #define sz(x) static_cast<int32_t>(x.size()) template<class T> class Y { T f; public: template<class U> explicit Y(U&& f): f(forward<U>(f)) {} template<class... Args> decltype(auto) operator()(Args&&... args) { return f(ref(*this), forward<Args>(args)...); } }; template<class T> Y(T) -> Y<T>; const int64_t DESPACITO = 2e18; const int INF = 2e9, MOD = 1e9+7; const int N = 2e5 + 5; int main() { cin.tie(nullptr)->sync_with_stdio(false); int i, n; cin >> n; vector<vector<int>> g(n); for(i = 1; i < n; i++) { int p; cin >> p; g[--p].pb(i); } vector<int> sub(n, 1); Y([&](auto dfs, int v) -> void { for(auto& x: g[v]) { dfs(x); sub[v] += sub[x]; } })(0); for(auto& x: sub) cout << x-1 << ' '; } // ~W
611
352
/* *Author:GeneralSandman *Code:https://github.com/GeneralSandman/TinyWeb *E-mail:<EMAIL> *Web:www.dissigil.cn */ /*---XXX--- * **************************************** * */ #include <tiny_base/buffer.h> #include <tiny_base/log.h> #include <tiny_core/client.h> #include <tiny_core/clientpool.h> #include <tiny_core/connection.h> #include <tiny_core/eventloop.h> #include <tiny_core/factory.h> #include <tiny_core/netaddress.h> #include <tiny_core/protocol.h> #include <tiny_core/timerid.h> #include <tiny_http/http_protocol.h> #include <iostream> #include <vector> using namespace std; void test1() { NetAddress clientAddress("0.0.0.0:9595"); EventLoop* loop = new EventLoop(); ClientPool* clientPool = new ClientPool(loop, clientAddress); Protocol* protocol = new TestClientPoolProtocol(); loop->runAfter(10, std::bind(&EventLoop::quit, loop)); NetAddress serverAddress("172.17.0.3:9090"); bool retry = false; bool keepconnect = false; clientPool->start(); clientPool->addClient(clientAddress, serverAddress, retry, keepconnect); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); loop->loop(); delete protocol; delete clientPool; delete loop; } void test2() { NetAddress clientAddress("0.0.0.0:9595"); EventLoop* loop = new EventLoop(); ClientPool* clientPool = new ClientPool(loop, clientAddress); Protocol* protocol = new TestClientPoolProtocol(); loop->runAfter(10, std::bind(&EventLoop::quit, loop)); NetAddress serverAddress("172.17.0.3:9090"); bool retry = false; bool keepconnect = false; clientPool->start(); clientPool->addClient(clientAddress, serverAddress, retry, keepconnect); loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); loop->loop(); delete protocol; delete clientPool; delete loop; } void test3() { NetAddress clientAddress("0.0.0.0:9595"); EventLoop* loop = new EventLoop(); ClientPool* clientPool = new ClientPool(loop, clientAddress); Protocol* protocol1 = new TestClientPoolProtocol(); Protocol* protocol2 = new TestClientPoolProtocol(); Protocol* protocol3 = new TestClientPoolProtocol(); Protocol* protocol4 = new TestClientPoolProtocol(); Protocol* protocol5 = new TestClientPoolProtocol(); Protocol* protocol6 = new TestClientPoolProtocol(); Protocol* protocol7 = new TestClientPoolProtocol(); Protocol* protocol8 = new TestClientPoolProtocol(); Protocol* protocol9 = new TestClientPoolProtocol(); loop->runAfter(30, std::bind(&EventLoop::quit, loop)); NetAddress serverAddress("172.17.0.3:9090"); bool retry = false; bool keepconnect = false; clientPool->start(); clientPool->addClient(clientAddress, serverAddress, retry, keepconnect); loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol1)); loop->runAfter(4, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol2)); loop->runAfter(4, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol3)); loop->runAfter(5, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol4)); loop->runAfter(5, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol5)); loop->runAfter(6, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol6)); loop->runAfter(6, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol7)); loop->runAfter(8, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol8)); loop->runAfter(9, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol9)); loop->loop(); // delete obj in right order. delete clientPool; delete protocol1; delete protocol2; delete protocol3; delete protocol4; delete protocol5; delete protocol6; delete protocol7; delete protocol8; delete protocol9; delete loop; } void test4() { NetAddress clientAddress("0.0.0.0:9595"); EventLoop* loop = new EventLoop(); ClientPool* clientPool = new ClientPool(loop, clientAddress); vector<Protocol*> protocols; for (int i = 0; i < 40; i++) { protocols.push_back(new TestClientPoolProtocol()); } loop->runAfter(30, std::bind(&EventLoop::quit, loop)); NetAddress serverAddress1("172.17.0.3:9090"); NetAddress serverAddress2("172.17.0.4:9090"); NetAddress serverAddress3("172.17.0.5:9090"); bool retry = false; bool keepconnect = false; clientPool->start(); clientPool->addClient(clientAddress, serverAddress1, retry, keepconnect); clientPool->addClient(clientAddress, serverAddress1, retry, keepconnect); clientPool->addClient(clientAddress, serverAddress1, retry, keepconnect); for (int i = 0; i < 10; i++) { loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress1, protocols[i])); } for (int i = 10; i < 20; i++) { loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress2, protocols[i])); } for (int i = 20; i < 30; i++) { loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress3, protocols[i])); } loop->loop(); // delete obj in right order. for (auto t : protocols) { delete t; } delete loop; } void test5() { NetAddress clientAddress("0.0.0.0"); EventLoop* loop = new EventLoop(); ClientPool* clientPool = new ClientPool(loop, clientAddress); Protocol* protocol = new TestClientPoolProtocol(); loop->runAfter(15, std::bind(&EventLoop::quit, loop)); NetAddress serverAddress("172.17.0.4:9090"); bool retry = false; bool keepconnect = false; clientPool->start(); clientPool->addClient(clientAddress, serverAddress, retry, keepconnect, 2); loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); loop->runAfter(2, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(4, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(5, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(6, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(7, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(8, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(9, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(10, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); // loop->runAfter(11, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress, protocol)); loop->loop(); // delete obj in right order. delete protocol; delete clientPool; delete loop; } void test6() { NetAddress clientAddress(9595); EventLoop* loop = new EventLoop(); ClientPool* clientPool = new ClientPool(loop, clientAddress); Protocol* protocol = new TestClientPoolProtocol(); loop->runAfter(10, std::bind(&EventLoop::quit, loop)); NetAddress serverAddress1("172.17.0.3:9090"); NetAddress serverAddress2("172.17.0.4:9090"); NetAddress serverAddress3("172.17.0.5:9090"); bool retry = false; bool keepconnect = false; clientPool->start(); clientPool->addClient(clientAddress, serverAddress1, retry, keepconnect); clientPool->addClient(clientAddress, serverAddress2, retry, keepconnect); clientPool->addClient(clientAddress, serverAddress3, retry, keepconnect); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress1, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress1, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress1, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress2, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress2, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress2, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress3, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress3, protocol)); loop->runAfter(3, boost::bind(&ClientPool::doTask, clientPool, clientAddress, serverAddress3, protocol)); loop->loop(); delete protocol; delete clientPool; delete loop; } int main() { // test1(); // test2(); // test3(); test4(); // test5(); // test6(); } int main1() { std::map<std::string, std::string> con; NetAddress address1("172.17.0.3:9090"); NetAddress address2("172.17.0.4:9090"); NetAddress address3("172.17.0.5:9090"); con[address1.getIpPort()] = "a"; con[address2.getIpPort()] = "b"; con[address3.getIpPort()] = "c"; std::cout << "zhenhuli" << con[address1.getIpPort()] << std::endl; std::cout << "zhenhuli" << con[address2.getIpPort()] << std::endl; std::cout << "zhenhuli" << con[address3.getIpPort()] << std::endl; return 0; }
3,390
1,270
<filename>libs/remix-core-plugin/package.json { "name": "@remix-project/core-plugin", "version": "0.0.1", "description": "This library was generated with [Nx](https://nx.dev).", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Remix Team", "license": "ISC" }
149
310
{ "name": "Game Dev Story (Android)", "description": "A game developer studio simulator.", "url": "https://play.google.com/store/apps/details?id=net.kairosoft.android.gamedev3en" }
63
318
<gh_stars>100-1000 { "variants": { "type=bottom": { "model": "techreborn:block/storage/iridium_storage_block_slab" }, "type=double": { "model": "techreborn:block/storage/iridium_storage_block" }, "type=top": { "model": "techreborn:block/storage/iridium_storage_block_slab_top" } } }
129
348
<gh_stars>100-1000 {"nom":"Felluns","dpt":"Pyrénées-Orientales","inscrits":54,"abs":11,"votants":43,"blancs":7,"nuls":1,"exp":35,"res":[{"panneau":"1","voix":22},{"panneau":"2","voix":13}]}
83
335
<filename>C/Carbon_noun.json { "word": "Carbon", "definitions": [ "The chemical element of atomic number 6, a non-metal which has two main forms (diamond and graphite) and which also occurs in impure form in charcoal, soot, and coal.", "Carbon fibre.", "A rod of carbon in an arc lamp.", "A piece of carbon paper or a carbon copy.", "Carbon dioxide or other gaseous carbon compounds released into the atmosphere, associated with climate change." ], "parts-of-speech": "Noun" }
185
2,151
// Copyright 2017 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/logging.h" #include "ui/gl/gl_surface_format.h" namespace gl { GLSurfaceFormat::GLSurfaceFormat() { } GLSurfaceFormat::GLSurfaceFormat(const GLSurfaceFormat& other) = default; GLSurfaceFormat::~GLSurfaceFormat() { } GLSurfaceFormat::GLSurfaceFormat(SurfacePixelLayout layout) { pixel_layout_ = layout; } GLSurfaceFormat::SurfacePixelLayout GLSurfaceFormat::GetPixelLayout() const { return pixel_layout_; } void GLSurfaceFormat::SetDefaultPixelLayout(SurfacePixelLayout layout) { if (pixel_layout_ == PIXEL_LAYOUT_DONT_CARE && layout != PIXEL_LAYOUT_DONT_CARE) { pixel_layout_ = layout; } } void GLSurfaceFormat::SetRGB565() { red_bits_ = blue_bits_ = 5; green_bits_ = 6; alpha_bits_ = 0; } static int GetValue(int num, int default_value) { return num == -1 ? default_value : num; } static int GetBitSize(int num) { return GetValue(num, 8); } bool GLSurfaceFormat::IsCompatible(GLSurfaceFormat other) const { if (GetBitSize(red_bits_) == GetBitSize(other.red_bits_) && GetBitSize(green_bits_) == GetBitSize(other.green_bits_) && GetBitSize(blue_bits_) == GetBitSize(other.blue_bits_) && GetBitSize(alpha_bits_) == GetBitSize(other.alpha_bits_) && GetValue(stencil_bits_, 8) == GetValue(other.stencil_bits_, 8) && GetValue(depth_bits_, 24) == GetValue(other.depth_bits_, 24) && GetValue(samples_, 0) == GetValue(other.samples_, 0) && pixel_layout_ == other.pixel_layout_) { return true; } return false; } void GLSurfaceFormat::SetDepthBits(int bits) { if (bits != -1) { depth_bits_ = bits; } } void GLSurfaceFormat::SetStencilBits(int bits) { if (bits != -1) { stencil_bits_ = bits; } } void GLSurfaceFormat::SetSamples(int num) { if (num != -1) { samples_ = num; } } int GLSurfaceFormat::GetBufferSize() const { int bits = GetBitSize(red_bits_) + GetBitSize(green_bits_) + GetBitSize(blue_bits_) + GetBitSize(alpha_bits_); if (bits <= 16) { return 16; } else if (bits <= 32) { return 32; } NOTREACHED(); return 64; } } // namespace gl
902
2,542
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once IFabricSerializable * MyActivator(FabricTypeInformation) { return _new (WF_SERIALIZATION_TAG, Common::GetSFDefaultPagedKAllocator()) BasicObject(); } struct BasicObjectWithPointers : public FabricSerializable { BasicObject * _basicObject1; BasicObject * _basicObject2; BasicObjectWithPointers() : _basicObject1(nullptr) , _basicObject2(nullptr) { } bool operator==(BasicObjectWithPointers const & rhs) { return IsPointerEqual(this->_basicObject1, rhs._basicObject1) && IsPointerEqual(this->_basicObject2, rhs._basicObject2); } virtual NTSTATUS Write(__in IFabricSerializableStream * stream) { NTSTATUS status; status = __super::Write(stream); if (NT_ERROR(status)) return status; status = stream->WriteStartType(); if (NT_ERROR(status)) return status; status = stream->WritePointer(this->_basicObject1); if (NT_ERROR(status)) return status; status = stream->WritePointer(this->_basicObject2); if (NT_ERROR(status)) return status; stream->WriteEndType(); return status; } virtual NTSTATUS Read(__in IFabricSerializableStream * stream) { NTSTATUS status; status = __super::Read(stream); if (NT_ERROR(status)) return status; status = stream->ReadStartType(); if (NT_ERROR(status)) return status; IFabricSerializable* ptr[1]; status = stream->ReadPointer(ptr, MyActivator); this->_basicObject1 = static_cast<BasicObject*>(ptr[0]); if (NT_ERROR(status)) return status; status = stream->ReadPointer(ptr, MyActivator); this->_basicObject2 = static_cast<BasicObject*>(ptr[0]); if (NT_ERROR(status)) return status; status = stream->ReadEndType(); return status; } };
811
775
/* Copyright (c) 2015, Cisco Systems All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 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. 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. */ #ifndef COMMON_SIMDKERNELS_H #define COMMON_SIMDKERNELS_H #include <stdint.h> #include "common_block.h" void TEMPLATE(block_avg_simd)(SAMPLE *p,SAMPLE *r0, SAMPLE *r1, int sp, int s0, int s1, int width, int height); int TEMPLATE(sad_calc_simd_unaligned)(SAMPLE *a, SAMPLE *b, int astride, int bstride, int width, int height); void TEMPLATE(get_inter_prediction_luma_simd)(int width, int height, int xoff, int yoff, SAMPLE *restrict qp, int qstride, const SAMPLE *restrict ip, int istride, int bipred, int bitdepth); void TEMPLATE(get_inter_prediction_chroma_simd)(int width, int height, int xoff, int yoff, SAMPLE *restrict qp, int qstride, const SAMPLE *restrict ip, int istride, int bitdepth); void transform_simd(const int16_t *block, int16_t *coeff, int size, int fast, int bitdepth); void inverse_transform_simd(const int16_t *coeff, int16_t *block, int size, int bitdepth); void TEMPLATE(clpf_block4)(const SAMPLE *src, SAMPLE *dst, int sstride, int dstride, int x0, int y0, int sizey, boundary_type bt, unsigned int strength, unsigned int dmp); void TEMPLATE(clpf_block8)(const SAMPLE *src, SAMPLE *dst, int sstride, int dstride, int x0, int y0, int sizey, boundary_type bt, unsigned int strength, unsigned int dmp); void TEMPLATE(clpf_block4_noclip)(const SAMPLE *src, SAMPLE *dst, int sstride, int dstride, int x0, int y0, int sizey, unsigned int strength, unsigned int dmp); void TEMPLATE(clpf_block8_noclip)(const SAMPLE *src, SAMPLE *dst, int sstride, int dstride, int x0, int y0, int sizey, unsigned int strength, unsigned int dmp); void TEMPLATE(scale_frame_down2x2_simd)(yuv_frame_t* sin, yuv_frame_t* sout); SIMD_INLINE void TEMPLATE(clpf_block_simd)(const SAMPLE *src, SAMPLE *dst, int sstride, int dstride, int x0, int y0, int sizex, int sizey, boundary_type bt, unsigned int strength, unsigned int dmp) { if ((sizex != 4 && sizex != 8) || ((sizey & 1) && sizex == 4)) { // Fallback to C for odd sizes: // * block width not 4 or 8 // * block heights not a multiple of 2 if the block width is 4 TEMPLATE(clpf_block)(src, dst, sstride, dstride, x0, y0, sizex, sizey, bt, strength, dmp); } else { if (bt) (sizex == 4 ? TEMPLATE(clpf_block4) : TEMPLATE(clpf_block8))(src, dst, sstride, dstride, x0, y0, sizey, bt, strength, dmp); else (sizex == 4 ? TEMPLATE(clpf_block4_noclip) : TEMPLATE(clpf_block8_noclip))(src, dst, sstride, dstride, x0, y0, sizey, strength, dmp); } #if 0 if (sizex == 4 && sizey == 4) // chroma 420 TEMPLATE(clpf_block4)(src, dst, sstride, dstride, x0, y0, 4, bt, strength, dmp); else if (sizex == 4) { // chroma 422 TEMPLATE(clpf_block4)(src, dst, sstride, dstride, x0, y0, 4, bt, strength, dmp); TEMPLATE(clpf_block4)(src + 4*sstride, dst + 4*dstride, sstride, dstride, x0, y0, 4, bt, strength, dmp); } else // 444 or luma 420 TEMPLATE(clpf_block8)(src, dst, sstride, dstride, x0, y0, 8, bt, strength, dmp); #endif } #if CDEF void cdef_filter_block_simd(uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int sstride, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int cdef_directions[8][2 + CDEF_FULL], int coeff_shift); int TEMPLATE(cdef_find_dir_simd)(const SAMPLE *img, int stride, int32_t *var, int coeff_shift); v128 compute_directions(v128 lines[8], int32_t tmp_cost1[4]); void array_reverse_transpose_8x8(v128 *in, v128 *res); int cdef_find_best_dir(v128 *lines, int32_t *cost, int *best_cost); #endif #endif
1,905
1,385
#!python3 # -*- coding: utf-8 -*- import os import sys import time import subprocess sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # not required after 'pip install uiautomation' import uiautomation as auto def main(): width = 500 height = 500 cmdWindow = auto.GetConsoleWindow() print('create a transparent image') bitmap = auto.Bitmap(width, height) bitmap.ToFile('image_transparent.png') cmdWindow.SetActive() print('create a blue image') start = auto.ProcessTime() for x in range(width): for y in range(height): argb = 0x0000FF | ((255 * x // 500) << 24) bitmap.SetPixelColor(x, y, argb) cost = auto.ProcessTime() - start print('write {}x{} image by SetPixelColor cost {:.3f}s'.format(width, height, cost)) bitmap.ToFile('image_blue.png') start = auto.ProcessTime() for x in range(width): for y in range(height): bitmap.GetPixelColor(x, y) cost = auto.ProcessTime() - start print('read {}x{} image by GetPixelColor cost {:.3f}s'.format(width, height, cost)) argb = [(0xFF0000 | (0x0000FF * y // height) | ((255 * x // width) << 24)) for x in range(width) for y in range(height)] start = auto.ProcessTime() bitmap.SetPixelColorsOfRect(0, 0, width, height, argb) cost = auto.ProcessTime() - start print('write {}x{} image by SetPixelColorsOfRect with List[int] cost {:.3f}s'.format(width, height, cost)) bitmap.ToFile('image_red.png') arrayType = auto.ctypes.c_uint32 * (width * height) nativeArray = arrayType(*argb) start = auto.ProcessTime() bitmap.SetPixelColorsOfRect(0, 0, width, height, nativeArray) cost = auto.ProcessTime() - start print('write {}x{} image by SetPixelColorsOfRect with native array cost {:.3f}s'.format(width, height, cost)) bitmap.ToFile('image_red2.png') start = auto.ProcessTime() colors = bitmap.GetAllPixelColors() cost = auto.ProcessTime() - start print('read {}x{} image by GetAllPixelColors cost {:.3f}s'.format(width, height, cost)) bitmap.ToFile('image_red.png') bitmap.ToFile('image_red.jpg') subprocess.Popen('image_red.png', shell=True) root = auto.GetRootControl() bitmap = root.ToBitmap(0, 0, 400, 400) print('save (0,0,400,400) of desktop to desk_part.png') bitmap.ToFile('desk_part.png') width, height = 100, 100 colors = bitmap.GetPixelColorsOfRects([(0, 0, width, height), (100, 100, width, height), (200, 200, width, height)]) for i, nativeArray in enumerate(colors): print('save part of desk_part.png to desk_part{}.png'.format(i)) with auto.Bitmap(width, height) as subBitmap: subBitmap.SetPixelColorsOfRect(0, 0, width, height, nativeArray) subBitmap.ToFile('desk_part{}.png'.format(i)) print('save part of desk_part.png to desk_part3.png') with bitmap.Copy(300, 300, 100, 100) as subBitmap: subBitmap.ToFile('desk_part3.png') print('flip X of desk_part.png') with bitmap.RotateFlip(auto.RotateFlipType.RotateNoneFlipX) as bmpFlipX: bmpFlipX.ToFile('desk_flipX.png') print('flip Y of desk_part.png') with bitmap.RotateFlip(auto.RotateFlipType.RotateNoneFlipY) as bmpFlipY: bmpFlipY.ToFile('desk_flipY.png') print('rotate 90 of desk_part.png') with bitmap.Rotate(90) as bmpRotate90: bmpRotate90.ToFile('desk_rotate90.png') print('rotate 270 of desk_part.png') with bitmap.Rotate(270) as bmpRotate270: bmpRotate270.ToFile('desk_rotate270.png') print('rotate 45 of desk_part.png') with bitmap.Rotate(45) as bmpRotate45: bmpRotate45.ToFile('desk_rotate45.png') if __name__ == '__main__': main()
1,554
6,270
[ { "type": "feature", "category": "Budgets", "description": "Including \"DuplicateRecordException\" in UpdateNotification and UpdateSubscriber. " }, { "type": "feature", "category": "CloudWatchLogs", "description": "Adds support for associating LogGroups with KMS Keys." }, { "type": "feature", "category": "EC2", "description": "Add EC2 APIs to copy Amazon FPGA Images (AFIs) within the same region and across multiple regions, delete AFIs, and modify AFI attributes. AFI attributes include name, description and granting/denying other AWS accounts to load the AFI." } ]
247
5,169
<reponame>Gantios/Specs { "name": "UhSpotNavigation", "version": "1.0.2", "summary": "Complete turn-by-turn navigation interface for iOS.", "description": "UhSpot's drop in Interface using MapboxCoreNavigation Services", "homepage": "https://uhspot.com", "documentation_url": "https://docs.mapbox.com/ios/api/navigation/", "license": { "type": "Mapbox Terms of Service", "file": "LICENSE.md" }, "authors": { "UhSpot": "<EMAIL>" }, "social_media_url": "https://uhspot.com", "platforms": { "ios": "11.0" }, "source": { "git": "https://github.com/UhSpot/mapbox-navigation-ios.git", "tag": "v1.0.2-uhspot" }, "source_files": "Sources/MapboxNavigation/**/*.{h,m,swift}", "resources": [ "Sources/MapboxNavigation/Resources/*/*", "Sources/MapboxNavigation/Resources/*" ], "requires_arc": true, "module_name": "UhSpotNavigation", "dependencies": { "UhSpotCoreNavigation": [ "2.0.0-beta.24" ], "MapboxMaps": [ "10.0.0-rc.7" ], "Solar-dev": [ "~> 3.0" ], "MapboxSpeech-pre": [ "2.0.0-alpha.1" ], "MapboxMobileEvents": [ "~> 1.0.0" ] }, "swift_versions": "5.0", "user_target_xcconfig": { "EXCLUDED_ARCHS[sdk=iphonesimulator*]": "$(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))", "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200": "arm64 arm64e armv7 armv7s armv6 armv8" }, "pod_target_xcconfig": { "EXCLUDED_ARCHS[sdk=iphonesimulator*]": "$(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))", "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200": "arm64 arm64e armv7 armv7s armv6 armv8" }, "swift_version": "5.0" }
909
2,743
from __future__ import unicode_literals from django.contrib import admin from .models import EventType @admin.register(EventType) class EventTypeAdmin(admin.ModelAdmin): readonly_fields = ('name', '__str__')
67
854
package dev.morphia.aggregation.stages; import com.mongodb.lang.Nullable; import dev.morphia.aggregation.AggregationException; import dev.morphia.aggregation.expressions.Expressions; import dev.morphia.aggregation.expressions.impls.DocumentExpression; import dev.morphia.aggregation.expressions.impls.Expression; import dev.morphia.aggregation.expressions.impls.Fields; import dev.morphia.sofia.Sofia; /** * Groups input documents by the specified _id expression and for each distinct grouping, outputs a document. * * @aggregation.expression $group */ public class Group extends Stage { private final GroupId id; private Fields<Group> fields; protected Group() { super("$group"); id = null; } protected Group(GroupId id) { super("$group"); this.id = id; } /** * Creates a group stage with an ID definition * * @param id the group ID * @return the new stage * @since 2.2 */ public static Group group(GroupId id) { return new Group(id); } /** * Creates a group stage with no ID definition * * @return the new stage * @since 2.2 */ public static Group group() { return new Group(); } /** * Creates an unnamed group ID * * @return the new groupID */ public static GroupId id() { return new GroupId(); } /** * Creates a named group ID * * @param name the id name * @return the new groupID */ public static GroupId id(String name) { return new GroupId(Expressions.field(name)); } /** * Creates a named group ID * * @param name the id name * @return the new groupID */ public static GroupId id(Expression name) { return new GroupId(name); } /** * Creates a group stage with an ID definition * * @param id the group ID * @return the new stage * @deprecated use {@link #group(GroupId)} */ @Deprecated(forRemoval = true) public static Group of(GroupId id) { return new Group(id); } /** * Creates a group stage with no ID definition * * @return the new stage * @deprecated user {@link #group()} */ @Deprecated(forRemoval = true) public static Group of() { return new Group(); } /** * Adds a field to the group. This method is equivalent to calling {@code field("name", Expression.field("name"))} * * @param name the field name * @return this * @see #field(String, Expression) * @see Expressions#field(String) */ public Group field(String name) { return field(name, Expressions.field(name)); } /** * Adds a named field to the group with an expression giving the value. * * @param name the name of the field * @param expression the expression giving the value * @return this */ public Group field(String name, Expression expression) { if (fields == null) { fields = Fields.on(this); } fields.add(name, expression); return this; } /** * @return the fields * @morphia.internal */ @Nullable public Fields<Group> getFields() { return fields; } /** * @return the ID * @morphia.internal */ @Nullable public GroupId getId() { return id; } /** * Defines a group ID */ public static class GroupId { private Expression field; private DocumentExpression document; protected GroupId() { document = Expressions.of(); } protected GroupId(Expression value) { if (value instanceof DocumentExpression) { document = (DocumentExpression) value; } else { field = value; } } /** * Adds a field to the group. This method is equivalent to calling {@code field("name", Expression.field("name"))} * * @param name the field name * @return this * @see #field(String, Expression) * @see Expressions#field(String) */ public GroupId field(String name) { return field(name, Expressions.field(name)); } /** * Adds a named field to the group with an expression giving the value. * * @param name the name of the field * @param expression the expression giving the value * @return this */ public GroupId field(String name, Expression expression) { if (field != null) { throw new AggregationException(Sofia.mixedModesNotAllowed("_id")); } document.field(name, expression); return this; } /** * @return the document * @morphia.internal */ @Nullable public DocumentExpression getDocument() { return document; } /** * @return the field * @morphia.internal */ @Nullable public Expression getField() { return field; } } }
2,223
2,542
<gh_stars>1000+ // ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once namespace Management { namespace ClusterManager { class StoreDataServiceTemplate : public Store::StoreData { public: StoreDataServiceTemplate(); StoreDataServiceTemplate( ServiceModelApplicationId const &, ServiceModelTypeName const &); StoreDataServiceTemplate( ServiceModelApplicationId const &, Common::NamingUri const &, ServiceModelTypeName const &, Naming::PartitionedServiceDescriptor &&); __declspec(property(get=get_ApplicationId)) ServiceModelApplicationId const & ApplicationId; __declspec(property(get=get_ApplicationName)) Common::NamingUri const & ApplicationName; __declspec(property(get=get_TypeName)) ServiceModelTypeName const & TypeName; __declspec(property(get=get_PartitionedServiceDescriptor)) Naming::PartitionedServiceDescriptor const & PartitionedServiceDescriptor; __declspec(property(get=get_MutablePartitionedServiceDescriptor)) Naming::PartitionedServiceDescriptor & MutablePartitionedServiceDescriptor; ServiceModelApplicationId const & get_ApplicationId() const { return applicationId_; } Common::NamingUri const & get_ApplicationName() const { return applicationName_; } ServiceModelTypeName const & get_TypeName() const { return serviceTypeName_; } Naming::PartitionedServiceDescriptor const & get_PartitionedServiceDescriptor() const { return partitionedServiceDescriptor_; } Naming::PartitionedServiceDescriptor & get_MutablePartitionedServiceDescriptor() { return partitionedServiceDescriptor_; } static Common::ErrorCode ReadServiceTemplates( Store::StoreTransaction const &, ServiceModelApplicationId const &, __out std::vector<StoreDataServiceTemplate> &); virtual ~StoreDataServiceTemplate() { } virtual std::wstring const & get_Type() const; virtual void WriteTo(Common::TextWriter & w, Common::FormatOptions const &) const; FABRIC_FIELDS_04(applicationId_, applicationName_, serviceTypeName_, partitionedServiceDescriptor_); protected: virtual std::wstring ConstructKey() const; private: ServiceModelApplicationId applicationId_; // store name for debugging Common::NamingUri applicationName_; ServiceModelTypeName serviceTypeName_; Naming::PartitionedServiceDescriptor partitionedServiceDescriptor_; }; } }
1,098
364
<filename>converter/ch_ppocr_mobile_v2.0_cls_converter.py import os, sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from collections import OrderedDict import numpy as np import cv2 import torch from pytorchocr.base_ocr_v20 import BaseOCRV20 class MobileV20DetConverter(BaseOCRV20): def __init__(self, config, paddle_pretrained_model_path, **kwargs): super(MobileV20DetConverter, self).__init__(config, **kwargs) self.load_paddle_weights(paddle_pretrained_model_path) self.net.eval() def load_paddle_weights(self, weights_path): print('paddle weights loading...') import paddle.fluid as fluid with fluid.dygraph.guard(): para_state_dict, opti_state_dict = fluid.load_dygraph(weights_path) for k,v in self.net.state_dict().items(): name = k if name.endswith('num_batches_tracked'): continue if name.endswith('running_mean'): ppname = name.replace('running_mean', '_mean') elif name.endswith('running_var'): ppname = name.replace('running_var', '_variance') elif name.endswith('bias') or name.endswith('weight'): ppname = name else: print('Redundance:') print(name) raise ValueError try: if ppname.endswith('fc.weight'): self.net.state_dict()[k].copy_(torch.Tensor(para_state_dict[ppname].T)) else: self.net.state_dict()[k].copy_(torch.Tensor(para_state_dict[ppname])) except Exception as e: print('pytorch: {}, {}'.format(k, v.size())) print('paddle: {}, {}'.format(ppname, para_state_dict[ppname].shape)) raise e print('model is loaded: {}'.format(weights_path)) if __name__ == '__main__': import argparse, json, textwrap, sys, os parser = argparse.ArgumentParser() parser.add_argument("--src_model_path", type=str, help='Assign the paddleOCR trained model(best_accuracy)') args = parser.parse_args() cfg = {'model_type':'cls', 'algorithm':'CLS', 'Transform':None, 'Backbone':{'name':'MobileNetV3', 'model_name':'small', 'scale':0.35}, 'Neck':None, 'Head':{'name':'ClsHead', 'class_dim':2}} paddle_pretrained_model_path = os.path.join(os.path.abspath(args.src_model_path), 'best_accuracy') converter = MobileV20DetConverter(cfg, paddle_pretrained_model_path) print('todo') # image = cv2.imread('images/Snipaste.jpg') # image = cv2.resize(image, (192, 48)) # mean = 0.5 # std = 0.5 # scale = 1. / 255 # norm_img = (image * scale - mean) / std # transpose_img = norm_img.transpose(2, 0, 1) # transpose_img = np.expand_dims(transpose_img, 0) # inputs = transpose_img.astype(np.float32) # print(np.sum(inputs), np.mean(inputs), np.max(inputs), np.min(inputs)) # print('done') # inp = torch.Tensor(inputs) # out = converter.net(inp) # print('out:') # print(out.data.numpy()) # save converter.save_pytorch_weights('ch_ptocr_mobile_v2.0_cls_infer.pth') print('done.')
1,555
4,054
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/searchcommon/attribute/config.h> #include <memory> namespace search { class AttributeVector; /** * Factory for creating attribute vector instances. **/ class AttributeFactory { private: using stringref = vespalib::stringref; using Config = attribute::Config; using AttributeSP = std::shared_ptr<AttributeVector>; static AttributeSP createArrayStd(stringref name, const Config & cfg); static AttributeSP createArrayFastSearch(stringref name, const Config & cfg); static AttributeSP createSetStd(stringref name, const Config & cfg); static AttributeSP createSetFastSearch(stringref name, const Config & cfg); static AttributeSP createSingleStd(stringref name, const Config & cfg); static AttributeSP createSingleFastSearch(stringref name, const Config & cfg); public: /** * Create an attribute vector with the given name based on the given config. **/ static AttributeSP createAttribute(stringref name, const Config & cfg); }; }
337
15,577
<reponame>pdv-ru/ClickHouse #pragma once #include <Common/PODArray.h> #include <Common/StringUtils/StringUtils.h> #include <Common/UTF8Helpers.h> #include <algorithm> #include <climits> #include <cstring> #include <memory> #include <utility> #ifdef __SSE4_2__ # include <nmmintrin.h> #endif namespace DB { // used by FunctionsStringSimilarity and FunctionsStringHash // includes extracting ASCII ngram, UTF8 ngram, ASCII word and UTF8 word struct ExtractStringImpl { static ALWAYS_INLINE inline const UInt8 * readOneWord(const UInt8 *& pos, const UInt8 * end) { // jump separators while (pos < end && isUTF8Sep(*pos)) ++pos; // word start from here const UInt8 * word_start = pos; while (pos < end && !isUTF8Sep(*pos)) ++pos; return word_start; } // we use ASCII non-alphanum character as UTF8 separator static ALWAYS_INLINE inline bool isUTF8Sep(const UInt8 c) { return c < 128 && !isAlphaNumericASCII(c); } // read one UTF8 character static ALWAYS_INLINE inline void readOneUTF8Code(const UInt8 *& pos, const UInt8 * end) { size_t length = UTF8::seqLength(*pos); if (pos + length > end) length = end - pos; pos += length; } }; }
526
2,151
//===--- lib/CodeGen/DIE.cpp - DWARF Info Entries -------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Data structures for DWARF info entries. // //===----------------------------------------------------------------------===// #include "DIE.h" #include "llvm/ADT/Twine.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" #include "llvm/Support/FormattedStream.h" using namespace llvm; //===----------------------------------------------------------------------===// // DIEAbbrevData Implementation //===----------------------------------------------------------------------===// /// Profile - Used to gather unique data for the abbreviation folding set. /// void DIEAbbrevData::Profile(FoldingSetNodeID &ID) const { ID.AddInteger(Attribute); ID.AddInteger(Form); } //===----------------------------------------------------------------------===// // DIEAbbrev Implementation //===----------------------------------------------------------------------===// /// Profile - Used to gather unique data for the abbreviation folding set. /// void DIEAbbrev::Profile(FoldingSetNodeID &ID) const { ID.AddInteger(Tag); ID.AddInteger(ChildrenFlag); // For each attribute description. for (unsigned i = 0, N = Data.size(); i < N; ++i) Data[i].Profile(ID); } /// Emit - Print the abbreviation using the specified asm printer. /// void DIEAbbrev::Emit(AsmPrinter *AP) const { // Emit its Dwarf tag type. // FIXME: Doing work even in non-asm-verbose runs. AP->EmitULEB128(Tag, dwarf::TagString(Tag)); // Emit whether it has children DIEs. // FIXME: Doing work even in non-asm-verbose runs. AP->EmitULEB128(ChildrenFlag, dwarf::ChildrenString(ChildrenFlag)); // For each attribute description. for (unsigned i = 0, N = Data.size(); i < N; ++i) { const DIEAbbrevData &AttrData = Data[i]; // Emit attribute type. // FIXME: Doing work even in non-asm-verbose runs. AP->EmitULEB128(AttrData.getAttribute(), dwarf::AttributeString(AttrData.getAttribute())); // Emit form type. // FIXME: Doing work even in non-asm-verbose runs. AP->EmitULEB128(AttrData.getForm(), dwarf::FormEncodingString(AttrData.getForm())); } // Mark end of abbreviation. AP->EmitULEB128(0, "EOM(1)"); AP->EmitULEB128(0, "EOM(2)"); } #ifndef NDEBUG void DIEAbbrev::print(raw_ostream &O) { O << "Abbreviation @" << format("0x%lx", (long)(intptr_t)this) << " " << dwarf::TagString(Tag) << " " << dwarf::ChildrenString(ChildrenFlag) << '\n'; for (unsigned i = 0, N = Data.size(); i < N; ++i) { O << " " << dwarf::AttributeString(Data[i].getAttribute()) << " " << dwarf::FormEncodingString(Data[i].getForm()) << '\n'; } } void DIEAbbrev::dump() { print(dbgs()); } #endif //===----------------------------------------------------------------------===// // DIE Implementation //===----------------------------------------------------------------------===// DIE::~DIE() { for (unsigned i = 0, N = Children.size(); i < N; ++i) delete Children[i]; } /// addSiblingOffset - Add a sibling offset field to the front of the DIE. /// DIEValue *DIE::addSiblingOffset(BumpPtrAllocator &A) { DIEInteger *DI = new (A) DIEInteger(0); Values.insert(Values.begin(), DI); Abbrev.AddFirstAttribute(dwarf::DW_AT_sibling, dwarf::DW_FORM_ref4); return DI; } #ifndef NDEBUG void DIE::print(raw_ostream &O, unsigned IncIndent) { IndentCount += IncIndent; const std::string Indent(IndentCount, ' '); bool isBlock = Abbrev.getTag() == 0; if (!isBlock) { O << Indent << "Die: " << format("0x%lx", (long)(intptr_t)this) << ", Offset: " << Offset << ", Size: " << Size << "\n"; O << Indent << dwarf::TagString(Abbrev.getTag()) << " " << dwarf::ChildrenString(Abbrev.getChildrenFlag()) << "\n"; } else { O << "Size: " << Size << "\n"; } const SmallVector<DIEAbbrevData, 8> &Data = Abbrev.getData(); IndentCount += 2; for (unsigned i = 0, N = Data.size(); i < N; ++i) { O << Indent; if (!isBlock) O << dwarf::AttributeString(Data[i].getAttribute()); else O << "Blk[" << i << "]"; O << " " << dwarf::FormEncodingString(Data[i].getForm()) << " "; Values[i]->print(O); O << "\n"; } IndentCount -= 2; for (unsigned j = 0, M = Children.size(); j < M; ++j) { Children[j]->print(O, 4); } if (!isBlock) O << "\n"; IndentCount -= IncIndent; } void DIE::dump() { print(dbgs()); } #endif #ifndef NDEBUG void DIEValue::dump() { print(dbgs()); } #endif //===----------------------------------------------------------------------===// // DIEInteger Implementation //===----------------------------------------------------------------------===// /// EmitValue - Emit integer of appropriate size. /// void DIEInteger::EmitValue(AsmPrinter *Asm, unsigned Form) const { unsigned Size = ~0U; switch (Form) { case dwarf::DW_FORM_flag: // Fall thru case dwarf::DW_FORM_ref1: // Fall thru case dwarf::DW_FORM_data1: Size = 1; break; case dwarf::DW_FORM_ref2: // Fall thru case dwarf::DW_FORM_data2: Size = 2; break; case dwarf::DW_FORM_ref4: // Fall thru case dwarf::DW_FORM_data4: Size = 4; break; case dwarf::DW_FORM_ref8: // Fall thru case dwarf::DW_FORM_data8: Size = 8; break; case dwarf::DW_FORM_udata: Asm->EmitULEB128(Integer); return; case dwarf::DW_FORM_sdata: Asm->EmitSLEB128(Integer); return; case dwarf::DW_FORM_addr: Size = Asm->getTargetData().getPointerSize(); break; default: llvm_unreachable("DIE Value form not supported yet"); } Asm->OutStreamer.EmitIntValue(Integer, Size, 0/*addrspace*/); } /// SizeOf - Determine size of integer value in bytes. /// unsigned DIEInteger::SizeOf(AsmPrinter *AP, unsigned Form) const { switch (Form) { case dwarf::DW_FORM_flag: // Fall thru case dwarf::DW_FORM_ref1: // Fall thru case dwarf::DW_FORM_data1: return sizeof(int8_t); case dwarf::DW_FORM_ref2: // Fall thru case dwarf::DW_FORM_data2: return sizeof(int16_t); case dwarf::DW_FORM_ref4: // Fall thru case dwarf::DW_FORM_data4: return sizeof(int32_t); case dwarf::DW_FORM_ref8: // Fall thru case dwarf::DW_FORM_data8: return sizeof(int64_t); case dwarf::DW_FORM_udata: return MCAsmInfo::getULEB128Size(Integer); case dwarf::DW_FORM_sdata: return MCAsmInfo::getSLEB128Size(Integer); case dwarf::DW_FORM_addr: return AP->getTargetData().getPointerSize(); default: llvm_unreachable("DIE Value form not supported yet"); break; } return 0; } #ifndef NDEBUG void DIEInteger::print(raw_ostream &O) { O << "Int: " << (int64_t)Integer << format(" 0x%llx", (unsigned long long)Integer); } #endif //===----------------------------------------------------------------------===// // DIEString Implementation //===----------------------------------------------------------------------===// /// EmitValue - Emit string value. /// void DIEString::EmitValue(AsmPrinter *AP, unsigned Form) const { AP->OutStreamer.EmitBytes(Str, /*addrspace*/0); // Emit nul terminator. AP->OutStreamer.EmitIntValue(0, 1, /*addrspace*/0); } #ifndef NDEBUG void DIEString::print(raw_ostream &O) { O << "Str: \"" << Str << "\""; } #endif //===----------------------------------------------------------------------===// // DIELabel Implementation //===----------------------------------------------------------------------===// /// EmitValue - Emit label value. /// void DIELabel::EmitValue(AsmPrinter *AP, unsigned Form) const { AP->OutStreamer.EmitSymbolValue(Label, SizeOf(AP, Form), 0/*AddrSpace*/); } /// SizeOf - Determine size of label value in bytes. /// unsigned DIELabel::SizeOf(AsmPrinter *AP, unsigned Form) const { if (Form == dwarf::DW_FORM_data4) return 4; return AP->getTargetData().getPointerSize(); } #ifndef NDEBUG void DIELabel::print(raw_ostream &O) { O << "Lbl: " << Label->getName(); } #endif //===----------------------------------------------------------------------===// // DIEDelta Implementation //===----------------------------------------------------------------------===// /// EmitValue - Emit delta value. /// void DIEDelta::EmitValue(AsmPrinter *AP, unsigned Form) const { AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form)); } /// SizeOf - Determine size of delta value in bytes. /// unsigned DIEDelta::SizeOf(AsmPrinter *AP, unsigned Form) const { if (Form == dwarf::DW_FORM_data4) return 4; return AP->getTargetData().getPointerSize(); } #ifndef NDEBUG void DIEDelta::print(raw_ostream &O) { O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName(); } #endif //===----------------------------------------------------------------------===// // DIEEntry Implementation //===----------------------------------------------------------------------===// /// EmitValue - Emit debug information entry offset. /// void DIEEntry::EmitValue(AsmPrinter *AP, unsigned Form) const { AP->EmitInt32(Entry->getOffset()); } #ifndef NDEBUG void DIEEntry::print(raw_ostream &O) { O << format("Die: 0x%lx", (long)(intptr_t)Entry); } #endif //===----------------------------------------------------------------------===// // DIEBlock Implementation //===----------------------------------------------------------------------===// /// ComputeSize - calculate the size of the block. /// unsigned DIEBlock::ComputeSize(AsmPrinter *AP) { if (!Size) { const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData(); for (unsigned i = 0, N = Values.size(); i < N; ++i) Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm()); } return Size; } /// EmitValue - Emit block data. /// void DIEBlock::EmitValue(AsmPrinter *Asm, unsigned Form) const { switch (Form) { default: assert(0 && "Improper form for block"); break; case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break; case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break; case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break; case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break; } const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData(); for (unsigned i = 0, N = Values.size(); i < N; ++i) Values[i]->EmitValue(Asm, AbbrevData[i].getForm()); } /// SizeOf - Determine size of block data in bytes. /// unsigned DIEBlock::SizeOf(AsmPrinter *AP, unsigned Form) const { switch (Form) { case dwarf::DW_FORM_block1: return Size + sizeof(int8_t); case dwarf::DW_FORM_block2: return Size + sizeof(int16_t); case dwarf::DW_FORM_block4: return Size + sizeof(int32_t); case dwarf::DW_FORM_block: return Size + MCAsmInfo::getULEB128Size(Size); default: llvm_unreachable("Improper form for block"); break; } return 0; } #ifndef NDEBUG void DIEBlock::print(raw_ostream &O) { O << "Blk: "; DIE::print(O, 5); } #endif
3,905
2,326
<gh_stars>1000+ // // Copyright RIME Developers // Distributed under the BSD License // // 2011-04-07 <NAME> <<EMAIL>> // #include <gtest/gtest.h> #include <rime/key_table.h> TEST(RimeKeyTableTest, KeycodeLookup) { EXPECT_EQ(kControlMask, RimeGetModifierByName("Control")); EXPECT_EQ(0, RimeGetModifierByName("abracadabra")); EXPECT_EQ(0, RimeGetModifierByName("control")); EXPECT_STREQ("Control", RimeGetModifierName(kControlMask)); EXPECT_STREQ("Release", RimeGetModifierName(kReleaseMask)); EXPECT_STREQ("Control", RimeGetModifierName(kControlMask | kReleaseMask)); } TEST(RimeKeyTableTest, ModifierLookup) { EXPECT_EQ(XK_A, RimeGetKeycodeByName("A")); EXPECT_EQ(XK_z, RimeGetKeycodeByName("z")); EXPECT_EQ(XK_0, RimeGetKeycodeByName("0")); EXPECT_EQ(XK_grave, RimeGetKeycodeByName("grave")); EXPECT_EQ(XK_VoidSymbol, RimeGetKeycodeByName("abracadabra")); EXPECT_EQ(XK_VoidSymbol, RimeGetKeycodeByName("Control+c")); EXPECT_STREQ("a", RimeGetKeyName(XK_a)); EXPECT_STREQ("space", RimeGetKeyName(XK_space)); EXPECT_STREQ(NULL, RimeGetKeyName(0xfffe)); EXPECT_STREQ(NULL, RimeGetKeyName(0xfffffe)); }
488
1,331
<filename>c/meterpreter/source/extensions/peinjector/peinjector.h /*! * @file peinjector.h */ #ifndef _METERPRETER_SOURCE_EXTENSION_PEINJECTOR_H #define _METERPRETER_SOURCE_EXTENSION_PEINJECTOR_H #include "../../common/common.h" #define TLV_TYPE_EXTENSION_PEINJECTOR 0 #define TLV_TYPE_PEINJECTOR_SHELLCODE MAKE_CUSTOM_TLV(TLV_META_TYPE_RAW, TLV_TYPE_EXTENSION_PEINJECTOR, TLV_EXTENSIONS + 1) #define TLV_TYPE_PEINJECTOR_SHELLCODE_SIZE MAKE_CUSTOM_TLV(TLV_META_TYPE_UINT, TLV_TYPE_EXTENSION_PEINJECTOR, TLV_EXTENSIONS + 2) #define TLV_TYPE_PEINJECTOR_SHELLCODE_ISX64 MAKE_CUSTOM_TLV(TLV_META_TYPE_BOOL, TLV_TYPE_EXTENSION_PEINJECTOR, TLV_EXTENSIONS + 3) #define TLV_TYPE_PEINJECTOR_TARGET_EXECUTABLE MAKE_CUSTOM_TLV(TLV_META_TYPE_STRING, TLV_TYPE_EXTENSION_PEINJECTOR, TLV_EXTENSIONS + 4) #define TLV_TYPE_PEINJECTOR_RESULT MAKE_CUSTOM_TLV(TLV_META_TYPE_STRING, TLV_TYPE_EXTENSION_PEINJECTOR, TLV_EXTENSIONS + 5) #endif
477
419
{ "Kirja": "Wiki", "EditPage": "Edit", "StartReview": "Start review", "ShowReviews": "Show reviews", "StopEditPage": "Stop editing", "SavePage": "Save", "DeletePage": "Delete", "CanNotDeleteRootPage": "The root page can not be deleted", "ToggleDropdown": "Toggle dropdown", "Name": "Name", "InsertKirjaLink": "Add link to Kirja page", "InsertAikaQuestLink": "Add link to quest", "InsertKortistoNpcLink": "Add link to npc", "InsertStyrItemLink": "Add link to item", "InsertEvneSkillLink": "Add link to skill", "AreYouSure": "Are you sure?", "AreYouSureYouWantToDeleteThePage": "Are you sure you want to delete the page?", "AreYouSureYouWantToExitEditMode": "Unsaved changes exist. Are you sure you want to leave the edit mode?", "UnsavedChangesWillBeLost": "Unsaved changes will be lost.", "AreYouSureYouWantToDeleteTheAttachment": "Are you sure you want to delete the attachment?", "Yes": "Yes", "No": "No", "WaitingOnNewPage": "Waiting on new page", "DialogWillCloseOnSaveOfNewPage": "This dialog will close as soon as the page is saved or the window is closed. If you save the new page a link will be inserted.<br/><b>Note:</b> This page will be saved in this case.", "InsertTableOfContent": "Add table of content", "TableOfContent": "Table of content", "ToogleSidebar": "Click here to open or close the sidebar", "Connections": "Connections", "MentionedInPages": "Mentioned in wiki pages", "Quests": "Quests", "Npcs": "Npcs", "Dialogs": "Dialogs", "Items": "Items", "Skills": "Skills", "Maps": "Maps", "ExportSnippets": "Export snippets", "MarkedInMapNTimes": "Page is marked in the map {{0}} times. No zoom on marker is possible.", "Attachments": "Attachments", "SaveThePageToUploadFiles": "Save the page to upload files", "DropFilesHereToUpload": "Drop files here to upload...", "DeleteAttachmentToolTip": "Click here to delete the attachment", "ShowVersionsOfPage": "Show versions", "OpenPageOverview": "Open page list", "OnPage": "(On page)", "ReferencedIn": "(Referenced in)", "WordCountPrefix": "Words: ", "Versions": "Versions", "VersionNumber": "#", "ModifiedDate": "Modified Date", "RecentVersion": "Current", "ClickHereToCompareWithCurrentLoadedVersion": "Click here to compare this version with the currently loaded version.", "ClickHereToShowThisVersion": "Click here to load this version.", "Close": "Close", "PreviousPage": "Previous page", "NextPage": "Next page", "RestoreThisVersion": "Restore this version", "AreYouSureYouWantToRestoreThisVersion": "Are you sure you want to restore the current displayed version as the current version?", "DisplayCurrentVersion": "Display current version", "DisplayingVersionNumber": "Displaying version #", "ExitCompare": "Exit compare", "CompareVersionNumber": "Compare version #", "AddedInCurrentVersion": "Added in current version", "RemovedInCurrentVersion": "Removed in current version", "CompareName": "Name of compare version: ", "TheFollowingLinksAreBroken": "The following, in this version of the page, linked objects have been deleted in the meantime:", "TheLinksWillBeDeleted": "The links (no the text) will be deleted. Please make sure that this will not lead to mistakes in the story.", "Npc": "Npc", "Item": "Item", "Skill": "Skill", "Quest": "Quest", "KirjaPage": "KirjaPage", "Reviews": "Reviews", "Status": "Status", "Open": "Open", "Completed": "Completed", "Merged": "Merged", "ReviewsWaitingForMerge": "There are completed reviews which are not yet merged.", "EnterReviewName": "Enter review name", "DirtyMessage": "There are unsaved changes. Are you sure you want to leave the page?", "Error": "Error:", "ErrorOccured": "An error occured.", "PageNotFound": "The page was not found.", "Locked": "Locked", "LockedPrefix": "The page is currently being edited by ", "LockedPostfix": ".", "RichTextLocale": "en", "DropzoneLocale": "en" }
1,537
4,452
/* * Copyright 2012 <NAME>. * * 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.bitcoinj.store; import org.bitcoinj.core.*; /** * <p>An implementor of FullPrunedBlockStore saves StoredBlock objects to some storage mechanism.</p> * * <p>In addition to keeping track of a chain using {@link StoredBlock}s, it should also keep track of a second * copy of the chain which holds {@link StoredUndoableBlock}s. In this way, an application can perform a * headers-only initial sync and then use that information to more efficiently download a locally verified * full copy of the block chain.</p> * * <p>A FullPrunedBlockStore should function well as a standard {@link BlockStore} and then be able to * trivially switch to being used as a FullPrunedBlockStore.</p> * * <p>It should store the {@link StoredUndoableBlock}s of a number of recent blocks before verifiedHead.height and * all those after verifiedHead.height. * It is advisable to store any {@link StoredUndoableBlock} which has a {@code height > verifiedHead.height - N}. * Because N determines the memory usage, it is recommended that N be customizable. N should be chosen such that * re-orgs beyond that point are vanishingly unlikely, for example, a few thousand blocks is a reasonable choice.</p> * * <p>It must store the {@link StoredBlock} of all blocks.</p> * * <p>A FullPrunedBlockStore contains a map of hashes to [Full]StoredBlock. The hash is the double digest of the * Bitcoin serialization of the block header, <b>not</b> the header with the extra data as well.</p> * * <p>A FullPrunedBlockStore also contains a map of hash+index to UTXO. Again, the hash is * a standard Bitcoin double-SHA256 hash of the transaction.</p> * * <p>FullPrunedBlockStores are thread safe.</p> */ public interface FullPrunedBlockStore extends BlockStore, UTXOProvider { /** * <p>Saves the given {@link StoredUndoableBlock} and {@link StoredBlock}. Calculates keys from the {@link StoredBlock}</p> * * <p>Though not required for proper function of a FullPrunedBlockStore, any user of a FullPrunedBlockStore should ensure * that a StoredUndoableBlock for each block up to the fully verified chain head has been added to this block store using * this function (not put(StoredBlock)), so that the ability to perform reorgs is maintained.</p> * * @throws BlockStoreException if there is a problem with the underlying storage layer, such as running out of disk space. */ void put(StoredBlock storedBlock, StoredUndoableBlock undoableBlock) throws BlockStoreException; /** * Returns the StoredBlock that was added as a StoredUndoableBlock given a hash. The returned values block.getHash() * method will be equal to the parameter. If no such block is found, returns null. */ StoredBlock getOnceUndoableStoredBlock(Sha256Hash hash) throws BlockStoreException; /** * Returns a {@link StoredUndoableBlock} whose block.getHash() method will be equal to the parameter. If no such * block is found, returns null. Note that this may return null more often than get(Sha256Hash hash) as not all * {@link StoredBlock}s have a {@link StoredUndoableBlock} copy stored as well. */ StoredUndoableBlock getUndoBlock(Sha256Hash hash) throws BlockStoreException; /** * Gets a {@link UTXO} with the given hash and index, or null if none is found */ UTXO getTransactionOutput(Sha256Hash hash, long index) throws BlockStoreException; /** * Adds a {@link UTXO} to the list of unspent TransactionOutputs */ void addUnspentTransactionOutput(UTXO out) throws BlockStoreException; /** * Removes a {@link UTXO} from the list of unspent TransactionOutputs * Note that the coinbase of the genesis block should NEVER be spendable and thus never in the list. * @throws BlockStoreException if there is an underlying storage issue, or out was not in the list. */ void removeUnspentTransactionOutput(UTXO out) throws BlockStoreException; /** * True if this store has any unspent outputs from a transaction with a hash equal to the first parameter * @param numOutputs the number of outputs the given transaction has */ boolean hasUnspentOutputs(Sha256Hash hash, int numOutputs) throws BlockStoreException; /** * Returns the {@link StoredBlock} that represents the top of the chain of greatest total work that has * been fully verified and the point in the chain at which the unspent transaction output set in this * store represents. */ StoredBlock getVerifiedChainHead() throws BlockStoreException; /** * Sets the {@link StoredBlock} that represents the top of the chain of greatest total work that has been * fully verified. It should generally be set after a batch of updates to the transaction unspent output set, * before a call to commitDatabaseBatchWrite. * * If chainHead has a greater height than the non-verified chain head (ie that set with * {@link BlockStore#setChainHead}) the non-verified chain head should be set to the one set here. * In this way a class using a FullPrunedBlockStore only in full-verification mode can ignore the regular * {@link BlockStore} functions implemented as a part of a FullPrunedBlockStore. */ void setVerifiedChainHead(StoredBlock chainHead) throws BlockStoreException; /** * <p>Begins/Commits/Aborts a database transaction.</p> * * <p>If abortDatabaseBatchWrite() is called by the same thread that called beginDatabaseBatchWrite(), * any data writes between this call and abortDatabaseBatchWrite() made by the same thread * should be discarded.</p> * * <p>Furthermore, any data written after a call to beginDatabaseBatchWrite() should not be readable * by any other threads until commitDatabaseBatchWrite() has been called by this thread. * Multiple calls to beginDatabaseBatchWrite() in any given thread should be ignored and treated as one call.</p> */ void beginDatabaseBatchWrite() throws BlockStoreException; void commitDatabaseBatchWrite() throws BlockStoreException; void abortDatabaseBatchWrite() throws BlockStoreException; }
2,031
376
<gh_stars>100-1000 #pragma once #include <assert.h> #include <stdarg.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/select.h> #include <unistd.h> #include <array> #include <string> #include <utility> #define XSTRINGIFY(x) #x #define STRINGIFY(x) XSTRINGIFY(x) void fatal(const char *fmt, ...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2))); void fatalv(const char *fmt, va_list ap) __attribute__((noreturn)); void fatalPerror(const char *msg) __attribute__((noreturn)); ssize_t writeRestarting(int fd, const void *buf, size_t count); bool writeAllRestarting(int fd, const void *buf, size_t count); ssize_t readRestarting(int fd, void *buf, size_t count); bool readAllRestarting(int fd, void *buf, size_t count); void setSocketNoDelay(int s); struct TermSize { uint16_t cols; uint16_t rows; bool operator==(const TermSize &o) const { return cols == o.cols && rows == o.rows; } bool operator!=(const TermSize &o) const { return !(*this == o); } }; struct WindowParams { int32_t size; // Maximum number of bytes in flight. int32_t threshold; // Minimum remaining window to initiate I/O. }; enum class BridgedErrno : int32_t { Success = 0, Unknown, bE2BIG, bEACCES, bEAGAIN, bEFAULT, bEINVAL, bEIO, bEISDIR, bELIBBAD, bELOOP, bEMFILE, bENAMETOOLONG, bENFILE, bENOENT, bENOEXEC, bENOMEM, bENOTDIR, bEPERM, bETXTBSY, }; struct BridgedError { int32_t actual; BridgedErrno bridged; }; struct SpawnError { enum class Type : int32_t { Success = 0, ForkPtyFailed, ExecFailed, ChdirFailed, } type; BridgedError error; }; BridgedErrno bridgedErrno(int err); BridgedError bridgedError(int err); std::string errorString(BridgedError err); struct Packet { uint32_t size; enum class Type : int32_t { SetSize, IncreaseWindow, SpawnFailed, ChildExitStatus, CloseStdoutPipe } type; union { TermSize termSize; struct { int32_t amount; bool isErrorPipe; } window; int32_t exitStatus; SpawnError spawnError; } u; }; struct PacketSpawnFailed : Packet { char exe[1024]; }; class WakeupFd { public: WakeupFd(); ~WakeupFd() { close(fds_[0]); close(fds_[1]); } void set() { char dummy = 0; writeRestarting(fds_[1], &dummy, 1); } void wait(); private: int readFd() const { return fds_[0]; } fd_set fdset_; int fds_[2]; }; template <typename T, void packetHandlerFunc(T*, const Packet&), void readFailure()> void readControlSocketThread(int controlSocketFd, T *userObj) { union { Packet base; PacketSpawnFailed spawnFailed; } packet = {}; while (true) { if (!readAllRestarting(controlSocketFd, &packet.base, sizeof(packet.base))) { readFailure(); } if (packet.base.size < sizeof(Packet) || packet.base.size > sizeof(packet)) { readFailure(); } if (!readAllRestarting(controlSocketFd, &packet.base + 1, packet.base.size - sizeof(packet.base))) { readFailure(); } packetHandlerFunc(userObj, packet.base); } }
1,634
778
#!/usr/bin/env python3 #----------------------------------------------------------------------------------------------------------------------# # # # Tuplex: Blazing Fast Python Data Science # # # # # # (c) 2017 - 2021, Tuplex team # # Created by <NAME> first on 1/1/2021 # # License: Apache 2.0 # #----------------------------------------------------------------------------------------------------------------------# import unittest from tuplex import * import numpy as np # test fallback functionality, i.e. executing cloudpickled code class TestFallback(unittest.TestCase): def setUp(self): self.conf = {"webui.enable" : False, "driverMemory" : "8MB", "partitionSize" : "256KB"} self.c = Context(self.conf) def testArbitaryObjecsts(self): res = self.c.parallelize([(1, np.zeros(2)), (4, np.zeros(5))]).map(lambda a, b: (a + 1, b)).collect() self.assertEqual(len(res), 2) self.assertEqual(type(res[0][1]), type(np.zeros(2))) self.assertEqual(type(res[1][1]), type(np.zeros(5))) self.assertEqual(res[0][0], len(res[0][1])) self.assertEqual(res[1][0], len(res[1][1])) def testNonSupportedPackage(self): # use here numpy as example and perform some operations via numpy, mix with compiled code! res = self.c.parallelize([1, 2, 3, 4]).map(lambda x: [x, x*x, x*x*x]) \ .map(lambda x: (np.array(x).sum(), np.array(x).mean())).collect() self.assertEqual(len(res), 4) ref = list(map(lambda x: (np.array(x).sum(), np.array(x).mean()), map(lambda x: [x, x*x, x*x*x], [1, 2, 3, 4]))) for i in range(4): self.assertAlmostEqual(res[i][0], ref[i][0]) self.assertAlmostEqual(res[i][1], ref[i][1]) def testAllSamplesAreNormalCaseViolationUDF(self): def allSamplesAreNormalCaseViolationUDF(x): t = 0 if x == 1: t = 1.0 else: t = 'a' if x == 2: t = 2.0 else: t = 'b' if x == 3: t = 3.0 else: t = 4.0 return t res = self.c.parallelize([1, 2, 3]).map(allSamplesAreNormalCaseViolationUDF).collect() self.assertEqual(len(res), 3) self.assertEqual(res[0], allSamplesAreNormalCaseViolationUDF(1)) self.assertEqual(res[1], allSamplesAreNormalCaseViolationUDF(2)) self.assertEqual(res[2], allSamplesAreNormalCaseViolationUDF(3))
1,829
675
#pragma once #include "engine/core/main/module.h" #include "rvo_agent.h" #include "rvo_debug_draw.h" namespace Echo { class RvoModule : public Module { ECHO_SINGLETON_CLASS(RvoModule, Module) public: // Debug draw option enum DebugDrawOption { None, Editor, Game, All }; public: RvoModule(); virtual ~RvoModule(); // Instance static RvoModule* instance(); // Register all types of the module virtual void registerTypes() override; // Update physx world virtual void update(float elapsedTime) override; public: // Rvo simulator RVO::RVOSimulator* getRvoSimulator() { return m_rvoSimulator; } // Debug draw StringOption getDebugDrawOption() const; void setDebugDrawOption(const StringOption& option); private: RVO::RVOSimulator* m_rvoSimulator = nullptr; float m_accumulator = 0.f; RvoDebugDraw m_rvoDebugDraw; DebugDrawOption m_debugDrawOption = DebugDrawOption::Editor; }; }
367
1,875
<gh_stars>1000+ /* * Copyright 2015 <NAME>. * * 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. */ /* * 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. */ /** * @author <NAME> */ package org.teavm.classlib.java.util.regex; /** * Base class for quantifiers. * * @author <NAME> */ abstract class TQuantifierSet extends TAbstractSet { protected TAbstractSet innerSet; public TQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) { super(next); this.innerSet = innerSet; setType(type); } public TAbstractSet getInnerSet() { return innerSet; } /** * Sets an inner set. * * @param innerSet * The innerSet to set. */ public void setInnerSet(TAbstractSet innerSet) { this.innerSet = innerSet; } @Override public boolean first(TAbstractSet set) { return innerSet.first(set) || next.first(set); } @Override public boolean hasConsumed(TMatchResultImpl mr) { return true; } /** * This method is used for traversing nodes after the first stage of * compilation. */ @Override public void processSecondPass() { this.isSecondPassVisited = true; if (next != null) { if (!next.isSecondPassVisited) { /* * Add here code to do during the pass */ TJointSet set = next.processBackRefReplacement(); if (set != null) { next.isSecondPassVisited = true; next = set; } /* * End code to do during the pass */ next.processSecondPass(); } } if (innerSet != null) { if (!innerSet.isSecondPassVisited) { /* * Add here code to do during the pass */ TJointSet set = innerSet.processBackRefReplacement(); if (set != null) { innerSet.isSecondPassVisited = true; innerSet = set; } /* * End code to do during the pass */ innerSet.processSecondPass(); } else { /* * We reach node through innerSet but it is already traversed. * You can see this situation for GroupQuantifierSet.innerset if * we compile smth like "(a)+ when GroupQuantifierSet == * GroupQuantifierSet.innerset.fSet.next */ /* * Add here code to do during the pass */ if (innerSet instanceof TSingleSet && ((TFSet) ((TJointSet) innerSet).fSet).isBackReferenced) { innerSet = innerSet.next; } /* * End code to do during the pass */ } } } }
1,872
1,480
#!/usr/bin/env python3 from setuptools import setup from setuptools.command.build_py import build_py from distutils import log from scudcloud.version import __version__ import glob import os class MinifyJsBuildCommand(build_py): """ Processes JavaScript files with jsmin to yield minified versions. """ description = 'Minify JavaScript sources' jsdir = os.path.join('scudcloud', 'resources') resdir = os.path.join('scudcloud', 'resources') def minify(self, source, target): import jsmin js = jsmin.jsmin(open(source).read()) with open(target, 'w') as f: f.write(js) log.info('minified js written to %s' % target) def run(self): # run this first - creates the target dirs build_py.run(self) log.info('minifying js under %s' % self.jsdir) jsfiles = glob.glob(os.path.join(self.jsdir, '*.js')) for jsfile in jsfiles: target = os.path.join(self.build_lib, self.resdir, os.path.basename(jsfile)) self.minify(jsfile, target) def _data_files(): for theme in ['hicolor', 'ubuntu-mono-dark', 'ubuntu-mono-light', 'elementary']: directory = os.path.join('share', 'icons', theme, 'scalable', 'apps') files = glob.glob(os.path.join('share', 'icons', theme, '*.svg')) yield directory, files yield os.path.join('share', 'doc', 'scudcloud'), \ ['LICENSE', 'README'] yield os.path.join('share', 'applications'), \ glob.glob(os.path.join('share', '*.desktop')) yield os.path.join('share', 'pixmaps'), \ glob.glob(os.path.join('scudcloud', 'resources', 'scudcloud.png')) setup(name='scudcloud', author='<NAME>', author_email='<EMAIL>', data_files=list(_data_files()), description='ScudCloud is a non official desktop client for Slack', entry_points = { 'gui_scripts': ['scudcloud = scudcloud.__main__:main'], }, keywords = "slack chat im instant_message", license = "MIT", maintainer='<NAME>', maintainer_email='<EMAIL>', package_data = { # *.js will be processed separately 'scudcloud': ['resources/*.css', 'resources/*.html', 'resources/*.png',] }, packages=['scudcloud',], requires=['dbus', 'PyQt5',], url='https://github.com/raelgc/scudcloud', version = __version__, setup_requires=['jsmin',], cmdclass = { 'build_py': MinifyJsBuildCommand, }, )
1,058
368
// // UITabBar+SubView.h // TeamTalk // // Created by 宪法 on 15/6/24. // Copyright (c) 2015年 MoguIM. All rights reserved. // #import <UIKit/UIKit.h> @interface UITabBar (SubView) -(UIView *)barButtonWithTitle:(NSString *)title; -(UIImageView *)tabBarButtonImageViewWithTitle:(NSString *)title; @end
124
619
/** * This file is part of CubeSLAM * * Copyright (C) 2018 <NAME> (<NAME> Univ) */ #include "Thirdparty/g2o/g2o/types/types_six_dof_expmap.h" #include "detect_3d_cuboid/matrix_utils.h" #include "g2o_Object.h" #include <Eigen/Core> #include <Eigen/Geometry> #include <Eigen/Dense> #include <math.h> #include <algorithm> // std::swap namespace g2o { using namespace Eigen; using namespace std; SE3Quat exptwist_norollpitch(const Vector6d &update) { Vector3d omega; for (int i = 0; i < 3; i++) omega[i] = update[i]; Vector3d upsilon; for (int i = 0; i < 3; i++) upsilon[i] = update[i + 3]; double theta = omega.norm(); Matrix3d Omega = skew(omega); Matrix3d R; R << cos(omega(2)), -sin(omega(2)), 0, sin(omega(2)), cos(omega(2)), 0, 0, 0, 1; Matrix3d V; if (theta < 0.00001) { V = R; } else { Matrix3d Omega2 = Omega * Omega; V = (Matrix3d::Identity() + (1 - cos(theta)) / (theta * theta) * Omega + (theta - sin(theta)) / (pow(theta, 3)) * Omega2); } return SE3Quat(Quaterniond(R), V * upsilon); } void VertexCuboid::oplusImpl(const double *update_) { Eigen::Map<const Vector9d> update(update_); g2o::cuboid newcube; if (whether_fixrotation) { newcube.pose.setTranslation(_estimate.pose.translation() + update.segment<3>(3)); } else if (whether_fixrollpitch) //NOTE this only works for cuboid already has parallel to ground. otherwise update_z will also change final RPY { Vector9d update2 = update; update2(0) = 0; update2(1) = 0; newcube.pose = _estimate.pose * exptwist_norollpitch(update2.head<6>()); //NOTE object pose is from object to world!!!! } else newcube.pose = _estimate.pose * SE3Quat::exp(update.head<6>()); if (whether_fixheight) // use previous height newcube.setTranslation(Vector3d(newcube.translation()(0), _estimate.translation()(1), newcube.translation()(2))); if (fixedscale(0) > 0) // if fixed scale is set, use it. newcube.scale = fixedscale; else newcube.scale = _estimate.scale + update.tail<3>(); setEstimate(newcube); } // similar as above void VertexCuboidFixScale::oplusImpl(const double *update_) { Eigen::Map<const Vector6d> update(update_); g2o::cuboid newcube; if (whether_fixrotation) { newcube.pose.setRotation(_estimate.pose.rotation()); newcube.pose.setTranslation(_estimate.pose.translation() + update.tail<3>()); } else if (whether_fixrollpitch) { Vector6d update2 = update; update2(0) = 0; update2(1) = 0; newcube.pose = _estimate.pose * exptwist_norollpitch(update2); } else newcube.pose = _estimate.pose * SE3Quat::exp(update); if (whether_fixheight) newcube.setTranslation(Vector3d(newcube.translation()(0), _estimate.translation()(1), newcube.translation()(2))); if (fixedscale(0) > 0) newcube.scale = fixedscale; else newcube.scale = _estimate.scale; setEstimate(newcube); } void EdgeSE3CuboidFixScaleProj::computeError() { const VertexSE3Expmap *SE3Vertex = dynamic_cast<const VertexSE3Expmap *>(_vertices[0]); // world to camera pose const VertexCuboidFixScale *cuboidVertex = dynamic_cast<const VertexCuboidFixScale *>(_vertices[1]); // object pose to world SE3Quat cam_pose_Tcw = SE3Vertex->estimate(); cuboid global_cube = cuboidVertex->estimate(); Vector4d rect_project = global_cube.projectOntoImageBbox(cam_pose_Tcw, Kalib); // center, width, height _error = rect_project - _measurement; } double EdgeSE3CuboidFixScaleProj::get_error_norm() { computeError(); return _error.norm(); } void EdgeSE3CuboidProj::computeError() { const VertexSE3Expmap *SE3Vertex = dynamic_cast<const VertexSE3Expmap *>(_vertices[0]); // world to camera pose const VertexCuboid *cuboidVertex = dynamic_cast<const VertexCuboid *>(_vertices[1]); // object pose to world SE3Quat cam_pose_Tcw = SE3Vertex->estimate(); cuboid global_cube = cuboidVertex->estimate(); Vector4d rect_project = global_cube.projectOntoImageBbox(cam_pose_Tcw, Kalib); // center, width, height _error = rect_project - _measurement; } double EdgeSE3CuboidProj::get_error_norm() { computeError(); return _error.norm(); } void EdgeDynamicPointCuboidCamera::computeError() { const VertexSE3Expmap *SE3Vertex = dynamic_cast<const VertexSE3Expmap *>(_vertices[0]); // world to camera pose const VertexCuboidFixScale *cuboidVertex = dynamic_cast<const VertexCuboidFixScale *>(_vertices[1]); // object to world pose const VertexSBAPointXYZ *pointVertex = dynamic_cast<const VertexSBAPointXYZ *>(_vertices[2]); // point to object pose Vector3d localpt = SE3Vertex->estimate() * (cuboidVertex->estimate().pose * pointVertex->estimate()); Vector2d projected = Vector2d(Kalib(0, 2) + Kalib(0, 0) * localpt(0) / localpt(2), Kalib(1, 2) + Kalib(1, 1) * localpt(1) / localpt(2)); _error = _measurement - projected; } void EdgeDynamicPointCuboidCamera::linearizeOplus() { const VertexSE3Expmap *SE3Vertex = dynamic_cast<const VertexSE3Expmap *>(_vertices[0]); // world to camera pose const VertexCuboidFixScale *cuboidVertex = dynamic_cast<const VertexCuboidFixScale *>(_vertices[1]); // object to world pose const VertexSBAPointXYZ *pointVertex = dynamic_cast<const VertexSBAPointXYZ *>(_vertices[2]); // point to object pose Vector3d objectpt = pointVertex->estimate(); SE3Quat combinedT = SE3Vertex->estimate() * cuboidVertex->estimate().pose; Vector3d camerapt = combinedT * objectpt; double fx = Kalib(0, 0); double fy = Kalib(1, 1); double x = camerapt[0]; double y = camerapt[1]; double z = camerapt[2]; double z_2 = z * z; Matrix<double, 2, 3> projptVscamerapt; //2d projected pixel / 3D local camera pt projptVscamerapt(0, 0) = fx / z; projptVscamerapt(0, 1) = 0; projptVscamerapt(0, 2) = -x * fx / z_2; projptVscamerapt(1, 0) = 0; projptVscamerapt(1, 1) = fy / z; projptVscamerapt(1, 2) = -y * fy / z_2; // jacobian of point _jacobianOplus[2] = -projptVscamerapt * combinedT.rotation().toRotationMatrix(); // jacobian of camera _jacobianOplus[0](0, 0) = x * y / z_2 * fx; _jacobianOplus[0](0, 1) = -(1 + (x * x / z_2)) * fx; _jacobianOplus[0](0, 2) = y / z * fx; _jacobianOplus[0](0, 3) = -1. / z * fx; _jacobianOplus[0](0, 4) = 0; _jacobianOplus[0](0, 5) = x / z_2 * fx; _jacobianOplus[0](1, 0) = (1 + y * y / z_2) * fy; _jacobianOplus[0](1, 1) = -x * y / z_2 * fy; _jacobianOplus[0](1, 2) = -x / z * fy; _jacobianOplus[0](1, 3) = 0; _jacobianOplus[0](1, 4) = -1. / z * fy; _jacobianOplus[0](1, 5) = y / z_2 * fy; // jacobian of object pose. obj twist [angle position] Matrix<double, 3, 6> skewjaco; skewjaco.leftCols<3>() = -skew(objectpt); skewjaco.rightCols<3>() = Matrix3d::Identity(); _jacobianOplus[1] = _jacobianOplus[2] * skewjaco; //2*6 if (cuboidVertex->whether_fixrollpitch) //zero gradient for roll/pitch { _jacobianOplus[1](0, 0) = 0; _jacobianOplus[1](0, 1) = 0; _jacobianOplus[1](1, 0) = 0; _jacobianOplus[1](1, 1) = 0; } if (cuboidVertex->whether_fixrotation) { _jacobianOplus[1](0, 0) = 0; _jacobianOplus[1](0, 1) = 0; _jacobianOplus[1](1, 0) = 0; _jacobianOplus[1](1, 1) = 0; _jacobianOplus[1](0, 2) = 0; _jacobianOplus[1](1, 2) = 0; } } Vector2d EdgeDynamicPointCuboidCamera::computeError_debug() { computeError(); return _error; } void EdgeObjectMotion::computeError() { const VertexCuboidFixScale *cuboidVertexfrom = dynamic_cast<const VertexCuboidFixScale *>(_vertices[0]); // object to world pose const VertexCuboidFixScale *cuboidVertexto = dynamic_cast<const VertexCuboidFixScale *>(_vertices[1]); // object to world pose const VelocityPlanarVelocity *velocityVertex = dynamic_cast<const VelocityPlanarVelocity *>(_vertices[2]); // object to world pose if (cuboidVertexfrom == nullptr || cuboidVertexto == nullptr || velocityVertex == nullptr) cout << "Bad casting when compute Edge motion error!!!!!!!!!!!!!" << endl; // predict motion x y yaw and compute measurement. SE3Quat posefrom = cuboidVertexfrom->estimate().pose; double yaw_from = posefrom.toXYZPRYVector()(5); SE3Quat poseto = cuboidVertexto->estimate().pose; double yaw_to = poseto.toXYZPRYVector()(5); Vector2d velocity = velocityVertex->estimate(); //v w linear velocity and steer angle const double vehicle_length = 2.71; // front and back wheels distance // vehicle motion model is applied to back wheel center Vector3d trans_back_pred = posefrom.translation() + (velocity(0) * delta_t - vehicle_length * 0.5) * Vector3d(cos(yaw_from), sin(yaw_from), 0); double yaw_pred = yaw_from + tan(velocity(1)) * delta_t / vehicle_length * velocity(0); // as mentioned in paper: my object frame is at the center. the motion model applies to back wheen center. have offset. Vector3d trans_pred = trans_back_pred + vehicle_length * 0.5 * Vector3d(cos(yaw_pred), sin(yaw_pred), 0); _error = Vector3d(poseto.translation()[0], poseto.translation()[1], yaw_to) - Vector3d(trans_pred(0), trans_pred(1), yaw_pred); if (_error[2] > 2.0 * M_PI) _error[2] -= 2.0 * M_PI; if (_error[2] < -2.0 * M_PI) _error[2] += 2.0 * M_PI; } Vector3d EdgeObjectMotion::computeError_debug() { computeError(); return _error; } Vector3d cuboid::point_boundary_error(const Vector3d &world_point, const double max_outside_margin_ratio, double point_scale) const { // transform the point to local object frame TODO actually can compute gradient analytically... Vector3d local_pt = point_scale * (this->pose.inverse() * world_point).cwiseAbs(); // change global point to local cuboid body frame. make it positive. Vector3d error; // if point is within the cube, error=0, otherwise penalty how far it is outside cube for (int i = 0; i < 3; i++) { if (local_pt(i) < this->scale(i)) error(i) = 0; else if (local_pt(i) < (max_outside_margin_ratio + 1) * this->scale(i)) error(i) = local_pt(i) - this->scale(i); else error(i) = max_outside_margin_ratio * this->scale(i); // if points two far, give a constant error, don't optimize. } return error; } void EdgePointCuboidOnlyObject::computeError() { const VertexCuboid *cuboidVertex = dynamic_cast<const VertexCuboid *>(_vertices[0]); // world to camera pose _error.setZero(); const g2o::cuboid &estimate_cube = cuboidVertex->estimate(); Vector3d point_edge_error; point_edge_error.setZero(); for (size_t i = 0; i < object_points.size(); i++) // use abs otherwise pos neg will counteract by different pts. maybe each edge one pt? point_edge_error += estimate_cube.point_boundary_error(object_points[i], max_outside_margin_ratio).cwiseAbs(); if (object_points.size() > 0) point_edge_error = point_edge_error / object_points.size(); point_edge_error = point_edge_error.array() / estimate_cube.scale.array(); //scale it // add prior shape dimension error? double prior_weight = 0.2; Vector3d prior_shape_error = estimate_cube.scale; // setZero? or penalize large box! or set a range? if (prior_object_half_size(0) > 0) // if prior shape is being set, such as KITTI, then give large weight for shape error { prior_weight = 50.0; prior_shape_error = ((estimate_cube.scale - prior_object_half_size).array() / prior_object_half_size.array()).cwiseAbs(); } _error = 1.0 * point_edge_error + prior_weight * prior_shape_error; } Vector3d EdgePointCuboidOnlyObject::computeError_debug() { computeError(); return _error; } // similar as above void EdgePointCuboidOnlyObjectFixScale::computeError() { const VertexCuboidFixScale *cuboidVertex = dynamic_cast<const VertexCuboidFixScale *>(_vertices[0]); // world to camera pose _error.setZero(); const g2o::cuboid &estimate_cube = cuboidVertex->estimate(); Vector3d point_edge_error; point_edge_error.setZero(); for (size_t i = 0; i < object_points.size(); i++) point_edge_error += estimate_cube.point_boundary_error(object_points[i], max_outside_margin_ratio).cwiseAbs(); if (object_points.size() > 0) point_edge_error = point_edge_error / object_points.size(); point_edge_error = point_edge_error.array() / estimate_cube.scale.array(); _error = 1.0 * point_edge_error; } void EdgePointCuboid::computeError() { const VertexSBAPointXYZ *pointVertex = dynamic_cast<const VertexSBAPointXYZ *>(_vertices[0]); // point position const VertexCuboid *cuboidVertex = dynamic_cast<const VertexCuboid *>(_vertices[1]); // object pose to world const g2o::cuboid estimate_cube = cuboidVertex->estimate(); Vector3d point_edge_error = estimate_cube.point_boundary_error(pointVertex->estimate(), max_outside_margin_ratio).cwiseAbs(); // abs to add shape error point_edge_error = point_edge_error.array() / estimate_cube.scale.array(); // add prior shape dimension error? double prior_weight = 0.2; Vector3d prior_shape_error = estimate_cube.scale; // setZero? or penalize large box! or set a range? _error = 1.0 * point_edge_error + prior_weight * prior_shape_error; } void EdgePointCuboidFixScale::computeError() { const VertexSBAPointXYZ *pointVertex = dynamic_cast<const VertexSBAPointXYZ *>(_vertices[0]); // point position const VertexCuboidFixScale *cuboidVertex = dynamic_cast<const VertexCuboidFixScale *>(_vertices[1]); // object pose to world const g2o::cuboid estimate_cube = cuboidVertex->estimate(); Vector3d point_edge_error = estimate_cube.point_boundary_error(pointVertex->estimate(), max_outside_margin_ratio).cwiseAbs(); // abs to add shape error point_edge_error = point_edge_error.array() / estimate_cube.scale.array(); _error = 1.0 * point_edge_error; } void UnaryLocalPoint::computeError() { // transform the point to local object frame const VertexSBAPointXYZ *pointVertex = dynamic_cast<const VertexSBAPointXYZ *>(_vertices[0]); // point position Vector3d local_pt = pointVertex->estimate().cwiseAbs(); // make it positive. Vector3d point_edge_error; // if point is within the cube, point_edge_error=0, otherwise penalty how far it is outside cube for (int i = 0; i < 3; i++) { if (local_pt(i) < objectscale(i)) point_edge_error(i) = 0; else if (local_pt(i) < (max_outside_margin_ratio + 1) * objectscale(i)) point_edge_error(i) = local_pt(i) - objectscale(i); else point_edge_error(i) = max_outside_margin_ratio * objectscale(i); // if points two far, give a constant error, don't optimize. } _error = point_edge_error.array() / objectscale.array(); } } // namespace g2o
6,273
308
<filename>ddtrace/internal/utils/version.py import typing import packaging.version def parse_version(version): # type: (str) -> typing.Tuple[int, int, int] """Convert a version string to a tuple of (major, minor, micro) Examples:: 1.2.3 -> (1, 2, 3) 1.2 -> (1, 2, 0) 1 -> (1, 0, 0) 1.0.0-beta1 -> (1, 0, 0) 2020.6.19 -> (2020, 6, 19) malformed -> (0, 0, 0) 10.5.0 extra -> (10, 5, 0) """ # If we have any spaces/extra text, grab the first part # "1.0.0 beta1" -> "1.0.0" # "1.0.0" -> "1.0.0" # DEV: Versions with spaces will get converted to LegacyVersion, we do this splitting # to maximize the chances of getting a Version as a parsing result if " " in version: version = version.split()[0] # version() will not raise an exception, if the version if malformed instead # we will end up with a LegacyVersion parsed = packaging.version.parse(version) # LegacyVersion.release will always be `None` if not parsed.release: return (0, 0, 0) # Version.release was added in 17.1 # packaging >= 20.0 has `Version.{major,minor,micro}`, use the following # to support older versions of the library # https://github.com/pypa/packaging/blob/47d40f640fddb7c97b01315419b6a1421d2dedbb/packaging/version.py#L404-L417 return ( parsed.release[0] if len(parsed.release) >= 1 else 0, parsed.release[1] if len(parsed.release) >= 2 else 0, parsed.release[2] if len(parsed.release) >= 3 else 0, )
700
20,996
{"index":51,"lineNumber":1,"column":52,"message":"Error: Line 1: Duplicate __proto__ fields are not allowed in object literals","description":"Duplicate __proto__ fields are not allowed in object literals"}
54
1,352
/* * 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. */ #pragma once #include <dsn/service_api_cpp.h> #include <dsn/tool-api/zlocks.h> #include <unordered_map> #include <functional> namespace pegasus { namespace proxy { DEFINE_TASK_CODE_RPC(RPC_CALL_RAW_SESSION_DISCONNECT, TASK_PRIORITY_COMMON, ::dsn::THREAD_POOL_DEFAULT) DEFINE_TASK_CODE_RPC(RPC_CALL_RAW_MESSAGE, TASK_PRIORITY_COMMON, ::dsn::THREAD_POOL_DEFAULT) class proxy_stub; class proxy_session : public std::enable_shared_from_this<proxy_session> { public: typedef std::function<std::shared_ptr<proxy_session>(proxy_stub *p, dsn::message_ex *first_msg)> factory; proxy_session(proxy_stub *p, dsn::message_ex *first_msg); virtual ~proxy_session(); // on_recv_request & on_remove_session are called by proxy_stub when messages are got from // underlying rpc engine. // // then rpc engine ensures that on_recv_request for one proxy_session // won't be called concurrently. that is to say: another on_recv_requst // may happen only after the first one returns // // however, during the running of on_recv_request, an "on_remove_session" may be called, // the proxy_session and its derived class may need to do some synchronization on this. void on_recv_request(dsn::message_ex *msg); void on_remove_session(); protected: // return true if parse ok virtual bool parse(dsn::message_ex *msg) = 0; dsn::message_ex *create_response(); protected: proxy_stub *_stub; std::atomic_bool _is_session_reset; // when get message from raw parser, request & response of "dsn::message_ex*" are not in couple. // we need to backup one request to create a response struct. dsn::message_ex *_backup_one_request; // the client address for which this session served dsn::rpc_address _remote_address; }; class proxy_stub : public ::dsn::serverlet<proxy_stub> { public: proxy_stub(const proxy_session::factory &f, const char *cluster, const char *app, const char *geo_app = ""); const char *get_cluster() const { return _cluster.c_str(); } const char *get_app() const { return _app.c_str(); } const char *get_geo_app() const { return _geo_app.c_str(); } void open_service() { this->register_rpc_handler( RPC_CALL_RAW_MESSAGE, "raw_message", &proxy_stub::on_rpc_request); this->register_rpc_handler(RPC_CALL_RAW_SESSION_DISCONNECT, "raw_session_disconnect", &proxy_stub::on_recv_remove_session_request); } void close_service() { this->unregister_rpc_handler(RPC_CALL_RAW_MESSAGE); this->unregister_rpc_handler(RPC_CALL_RAW_SESSION_DISCONNECT); } void remove_session(dsn::rpc_address remote_address); private: void on_rpc_request(dsn::message_ex *request); void on_recv_remove_session_request(dsn::message_ex *); ::dsn::zrwlock_nr _lock; std::unordered_map<::dsn::rpc_address, std::shared_ptr<proxy_session>> _sessions; proxy_session::factory _factory; ::dsn::rpc_address _uri_address; std::string _cluster; std::string _app; std::string _geo_app; }; } // namespace proxy } // namespace pegasus
1,571
880
<gh_stars>100-1000 /** * Copyright 2019 <NAME> * * 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 ch.qos.logback.classic.issue.lbclassic323; import ch.qos.logback.core.Context; import ch.qos.logback.core.ContextBase; public class Barebones { public static void main(String[] args) { Context context = new ContextBase(); for(int i = 0; i < 3; i++) { SenderRunnable senderRunnable = new SenderRunnable(""+i); context.getScheduledExecutorService().execute(senderRunnable); } System.out.println("done"); //System.exit(0); } static class SenderRunnable implements Runnable { String id; SenderRunnable(String id) { this.id = id; } public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { } System.out.println("SenderRunnable " +id); } } }
475
327
unsigned char rawData[7680] = { 0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4, 0x09, 0xCD, 0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x20, 0x63, 0x61, 0x6E, 0x6E, 0x6F, 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x44, 0x4F, 0x53, 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0D, 0x0A, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x03, 0x00, 0x6D, 0x8F, 0xAB, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x22, 0x00, 0x0B, 0x01, 0x30, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9E, 0x33, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x40, 0x85, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x33, 0x00, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xFC, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0xA4, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x2E, 0x72, 0x73, 0x72, 0x63, 0x00, 0x00, 0x00, 0xFC, 0x05, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2E, 0x72, 0x65, 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x48, 0x23, 0x00, 0x00, 0x3C, 0x0F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x30, 0x08, 0x00, 0x4D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x11, 0x73, 0x0F, 0x00, 0x00, 0x0A, 0x0A, 0x72, 0x01, 0x00, 0x00, 0x70, 0x20, 0x9B, 0x01, 0x02, 0x00, 0x16, 0x73, 0x10, 0x00, 0x00, 0x0A, 0x0B, 0x72, 0x13, 0x00, 0x00, 0x70, 0x20, 0x9B, 0x01, 0x02, 0x00, 0x17, 0x73, 0x10, 0x00, 0x00, 0x0A, 0x0C, 0x06, 0x07, 0x6F, 0x11, 0x00, 0x00, 0x0A, 0x06, 0x08, 0x6F, 0x11, 0x00, 0x00, 0x0A, 0x02, 0x19, 0x1F, 0x0A, 0x16, 0x16, 0x20, 0x00, 0x80, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x00, 0x06, 0x73, 0x12, 0x00, 0x00, 0x0A, 0x2A, 0x00, 0x00, 0x00, 0x1B, 0x30, 0x03, 0x00, 0xF9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x11, 0x14, 0x0A, 0x02, 0x28, 0x01, 0x00, 0x00, 0x06, 0x0A, 0xDE, 0x03, 0x26, 0xDE, 0x00, 0x06, 0x2D, 0x06, 0x17, 0x28, 0x05, 0x00, 0x00, 0x06, 0x00, 0x06, 0x6F, 0x13, 0x00, 0x00, 0x0A, 0xDE, 0x0C, 0x26, 0x06, 0x6F, 0x14, 0x00, 0x00, 0x0A, 0xDD, 0xCC, 0x00, 0x00, 0x00, 0x06, 0x73, 0x15, 0x00, 0x00, 0x0A, 0x0B, 0x07, 0x17, 0x6F, 0x16, 0x00, 0x00, 0x0A, 0x73, 0x17, 0x00, 0x00, 0x0A, 0x0C, 0x08, 0x73, 0x0B, 0x00, 0x00, 0x06, 0x6F, 0x18, 0x00, 0x00, 0x0A, 0x73, 0x19, 0x00, 0x00, 0x0A, 0x0D, 0x28, 0x1A, 0x00, 0x00, 0x0A, 0x13, 0x04, 0x16, 0x13, 0x05, 0x2B, 0x3E, 0x11, 0x04, 0x11, 0x05, 0x9A, 0x13, 0x06, 0x73, 0x08, 0x00, 0x00, 0x06, 0x13, 0x07, 0x11, 0x07, 0x11, 0x06, 0x28, 0x03, 0x00, 0x00, 0x06, 0x7D, 0x06, 0x00, 0x00, 0x04, 0xDE, 0x12, 0x13, 0x08, 0x11, 0x07, 0x11, 0x08, 0x6F, 0x1B, 0x00, 0x00, 0x0A, 0x7D, 0x07, 0x00, 0x00, 0x04, 0xDE, 0x00, 0x09, 0x11, 0x07, 0x6F, 0x1C, 0x00, 0x00, 0x0A, 0x11, 0x05, 0x17, 0x58, 0x13, 0x05, 0x11, 0x05, 0x11, 0x04, 0x8E, 0x69, 0x32, 0xBA, 0x09, 0x6F, 0x1D, 0x00, 0x00, 0x0A, 0x13, 0x09, 0x2B, 0x12, 0x12, 0x09, 0x28, 0x1E, 0x00, 0x00, 0x0A, 0x13, 0x0A, 0x08, 0x06, 0x11, 0x0A, 0x6F, 0x1F, 0x00, 0x00, 0x0A, 0x12, 0x09, 0x28, 0x20, 0x00, 0x00, 0x0A, 0x2D, 0xE5, 0xDE, 0x0E, 0x12, 0x09, 0xFE, 0x16, 0x02, 0x00, 0x00, 0x1B, 0x6F, 0x21, 0x00, 0x00, 0x0A, 0xDC, 0x08, 0x06, 0x73, 0x09, 0x00, 0x00, 0x06, 0x6F, 0x1F, 0x00, 0x00, 0x0A, 0xDE, 0x0A, 0x07, 0x2C, 0x06, 0x07, 0x6F, 0x21, 0x00, 0x00, 0x0A, 0xDC, 0x06, 0x6F, 0x22, 0x00, 0x00, 0x0A, 0x2D, 0xF8, 0x2A, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x0B, 0x00, 0x03, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x18, 0x00, 0x08, 0x20, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x6B, 0x00, 0x10, 0x7B, 0x00, 0x12, 0x18, 0x00, 0x00, 0x01, 0x02, 0x00, 0xAB, 0x00, 0x1F, 0xCA, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x33, 0x00, 0xB3, 0xE6, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x30, 0x07, 0x00, 0x9A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x11, 0x14, 0x0A, 0x02, 0x6F, 0x23, 0x00, 0x00, 0x0A, 0x0C, 0x12, 0x02, 0x28, 0x24, 0x00, 0x00, 0x0A, 0x02, 0x6F, 0x23, 0x00, 0x00, 0x0A, 0x0C, 0x12, 0x02, 0x28, 0x25, 0x00, 0x00, 0x0A, 0x73, 0x26, 0x00, 0x00, 0x0A, 0x0B, 0x07, 0x28, 0x27, 0x00, 0x00, 0x0A, 0x0D, 0x09, 0x02, 0x6F, 0x23, 0x00, 0x00, 0x0A, 0x0C, 0x12, 0x02, 0x28, 0x28, 0x00, 0x00, 0x0A, 0x02, 0x6F, 0x23, 0x00, 0x00, 0x0A, 0x0C, 0x12, 0x02, 0x28, 0x29, 0x00, 0x00, 0x0A, 0x16, 0x16, 0x07, 0x6F, 0x2A, 0x00, 0x00, 0x0A, 0x20, 0x20, 0x00, 0xCC, 0x00, 0x6F, 0x2B, 0x00, 0x00, 0x0A, 0x73, 0x2C, 0x00, 0x00, 0x0A, 0x13, 0x04, 0x07, 0x11, 0x04, 0x28, 0x2D, 0x00, 0x00, 0x0A, 0x6F, 0x2E, 0x00, 0x00, 0x0A, 0x11, 0x04, 0x6F, 0x2F, 0x00, 0x00, 0x0A, 0x0A, 0xDE, 0x20, 0x11, 0x04, 0x2C, 0x07, 0x11, 0x04, 0x6F, 0x21, 0x00, 0x00, 0x0A, 0xDC, 0x09, 0x2C, 0x06, 0x09, 0x6F, 0x21, 0x00, 0x00, 0x0A, 0xDC, 0x07, 0x2C, 0x06, 0x07, 0x6F, 0x21, 0x00, 0x00, 0x0A, 0xDC, 0x06, 0x2A, 0x00, 0x00, 0x01, 0x28, 0x00, 0x00, 0x02, 0x00, 0x61, 0x00, 0x17, 0x78, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2B, 0x00, 0x59, 0x84, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x24, 0x00, 0x6A, 0x8E, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x06, 0x2A, 0x1E, 0x02, 0x28, 0x30, 0x00, 0x00, 0x0A, 0x2A, 0x1E, 0x02, 0x28, 0x31, 0x00, 0x00, 0x0A, 0x2A, 0x2E, 0x73, 0x17, 0x00, 0x00, 0x0A, 0x80, 0x01, 0x00, 0x00, 0x04, 0x2A, 0x1E, 0x02, 0x28, 0x31, 0x00, 0x00, 0x0A, 0x2A, 0x1E, 0x02, 0x28, 0x31, 0x00, 0x00, 0x0A, 0x2A, 0x00, 0x00, 0x13, 0x30, 0x02, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x72, 0x23, 0x00, 0x00, 0x70, 0x28, 0x32, 0x00, 0x00, 0x0A, 0x2C, 0x0B, 0xD0, 0x04, 0x00, 0x00, 0x02, 0x28, 0x33, 0x00, 0x00, 0x0A, 0x2A, 0x04, 0x72, 0x4F, 0x00, 0x00, 0x70, 0x28, 0x32, 0x00, 0x00, 0x0A, 0x2C, 0x0B, 0xD0, 0x05, 0x00, 0x00, 0x02, 0x28, 0x33, 0x00, 0x00, 0x0A, 0x2A, 0x72, 0x91, 0x00, 0x00, 0x70, 0x72, 0xB1, 0x00, 0x00, 0x70, 0x73, 0x34, 0x00, 0x00, 0x0A, 0x7A, 0x1E, 0x02, 0x28, 0x35, 0x00, 0x00, 0x0A, 0x2A, 0x42, 0x53, 0x4A, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x76, 0x34, 0x2E, 0x30, 0x2E, 0x33, 0x30, 0x33, 0x31, 0x39, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x6C, 0x00, 0x00, 0x00, 0xD0, 0x04, 0x00, 0x00, 0x23, 0x7E, 0x00, 0x00, 0x3C, 0x05, 0x00, 0x00, 0xD0, 0x06, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x73, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00, 0xC4, 0x00, 0x00, 0x00, 0x23, 0x55, 0x53, 0x00, 0xD0, 0x0C, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0xE0, 0x0C, 0x00, 0x00, 0x5C, 0x02, 0x00, 0x00, 0x23, 0x42, 0x6C, 0x6F, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x57, 0x1D, 0x02, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x33, 0x00, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x72, 0x02, 0xA7, 0x05, 0x06, 0x00, 0xDF, 0x02, 0xA7, 0x05, 0x06, 0x00, 0xA6, 0x01, 0x6A, 0x05, 0x0F, 0x00, 0xC7, 0x05, 0x00, 0x00, 0x06, 0x00, 0xCE, 0x01, 0x45, 0x04, 0x06, 0x00, 0x55, 0x02, 0x45, 0x04, 0x06, 0x00, 0x36, 0x02, 0x45, 0x04, 0x06, 0x00, 0xC6, 0x02, 0x45, 0x04, 0x06, 0x00, 0x92, 0x02, 0x45, 0x04, 0x06, 0x00, 0xAB, 0x02, 0x45, 0x04, 0x06, 0x00, 0xE5, 0x01, 0x45, 0x04, 0x06, 0x00, 0xBA, 0x01, 0x88, 0x05, 0x06, 0x00, 0x98, 0x01, 0x88, 0x05, 0x06, 0x00, 0x19, 0x02, 0x45, 0x04, 0x06, 0x00, 0x00, 0x02, 0x4D, 0x03, 0x06, 0x00, 0x38, 0x06, 0xEE, 0x03, 0x06, 0x00, 0xE5, 0x04, 0x86, 0x06, 0x0A, 0x00, 0xC3, 0x03, 0xD6, 0x05, 0x0A, 0x00, 0xC1, 0x06, 0xD6, 0x05, 0x0A, 0x00, 0x2B, 0x01, 0xD6, 0x05, 0x06, 0x00, 0xD8, 0x04, 0x15, 0x00, 0x06, 0x00, 0x01, 0x00, 0x44, 0x00, 0x0E, 0x00, 0x02, 0x04, 0xEB, 0x05, 0x06, 0x00, 0x7F, 0x04, 0xEE, 0x03, 0x5B, 0x00, 0x49, 0x05, 0x00, 0x00, 0x12, 0x00, 0x89, 0x04, 0x70, 0x03, 0x12, 0x00, 0x13, 0x01, 0x70, 0x03, 0x12, 0x00, 0x61, 0x05, 0x70, 0x03, 0x06, 0x00, 0xD9, 0x03, 0x15, 0x00, 0x06, 0x00, 0xF5, 0x03, 0xEE, 0x03, 0x06, 0x00, 0xB3, 0x04, 0x28, 0x04, 0x06, 0x00, 0x71, 0x01, 0xEE, 0x03, 0x0A, 0x00, 0x1B, 0x06, 0xD6, 0x05, 0x06, 0x00, 0x59, 0x01, 0x9A, 0x03, 0x0A, 0x00, 0x69, 0x04, 0xD6, 0x05, 0x0A, 0x00, 0x88, 0x00, 0xD6, 0x05, 0x0A, 0x00, 0x0F, 0x06, 0xD6, 0x05, 0x06, 0x00, 0xDF, 0x03, 0x15, 0x00, 0x06, 0x00, 0xE3, 0x00, 0xEE, 0x03, 0x0A, 0x00, 0xB8, 0x03, 0xD6, 0x05, 0x12, 0x00, 0xA1, 0x00, 0x70, 0x03, 0x12, 0x00, 0x1B, 0x03, 0x70, 0x03, 0x12, 0x00, 0x15, 0x04, 0x70, 0x03, 0x12, 0x00, 0x2C, 0x06, 0x36, 0x03, 0x06, 0x00, 0x4F, 0x06, 0xEE, 0x03, 0x06, 0x00, 0x69, 0x03, 0xEE, 0x03, 0x06, 0x00, 0xEF, 0x00, 0xEE, 0x03, 0x06, 0x00, 0x77, 0x04, 0xEE, 0x03, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x10, 0x00, 0xE6, 0x03, 0xC7, 0x04, 0x41, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x73, 0x00, 0x11, 0x00, 0x79, 0x00, 0x02, 0x00, 0x08, 0x00, 0x01, 0x20, 0x10, 0x00, 0xD1, 0x00, 0x11, 0x00, 0x41, 0x00, 0x06, 0x00, 0x08, 0x00, 0x01, 0x20, 0x10, 0x00, 0xA7, 0x00, 0x11, 0x00, 0x41, 0x00, 0x08, 0x00, 0x09, 0x00, 0x01, 0x00, 0x10, 0x00, 0x9B, 0x04, 0x11, 0x00, 0x7D, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x2A, 0x03, 0x35, 0x01, 0x06, 0x06, 0x2B, 0x00, 0x39, 0x01, 0x56, 0x80, 0x97, 0x03, 0x3C, 0x01, 0x56, 0x80, 0x37, 0x05, 0x3C, 0x01, 0x56, 0x80, 0x25, 0x05, 0x3C, 0x01, 0x06, 0x00, 0x82, 0x01, 0x40, 0x01, 0x06, 0x00, 0xC4, 0x00, 0x44, 0x01, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0xF5, 0x04, 0x47, 0x01, 0x01, 0x00, 0xAC, 0x20, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x0B, 0x05, 0x4D, 0x01, 0x02, 0x00, 0xF4, 0x21, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x67, 0x06, 0x52, 0x01, 0x03, 0x00, 0xC4, 0x22, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x10, 0x04, 0x59, 0x01, 0x04, 0x00, 0xC6, 0x22, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x3C, 0x00, 0x5F, 0x01, 0x05, 0x00, 0xCE, 0x22, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x54, 0x05, 0x06, 0x00, 0x06, 0x00, 0xD6, 0x22, 0x00, 0x00, 0x00, 0x00, 0x91, 0x18, 0x5A, 0x05, 0x65, 0x01, 0x06, 0x00, 0xE2, 0x22, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x54, 0x05, 0x06, 0x00, 0x06, 0x00, 0xEA, 0x22, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x54, 0x05, 0x06, 0x00, 0x06, 0x00, 0xF4, 0x22, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00, 0x6B, 0x01, 0x69, 0x01, 0x06, 0x00, 0x40, 0x23, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x54, 0x05, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x3A, 0x01, 0x00, 0x00, 0x01, 0x00, 0x3A, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09, 0x04, 0x00, 0x00, 0x01, 0x00, 0xE6, 0x05, 0x00, 0x00, 0x01, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x4C, 0x01, 0x00, 0x00, 0x02, 0x00, 0x43, 0x01, 0x09, 0x00, 0x54, 0x05, 0x01, 0x00, 0x11, 0x00, 0x54, 0x05, 0x06, 0x00, 0x19, 0x00, 0x54, 0x05, 0x0A, 0x00, 0x29, 0x00, 0x54, 0x05, 0x10, 0x00, 0x31, 0x00, 0x54, 0x05, 0x10, 0x00, 0x39, 0x00, 0x54, 0x05, 0x10, 0x00, 0x41, 0x00, 0x54, 0x05, 0x10, 0x00, 0x49, 0x00, 0x54, 0x05, 0x10, 0x00, 0x51, 0x00, 0x54, 0x05, 0x10, 0x00, 0x59, 0x00, 0x54, 0x05, 0x10, 0x00, 0x61, 0x00, 0x54, 0x05, 0x15, 0x00, 0x69, 0x00, 0x54, 0x05, 0x10, 0x00, 0x71, 0x00, 0x54, 0x05, 0x10, 0x00, 0x79, 0x00, 0x54, 0x05, 0x10, 0x00, 0x99, 0x00, 0x54, 0x05, 0x06, 0x00, 0xA1, 0x00, 0x54, 0x05, 0x23, 0x00, 0x99, 0x00, 0x1D, 0x01, 0x2E, 0x00, 0x91, 0x00, 0x54, 0x05, 0x34, 0x00, 0x91, 0x00, 0x57, 0x04, 0x06, 0x00, 0x31, 0x01, 0x8A, 0x01, 0x06, 0x00, 0xA9, 0x00, 0x54, 0x05, 0x68, 0x00, 0xA9, 0x00, 0x7F, 0x03, 0x15, 0x00, 0x89, 0x00, 0x54, 0x05, 0x06, 0x00, 0x89, 0x00, 0x90, 0x04, 0x6F, 0x00, 0x0C, 0x00, 0x54, 0x05, 0x06, 0x00, 0xB9, 0x00, 0x00, 0x06, 0x7C, 0x00, 0x81, 0x00, 0x67, 0x03, 0x82, 0x00, 0x0C, 0x00, 0x5F, 0x00, 0x86, 0x00, 0x0C, 0x00, 0x46, 0x05, 0x8C, 0x00, 0x14, 0x00, 0x5B, 0x06, 0x9C, 0x00, 0x89, 0x00, 0x20, 0x03, 0xA1, 0x00, 0x14, 0x00, 0x75, 0x06, 0xA9, 0x00, 0x39, 0x01, 0x90, 0x01, 0x06, 0x00, 0x41, 0x01, 0x63, 0x00, 0xA9, 0x00, 0xB9, 0x00, 0x7D, 0x05, 0xBA, 0x00, 0xD9, 0x00, 0x8D, 0x03, 0xBF, 0x00, 0xD9, 0x00, 0x3F, 0x06, 0xBF, 0x00, 0xD1, 0x00, 0x54, 0x05, 0xC3, 0x00, 0xE1, 0x00, 0x9D, 0x00, 0xC9, 0x00, 0xD9, 0x00, 0x1F, 0x00, 0xBF, 0x00, 0xD9, 0x00, 0x25, 0x00, 0xBF, 0x00, 0x49, 0x01, 0x17, 0x03, 0xD1, 0x00, 0xE1, 0x00, 0xFA, 0x03, 0xD7, 0x00, 0xE9, 0x00, 0x54, 0x05, 0x06, 0x00, 0x61, 0x01, 0x2D, 0x03, 0xE5, 0x00, 0x49, 0x01, 0xFD, 0x02, 0xEB, 0x00, 0xE9, 0x00, 0x7E, 0x06, 0xF5, 0x00, 0x69, 0x01, 0x4A, 0x06, 0xFA, 0x00, 0x81, 0x00, 0x54, 0x05, 0x06, 0x00, 0x71, 0x01, 0xB5, 0x06, 0xFF, 0x00, 0x01, 0x01, 0x01, 0x01, 0x05, 0x01, 0x81, 0x01, 0x54, 0x05, 0x0E, 0x01, 0xF9, 0x00, 0x54, 0x05, 0x06, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x26, 0x01, 0x08, 0x00, 0x10, 0x00, 0x2B, 0x01, 0x08, 0x00, 0x14, 0x00, 0x30, 0x01, 0x2E, 0x00, 0x0B, 0x00, 0x71, 0x01, 0x2E, 0x00, 0x13, 0x00, 0x7A, 0x01, 0x2E, 0x00, 0x1B, 0x00, 0x99, 0x01, 0x2E, 0x00, 0x23, 0x00, 0xA2, 0x01, 0x2E, 0x00, 0x2B, 0x00, 0xBC, 0x01, 0x2E, 0x00, 0x33, 0x00, 0xBC, 0x01, 0x2E, 0x00, 0x3B, 0x00, 0xBC, 0x01, 0x2E, 0x00, 0x43, 0x00, 0xA2, 0x01, 0x2E, 0x00, 0x4B, 0x00, 0xC2, 0x01, 0x2E, 0x00, 0x53, 0x00, 0xBC, 0x01, 0x2E, 0x00, 0x5B, 0x00, 0xBC, 0x01, 0x2E, 0x00, 0x63, 0x00, 0xDA, 0x01, 0x2E, 0x00, 0x6B, 0x00, 0x04, 0x02, 0x2E, 0x00, 0x73, 0x00, 0x11, 0x02, 0x1A, 0x00, 0x47, 0x00, 0xAD, 0x00, 0x75, 0x00, 0x95, 0x00, 0x04, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x76, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0xEB, 0x05, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x01, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x69, 0x73, 0x74, 0x60, 0x31, 0x00, 0x3C, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, 0x49, 0x50, 0x43, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x4F, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x58, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x59, 0x00, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x5F, 0x5F, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, 0x62, 0x00, 0x4B, 0x69, 0x6C, 0x6C, 0x4A, 0x6F, 0x62, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x43, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E, 0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x00, 0x41, 0x64, 0x64, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x49, 0x73, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64, 0x00, 0x4A, 0x6F, 0x62, 0x45, 0x78, 0x69, 0x74, 0x43, 0x6F, 0x64, 0x65, 0x00, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6F, 0x64, 0x65, 0x00, 0x50, 0x69, 0x70, 0x65, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x6D, 0x69, 0x73, 0x73, 0x69, 0x6F, 0x6E, 0x4D, 0x6F, 0x64, 0x65, 0x00, 0x46, 0x72, 0x6F, 0x6D, 0x49, 0x6D, 0x61, 0x67, 0x65, 0x00, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x54, 0x65, 0x72, 0x6D, 0x69, 0x6E, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x00, 0x45, 0x72, 0x72, 0x6F, 0x72, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x00, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x00, 0x49, 0x44, 0x69, 0x73, 0x70, 0x6F, 0x73, 0x61, 0x62, 0x6C, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x00, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x46, 0x72, 0x6F, 0x6D, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x00, 0x52, 0x65, 0x63, 0x74, 0x61, 0x6E, 0x67, 0x6C, 0x65, 0x00, 0x41, 0x64, 0x64, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x75, 0x6C, 0x65, 0x00, 0x50, 0x69, 0x70, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x75, 0x6C, 0x65, 0x00, 0x70, 0x69, 0x70, 0x65, 0x4E, 0x61, 0x6D, 0x65, 0x00, 0x74, 0x79, 0x70, 0x65, 0x4E, 0x61, 0x6D, 0x65, 0x00, 0x61, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x4E, 0x61, 0x6D, 0x65, 0x00, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x54, 0x79, 0x70, 0x65, 0x00, 0x42, 0x69, 0x6E, 0x64, 0x54, 0x6F, 0x54, 0x79, 0x70, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x43, 0x6F, 0x72, 0x65, 0x00, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x00, 0x43, 0x6C, 0x6F, 0x73, 0x65, 0x00, 0x44, 0x69, 0x73, 0x70, 0x6F, 0x73, 0x65, 0x00, 0x47, 0x75, 0x69, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x61, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x72, 0x61, 0x64, 0x65, 0x6D, 0x61, 0x72, 0x6B, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6D, 0x65, 0x77, 0x6F, 0x72, 0x6B, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x6C, 0x61, 0x78, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x50, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x6E, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6C, 0x69, 0x74, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x61, 0x76, 0x65, 0x00, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x52, 0x75, 0x6E, 0x6E, 0x65, 0x72, 0x2E, 0x65, 0x78, 0x65, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x53, 0x69, 0x7A, 0x65, 0x00, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x00, 0x62, 0x66, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x4A, 0x70, 0x65, 0x67, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6E, 0x67, 0x2E, 0x49, 0x6D, 0x61, 0x67, 0x69, 0x6E, 0x67, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x69, 0x6E, 0x67, 0x00, 0x54, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6E, 0x67, 0x00, 0x73, 0x65, 0x74, 0x5F, 0x41, 0x75, 0x74, 0x6F, 0x46, 0x6C, 0x75, 0x73, 0x68, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x57, 0x69, 0x64, 0x74, 0x68, 0x00, 0x4F, 0x6B, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2E, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x00, 0x50, 0x69, 0x70, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x00, 0x4E, 0x61, 0x6D, 0x65, 0x64, 0x50, 0x69, 0x70, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x00, 0x4D, 0x65, 0x6D, 0x6F, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x00, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x45, 0x6E, 0x75, 0x6D, 0x00, 0x43, 0x6F, 0x70, 0x79, 0x46, 0x72, 0x6F, 0x6D, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x00, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x43, 0x6F, 0x70, 0x79, 0x50, 0x69, 0x78, 0x65, 0x6C, 0x4F, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x66, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6F, 0x72, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x50, 0x69, 0x70, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x41, 0x72, 0x67, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x42, 0x69, 0x74, 0x6D, 0x61, 0x70, 0x00, 0x73, 0x65, 0x74, 0x5F, 0x42, 0x69, 0x6E, 0x64, 0x65, 0x72, 0x00, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x69, 0x6E, 0x64, 0x65, 0x72, 0x00, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x42, 0x69, 0x6E, 0x64, 0x65, 0x72, 0x00, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x52, 0x75, 0x6E, 0x6E, 0x65, 0x72, 0x00, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, 0x00, 0x42, 0x69, 0x6E, 0x61, 0x72, 0x79, 0x46, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x74, 0x65, 0x72, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4E, 0x61, 0x6D, 0x65, 0x64, 0x50, 0x69, 0x70, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x49, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x4E, 0x61, 0x6D, 0x65, 0x64, 0x50, 0x69, 0x70, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x52, 0x65, 0x61, 0x64, 0x45, 0x72, 0x72, 0x6F, 0x72, 0x00, 0x50, 0x69, 0x70, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x45, 0x72, 0x72, 0x6F, 0x72, 0x00, 0x47, 0x65, 0x74, 0x45, 0x6E, 0x75, 0x6D, 0x65, 0x72, 0x61, 0x74, 0x6F, 0x72, 0x00, 0x2E, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x2E, 0x63, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x69, 0x61, 0x67, 0x6E, 0x6F, 0x73, 0x74, 0x69, 0x63, 0x73, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x42, 0x6F, 0x75, 0x6E, 0x64, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6F, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x69, 0x6E, 0x67, 0x4D, 0x6F, 0x64, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x4F, 0x2E, 0x50, 0x69, 0x70, 0x65, 0x73, 0x00, 0x61, 0x72, 0x67, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0x73, 0x2E, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x41, 0x6C, 0x6C, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x00, 0x50, 0x69, 0x70, 0x65, 0x4F, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x00, 0x50, 0x69, 0x70, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x49, 0x6D, 0x61, 0x67, 0x65, 0x46, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x00, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x45, 0x78, 0x69, 0x74, 0x00, 0x45, 0x6E, 0x76, 0x69, 0x72, 0x6F, 0x6E, 0x6D, 0x65, 0x6E, 0x74, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x74, 0x00, 0x47, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x00, 0x4D, 0x6F, 0x76, 0x65, 0x4E, 0x65, 0x78, 0x74, 0x00, 0x54, 0x6F, 0x41, 0x72, 0x72, 0x61, 0x79, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x46, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x74, 0x65, 0x72, 0x73, 0x2E, 0x42, 0x69, 0x6E, 0x61, 0x72, 0x79, 0x00, 0x6F, 0x70, 0x5F, 0x45, 0x71, 0x75, 0x61, 0x6C, 0x69, 0x74, 0x79, 0x00, 0x50, 0x69, 0x70, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x11, 0x45, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x79, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x00, 0x0F, 0x4E, 0x00, 0x65, 0x00, 0x74, 0x00, 0x77, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6B, 0x00, 0x00, 0x2B, 0x49, 0x00, 0x50, 0x00, 0x43, 0x00, 0x2E, 0x00, 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x4D, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00, 0x00, 0x41, 0x49, 0x00, 0x50, 0x00, 0x43, 0x00, 0x2E, 0x00, 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x54, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x4D, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00, 0x00, 0x1F, 0x55, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x70, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x74, 0x00, 0x79, 0x00, 0x70, 0x00, 0x65, 0x00, 0x00, 0x11, 0x74, 0x00, 0x79, 0x00, 0x70, 0x00, 0x65, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x09, 0x0C, 0xBC, 0x08, 0x9D, 0xFF, 0x9A, 0x41, 0xBB, 0x5E, 0xC2, 0x17, 0xDD, 0xDC, 0x4A, 0xFD, 0x00, 0x04, 0x20, 0x01, 0x01, 0x08, 0x03, 0x20, 0x00, 0x01, 0x05, 0x20, 0x01, 0x01, 0x11, 0x11, 0x04, 0x20, 0x01, 0x01, 0x0E, 0x04, 0x20, 0x01, 0x01, 0x02, 0x08, 0x07, 0x03, 0x12, 0x4D, 0x12, 0x51, 0x12, 0x51, 0x0A, 0x20, 0x03, 0x01, 0x0E, 0x11, 0x80, 0x85, 0x11, 0x80, 0x89, 0x05, 0x20, 0x01, 0x01, 0x12, 0x51, 0x12, 0x20, 0x08, 0x01, 0x0E, 0x11, 0x80, 0x8D, 0x08, 0x11, 0x80, 0x91, 0x11, 0x80, 0x95, 0x08, 0x08, 0x12, 0x4D, 0x20, 0x07, 0x0B, 0x12, 0x49, 0x12, 0x55, 0x12, 0x45, 0x15, 0x12, 0x59, 0x01, 0x12, 0x10, 0x1D, 0x12, 0x5D, 0x08, 0x12, 0x5D, 0x12, 0x10, 0x12, 0x61, 0x15, 0x11, 0x65, 0x01, 0x12, 0x10, 0x12, 0x10, 0x06, 0x20, 0x01, 0x01, 0x12, 0x80, 0x99, 0x05, 0x20, 0x01, 0x01, 0x12, 0x7D, 0x06, 0x15, 0x12, 0x59, 0x01, 0x12, 0x10, 0x05, 0x00, 0x00, 0x1D, 0x12, 0x5D, 0x03, 0x20, 0x00, 0x0E, 0x05, 0x20, 0x01, 0x01, 0x13, 0x00, 0x08, 0x20, 0x00, 0x15, 0x11, 0x65, 0x01, 0x13, 0x00, 0x06, 0x15, 0x11, 0x65, 0x01, 0x12, 0x10, 0x04, 0x20, 0x00, 0x13, 0x00, 0x07, 0x20, 0x02, 0x01, 0x12, 0x80, 0x99, 0x1C, 0x03, 0x20, 0x00, 0x02, 0x0C, 0x07, 0x05, 0x1D, 0x05, 0x12, 0x69, 0x11, 0x6D, 0x12, 0x71, 0x12, 0x75, 0x04, 0x20, 0x00, 0x11, 0x6D, 0x03, 0x20, 0x00, 0x08, 0x05, 0x20, 0x02, 0x01, 0x08, 0x08, 0x07, 0x00, 0x01, 0x12, 0x71, 0x12, 0x80, 0xA5, 0x05, 0x20, 0x00, 0x11, 0x80, 0xA9, 0x0D, 0x20, 0x06, 0x01, 0x08, 0x08, 0x08, 0x08, 0x11, 0x80, 0xA9, 0x11, 0x80, 0xAD, 0x05, 0x00, 0x00, 0x12, 0x80, 0xB1, 0x09, 0x20, 0x02, 0x01, 0x12, 0x80, 0x99, 0x12, 0x80, 0xB1, 0x04, 0x20, 0x00, 0x1D, 0x05, 0x04, 0x00, 0x01, 0x01, 0x08, 0x05, 0x00, 0x02, 0x02, 0x0E, 0x0E, 0x08, 0x00, 0x01, 0x12, 0x80, 0x81, 0x11, 0x80, 0xBD, 0x05, 0x20, 0x02, 0x01, 0x0E, 0x0E, 0x08, 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x08, 0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x03, 0x06, 0x12, 0x45, 0x02, 0x06, 0x08, 0x03, 0x06, 0x11, 0x0C, 0x03, 0x06, 0x1D, 0x05, 0x02, 0x06, 0x0E, 0x05, 0x00, 0x01, 0x12, 0x49, 0x0E, 0x04, 0x00, 0x01, 0x01, 0x0E, 0x06, 0x00, 0x01, 0x1D, 0x05, 0x12, 0x5D, 0x05, 0x00, 0x01, 0x01, 0x1D, 0x0E, 0x05, 0x00, 0x01, 0x01, 0x11, 0x0C, 0x03, 0x00, 0x00, 0x01, 0x07, 0x20, 0x02, 0x12, 0x80, 0x81, 0x0E, 0x0E, 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0x00, 0x01, 0x00, 0x54, 0x02, 0x16, 0x57, 0x72, 0x61, 0x70, 0x4E, 0x6F, 0x6E, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x73, 0x01, 0x08, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x01, 0x00, 0x14, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x52, 0x75, 0x6E, 0x6E, 0x65, 0x72, 0x53, 0x74, 0x75, 0x62, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x17, 0x01, 0x00, 0x12, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0xC2, 0xA9, 0x20, 0x20, 0x32, 0x30, 0x32, 0x30, 0x00, 0x00, 0x29, 0x01, 0x00, 0x24, 0x61, 0x62, 0x65, 0x34, 0x65, 0x38, 0x65, 0x66, 0x2D, 0x62, 0x36, 0x35, 0x33, 0x2D, 0x34, 0x65, 0x35, 0x35, 0x2D, 0x62, 0x38, 0x31, 0x62, 0x2D, 0x38, 0x34, 0x65, 0x61, 0x65, 0x63, 0x65, 0x34, 0x63, 0x63, 0x35, 0x63, 0x00, 0x00, 0x0C, 0x01, 0x00, 0x07, 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x47, 0x01, 0x00, 0x1A, 0x2E, 0x4E, 0x45, 0x54, 0x46, 0x72, 0x61, 0x6D, 0x65, 0x77, 0x6F, 0x72, 0x6B, 0x2C, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x76, 0x34, 0x2E, 0x30, 0x01, 0x00, 0x54, 0x0E, 0x14, 0x46, 0x72, 0x61, 0x6D, 0x65, 0x77, 0x6F, 0x72, 0x6B, 0x44, 0x69, 0x73, 0x70, 0x6C, 0x61, 0x79, 0x4E, 0x61, 0x6D, 0x65, 0x10, 0x2E, 0x4E, 0x45, 0x54, 0x20, 0x46, 0x72, 0x61, 0x6D, 0x65, 0x77, 0x6F, 0x72, 0x6B, 0x20, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0xCD, 0x03, 0xCB, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0xBC, 0x32, 0x00, 0x00, 0xBC, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x53, 0x44, 0x53, 0x16, 0xEE, 0xD0, 0x32, 0x50, 0xC9, 0x04, 0x42, 0xA4, 0x77, 0x03, 0x65, 0x85, 0x99, 0x70, 0x8C, 0x01, 0x00, 0x00, 0x00, 0x43, 0x3A, 0x5C, 0x55, 0x73, 0x65, 0x72, 0x73, 0x5C, 0x77, 0x69, 0x6E, 0x64, 0x65, 0x76, 0x5C, 0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E, 0x74, 0x5C, 0x41, 0x70, 0x6F, 0x6C, 0x6C, 0x6F, 0x5C, 0x50, 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x5F, 0x54, 0x79, 0x70, 0x65, 0x5C, 0x41, 0x70, 0x6F, 0x6C, 0x6C, 0x6F, 0x5C, 0x61, 0x67, 0x65, 0x6E, 0x74, 0x5F, 0x63, 0x6F, 0x64, 0x65, 0x5C, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x4C, 0x6F, 0x61, 0x64, 0x65, 0x72, 0x53, 0x74, 0x75, 0x62, 0x5C, 0x6F, 0x62, 0x6A, 0x5C, 0x52, 0x65, 0x6C, 0x65, 0x61, 0x73, 0x65, 0x5C, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x68, 0x6F, 0x74, 0x52, 0x75, 0x6E, 0x6E, 0x65, 0x72, 0x2E, 0x70, 0x64, 0x62, 0x00, 0x74, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x33, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x43, 0x6F, 0x72, 0x45, 0x78, 0x65, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x65, 0x65, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x25, 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x18, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x03, 0x00, 0x00, 0x90, 0x40, 0x00, 0x00, 0x6C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x03, 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x04, 0xEF, 0xFE, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x04, 0xCC, 0x02, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0xA8, 0x02, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x34, 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x15, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x52, 0x00, 0x75, 0x00, 0x6E, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x72, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x4A, 0x00, 0x15, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x52, 0x00, 0x75, 0x00, 0x6E, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x12, 0x00, 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0xA9, 0x00, 0x20, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x01, 0x00, 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6B, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x15, 0x00, 0x01, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x52, 0x00, 0x75, 0x00, 0x6E, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4A, 0x00, 0x15, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x52, 0x00, 0x75, 0x00, 0x6E, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x72, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x08, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x01, 0x00, 0x41, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x20, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0C, 0x44, 0x00, 0x00, 0xEA, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEF, 0xBB, 0xBF, 0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x22, 0x31, 0x2E, 0x30, 0x22, 0x20, 0x65, 0x6E, 0x63, 0x6F, 0x64, 0x69, 0x6E, 0x67, 0x3D, 0x22, 0x55, 0x54, 0x46, 0x2D, 0x38, 0x22, 0x20, 0x73, 0x74, 0x61, 0x6E, 0x64, 0x61, 0x6C, 0x6F, 0x6E, 0x65, 0x3D, 0x22, 0x79, 0x65, 0x73, 0x22, 0x3F, 0x3E, 0x0D, 0x0A, 0x0D, 0x0A, 0x3C, 0x61, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x20, 0x78, 0x6D, 0x6C, 0x6E, 0x73, 0x3D, 0x22, 0x75, 0x72, 0x6E, 0x3A, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x73, 0x2D, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2D, 0x63, 0x6F, 0x6D, 0x3A, 0x61, 0x73, 0x6D, 0x2E, 0x76, 0x31, 0x22, 0x20, 0x6D, 0x61, 0x6E, 0x69, 0x66, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x22, 0x31, 0x2E, 0x30, 0x22, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x3C, 0x61, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x22, 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x22, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x4D, 0x79, 0x41, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x61, 0x70, 0x70, 0x22, 0x2F, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x3C, 0x74, 0x72, 0x75, 0x73, 0x74, 0x49, 0x6E, 0x66, 0x6F, 0x20, 0x78, 0x6D, 0x6C, 0x6E, 0x73, 0x3D, 0x22, 0x75, 0x72, 0x6E, 0x3A, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x73, 0x2D, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2D, 0x63, 0x6F, 0x6D, 0x3A, 0x61, 0x73, 0x6D, 0x2E, 0x76, 0x32, 0x22, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x3C, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3C, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6C, 0x65, 0x67, 0x65, 0x73, 0x20, 0x78, 0x6D, 0x6C, 0x6E, 0x73, 0x3D, 0x22, 0x75, 0x72, 0x6E, 0x3A, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x73, 0x2D, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2D, 0x63, 0x6F, 0x6D, 0x3A, 0x61, 0x73, 0x6D, 0x2E, 0x76, 0x33, 0x22, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3C, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6F, 0x6E, 0x4C, 0x65, 0x76, 0x65, 0x6C, 0x20, 0x6C, 0x65, 0x76, 0x65, 0x6C, 0x3D, 0x22, 0x61, 0x73, 0x49, 0x6E, 0x76, 0x6F, 0x6B, 0x65, 0x72, 0x22, 0x20, 0x75, 0x69, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x3D, 0x22, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x22, 0x2F, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3C, 0x2F, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6C, 0x65, 0x67, 0x65, 0x73, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x3C, 0x2F, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x3E, 0x0D, 0x0A, 0x20, 0x20, 0x3C, 0x2F, 0x74, 0x72, 0x75, 0x73, 0x74, 0x49, 0x6E, 0x66, 0x6F, 0x3E, 0x0D, 0x0A, 0x3C, 0x2F, 0x61, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xA0, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; const unsigned long rawData_termination = 0x00000000; const unsigned long rawData_start = 0x00000000; const unsigned long rawData_finish = 0x00002000; const unsigned long rawData_length = 0x00002000; #define RAWDATA_TERMINATION 0x00000000 #define RAWDATA_START 0x00000000 #define RAWDATA_FINISH 0x00002000 #define RAWDATA_LENGTH 0x00002000
33,344
743
/* * 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.guacamole.rest.activeconnection; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleUnsupportedException; import org.apache.guacamole.net.auth.ActiveConnection; import org.apache.guacamole.net.auth.UserContext; import org.apache.guacamole.rest.directory.DirectoryObjectTranslator; /** * Translator which converts between ActiveConnection objects and * APIActiveConnection objects. As ActiveConnection objects are read-only, only * toExternalObject() is implemented here. */ public class ActiveConnectionObjectTranslator extends DirectoryObjectTranslator<ActiveConnection, APIActiveConnection> { @Override public APIActiveConnection toExternalObject(ActiveConnection object) throws GuacamoleException { return new APIActiveConnection(object); } @Override public ActiveConnection toInternalObject(APIActiveConnection object) throws GuacamoleException { // ActiveConnection objects are read-only throw new GuacamoleUnsupportedException("Active connection records are read-only."); } @Override public void applyExternalChanges(ActiveConnection existingObject, APIActiveConnection object) throws GuacamoleException { // Modification not supported for ActiveConnection throw new GuacamoleUnsupportedException("Active connection records are read-only."); } @Override public void filterExternalObject(UserContext context, APIActiveConnection object) throws GuacamoleException { // Nothing to filter on ActiveConnections (no attributes) } }
702
479
{ "cluster_permissions" : [ "cluster:monitor*" ], "index_permissions" : [ { "index_patterns" : [ "sf" ], "allowed_actions" : [ "OPENDISTRO_SECURITY_CRUD" ] }, { "index_patterns" : [ "pub" ], "allowed_actions" : [ "OPENDISTRO_SECURITY_CRUD" ] } ], "tenant_permissions" : [ ] }
138
1,144
<gh_stars>1000+ // SPDX-License-Identifier: GPL-2.0+ /* * (c) 2015 <NAME> <<EMAIL>> * */ #include <common.h> #include <errno.h> #include <dm.h> #include <net.h> #include <miiphy.h> #include <console.h> #include <wait_bit.h> #include <asm/gpio.h> #include "pic32_eth.h" #define MAX_RX_BUF_SIZE 1536 #define MAX_RX_DESCR PKTBUFSRX #define MAX_TX_DESCR 2 DECLARE_GLOBAL_DATA_PTR; struct pic32eth_dev { struct eth_dma_desc rxd_ring[MAX_RX_DESCR]; struct eth_dma_desc txd_ring[MAX_TX_DESCR]; u32 rxd_idx; /* index of RX desc to read */ /* regs */ struct pic32_ectl_regs *ectl_regs; struct pic32_emac_regs *emac_regs; /* Phy */ struct phy_device *phydev; phy_interface_t phyif; u32 phy_addr; struct gpio_desc rst_gpio; }; void __weak board_netphy_reset(void *dev) { struct pic32eth_dev *priv = dev; if (!dm_gpio_is_valid(&priv->rst_gpio)) return; /* phy reset */ dm_gpio_set_value(&priv->rst_gpio, 0); udelay(300); dm_gpio_set_value(&priv->rst_gpio, 1); udelay(300); } /* Initialize mii(MDIO) interface, discover which PHY is * attached to the device, and configure it properly. */ static int pic32_mii_init(struct pic32eth_dev *priv) { struct pic32_ectl_regs *ectl_p = priv->ectl_regs; struct pic32_emac_regs *emac_p = priv->emac_regs; /* board phy reset */ board_netphy_reset(priv); /* disable RX, TX & all transactions */ writel(ETHCON_ON | ETHCON_TXRTS | ETHCON_RXEN, &ectl_p->con1.clr); /* wait till busy */ wait_for_bit_le32(&ectl_p->stat.raw, ETHSTAT_BUSY, false, CONFIG_SYS_HZ, false); /* turn controller ON to access PHY over MII */ writel(ETHCON_ON, &ectl_p->con1.set); mdelay(10); /* reset MAC */ writel(EMAC_SOFTRESET, &emac_p->cfg1.set); /* reset assert */ mdelay(10); writel(EMAC_SOFTRESET, &emac_p->cfg1.clr); /* reset deassert */ /* initialize MDIO/MII */ if (priv->phyif == PHY_INTERFACE_MODE_RMII) { writel(EMAC_RMII_RESET, &emac_p->supp.set); mdelay(10); writel(EMAC_RMII_RESET, &emac_p->supp.clr); } return pic32_mdio_init(PIC32_MDIO_NAME, (ulong)&emac_p->mii); } static int pic32_phy_init(struct pic32eth_dev *priv, struct udevice *dev) { struct mii_dev *mii; mii = miiphy_get_dev_by_name(PIC32_MDIO_NAME); /* find & connect PHY */ priv->phydev = phy_connect(mii, priv->phy_addr, dev, priv->phyif); if (!priv->phydev) { printf("%s: %s: Error, PHY connect\n", __FILE__, __func__); return 0; } /* Wait for phy to complete reset */ mdelay(10); /* configure supported modes */ priv->phydev->supported = SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | SUPPORTED_Autoneg; priv->phydev->advertising = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | ADVERTISED_Autoneg; priv->phydev->autoneg = AUTONEG_ENABLE; return 0; } /* Configure MAC based on negotiated speed and duplex * reported by PHY. */ static int pic32_mac_adjust_link(struct pic32eth_dev *priv) { struct phy_device *phydev = priv->phydev; struct pic32_emac_regs *emac_p = priv->emac_regs; if (!phydev->link) { printf("%s: No link.\n", phydev->dev->name); return -EINVAL; } if (phydev->duplex) { writel(EMAC_FULLDUP, &emac_p->cfg2.set); writel(FULLDUP_GAP_TIME, &emac_p->ipgt.raw); } else { writel(EMAC_FULLDUP, &emac_p->cfg2.clr); writel(HALFDUP_GAP_TIME, &emac_p->ipgt.raw); } switch (phydev->speed) { case SPEED_100: writel(EMAC_RMII_SPD100, &emac_p->supp.set); break; case SPEED_10: writel(EMAC_RMII_SPD100, &emac_p->supp.clr); break; default: printf("%s: Speed was bad\n", phydev->dev->name); return -EINVAL; } printf("pic32eth: PHY is %s with %dbase%s, %s\n", phydev->drv->name, phydev->speed, (phydev->port == PORT_TP) ? "T" : "X", (phydev->duplex) ? "full" : "half"); return 0; } static void pic32_mac_init(struct pic32eth_dev *priv, u8 *macaddr) { struct pic32_emac_regs *emac_p = priv->emac_regs; u32 stat = 0, v; u64 expire; v = EMAC_TXPAUSE | EMAC_RXPAUSE | EMAC_RXENABLE; writel(v, &emac_p->cfg1.raw); v = EMAC_EXCESS | EMAC_AUTOPAD | EMAC_PADENABLE | EMAC_CRCENABLE | EMAC_LENGTHCK | EMAC_FULLDUP; writel(v, &emac_p->cfg2.raw); /* recommended back-to-back inter-packet gap for 10 Mbps half duplex */ writel(HALFDUP_GAP_TIME, &emac_p->ipgt.raw); /* recommended non-back-to-back interpacket gap is 0xc12 */ writel(0xc12, &emac_p->ipgr.raw); /* recommended collision window retry limit is 0x370F */ writel(0x370f, &emac_p->clrt.raw); /* set maximum frame length: allow VLAN tagged frame */ writel(0x600, &emac_p->maxf.raw); /* set the mac address */ writel(macaddr[0] | (macaddr[1] << 8), &emac_p->sa2.raw); writel(macaddr[2] | (macaddr[3] << 8), &emac_p->sa1.raw); writel(macaddr[4] | (macaddr[5] << 8), &emac_p->sa0.raw); /* default, enable 10 Mbps operation */ writel(EMAC_RMII_SPD100, &emac_p->supp.clr); /* wait until link status UP or deadline elapsed */ expire = get_ticks() + get_tbclk() * 2; for (; get_ticks() < expire;) { stat = phy_read(priv->phydev, priv->phy_addr, MII_BMSR); if (stat & BMSR_LSTATUS) break; } if (!(stat & BMSR_LSTATUS)) printf("MAC: Link is DOWN!\n"); /* delay to stabilize before any tx/rx */ mdelay(10); } static void pic32_mac_reset(struct pic32eth_dev *priv) { struct pic32_emac_regs *emac_p = priv->emac_regs; struct mii_dev *mii; /* Reset MAC */ writel(EMAC_SOFTRESET, &emac_p->cfg1.raw); mdelay(10); /* clear reset */ writel(0, &emac_p->cfg1.raw); /* Reset MII */ mii = priv->phydev->bus; if (mii && mii->reset) mii->reset(mii); } /* initializes the MAC and PHY, then establishes a link */ static void pic32_ctrl_reset(struct pic32eth_dev *priv) { struct pic32_ectl_regs *ectl_p = priv->ectl_regs; u32 v; /* disable RX, TX & any other transactions */ writel(ETHCON_ON | ETHCON_TXRTS | ETHCON_RXEN, &ectl_p->con1.clr); /* wait till busy */ wait_for_bit_le32(&ectl_p->stat.raw, ETHSTAT_BUSY, false, CONFIG_SYS_HZ, false); /* decrement received buffcnt to zero. */ while (readl(&ectl_p->stat.raw) & ETHSTAT_BUFCNT) writel(ETHCON_BUFCDEC, &ectl_p->con1.set); /* clear any existing interrupt event */ writel(0xffffffff, &ectl_p->irq.clr); /* clear RX/TX start address */ writel(0xffffffff, &ectl_p->txst.clr); writel(0xffffffff, &ectl_p->rxst.clr); /* clear the receive filters */ writel(0x00ff, &ectl_p->rxfc.clr); /* set the receive filters * ETH_FILT_CRC_ERR_REJECT * ETH_FILT_RUNT_REJECT * ETH_FILT_UCAST_ACCEPT * ETH_FILT_MCAST_ACCEPT * ETH_FILT_BCAST_ACCEPT */ v = ETHRXFC_BCEN | ETHRXFC_MCEN | ETHRXFC_UCEN | ETHRXFC_RUNTEN | ETHRXFC_CRCOKEN; writel(v, &ectl_p->rxfc.set); /* turn controller ON to access PHY over MII */ writel(ETHCON_ON, &ectl_p->con1.set); } static void pic32_rx_desc_init(struct pic32eth_dev *priv) { struct pic32_ectl_regs *ectl_p = priv->ectl_regs; struct eth_dma_desc *rxd; u32 idx, bufsz; priv->rxd_idx = 0; for (idx = 0; idx < MAX_RX_DESCR; idx++) { rxd = &priv->rxd_ring[idx]; /* hw owned */ rxd->hdr = EDH_NPV | EDH_EOWN | EDH_STICKY; /* packet buffer address */ rxd->data_buff = virt_to_phys(net_rx_packets[idx]); /* link to next desc */ rxd->next_ed = virt_to_phys(rxd + 1); /* reset status */ rxd->stat1 = 0; rxd->stat2 = 0; /* decrement bufcnt */ writel(ETHCON_BUFCDEC, &ectl_p->con1.set); } /* link last descr to beginning of list */ rxd->next_ed = virt_to_phys(&priv->rxd_ring[0]); /* flush rx ring */ flush_dcache_range((ulong)priv->rxd_ring, (ulong)priv->rxd_ring + sizeof(priv->rxd_ring)); /* set rx desc-ring start address */ writel((ulong)virt_to_phys(&priv->rxd_ring[0]), &ectl_p->rxst.raw); /* RX Buffer size */ bufsz = readl(&ectl_p->con2.raw); bufsz &= ~(ETHCON_RXBUFSZ << ETHCON_RXBUFSZ_SHFT); bufsz |= ((MAX_RX_BUF_SIZE / 16) << ETHCON_RXBUFSZ_SHFT); writel(bufsz, &ectl_p->con2.raw); /* enable the receiver in hardware which allows hardware * to DMA received pkts to the descriptor pointer address. */ writel(ETHCON_RXEN, &ectl_p->con1.set); } static int pic32_eth_start(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); struct pic32eth_dev *priv = dev_get_priv(dev); /* controller */ pic32_ctrl_reset(priv); /* reset MAC */ pic32_mac_reset(priv); /* configure PHY */ phy_config(priv->phydev); /* initialize MAC */ pic32_mac_init(priv, &pdata->enetaddr[0]); /* init RX descriptor; TX descriptors are handled in xmit */ pic32_rx_desc_init(priv); /* Start up & update link status of PHY */ phy_startup(priv->phydev); /* adjust mac with phy link status */ return pic32_mac_adjust_link(priv); } static void pic32_eth_stop(struct udevice *dev) { struct pic32eth_dev *priv = dev_get_priv(dev); struct pic32_ectl_regs *ectl_p = priv->ectl_regs; struct pic32_emac_regs *emac_p = priv->emac_regs; /* Reset the phy if the controller is enabled */ if (readl(&ectl_p->con1.raw) & ETHCON_ON) phy_reset(priv->phydev); /* Shut down the PHY */ phy_shutdown(priv->phydev); /* Stop rx/tx */ writel(ETHCON_TXRTS | ETHCON_RXEN, &ectl_p->con1.clr); mdelay(10); /* reset MAC */ writel(EMAC_SOFTRESET, &emac_p->cfg1.raw); /* clear reset */ writel(0, &emac_p->cfg1.raw); mdelay(10); /* disable controller */ writel(ETHCON_ON, &ectl_p->con1.clr); mdelay(10); /* wait until everything is down */ wait_for_bit_le32(&ectl_p->stat.raw, ETHSTAT_BUSY, false, 2 * CONFIG_SYS_HZ, false); /* clear any existing interrupt event */ writel(0xffffffff, &ectl_p->irq.clr); } static int pic32_eth_send(struct udevice *dev, void *packet, int length) { struct pic32eth_dev *priv = dev_get_priv(dev); struct pic32_ectl_regs *ectl_p = priv->ectl_regs; struct eth_dma_desc *txd; u64 deadline; txd = &priv->txd_ring[0]; /* set proper flags & length in descriptor header */ txd->hdr = EDH_SOP | EDH_EOP | EDH_EOWN | EDH_BCOUNT(length); /* pass buffer address to hardware */ txd->data_buff = virt_to_phys(packet); debug("%s: %d / .hdr %x, .data_buff %x, .stat %x, .nexted %x\n", __func__, __LINE__, txd->hdr, txd->data_buff, txd->stat2, txd->next_ed); /* cache flush (packet) */ flush_dcache_range((ulong)packet, (ulong)packet + length); /* cache flush (txd) */ flush_dcache_range((ulong)txd, (ulong)txd + sizeof(*txd)); /* pass descriptor table base to h/w */ writel(virt_to_phys(txd), &ectl_p->txst.raw); /* ready to send enabled, hardware can now send the packet(s) */ writel(ETHCON_TXRTS | ETHCON_ON, &ectl_p->con1.set); /* wait until tx has completed and h/w has released ownership * of the tx descriptor or timeout elapsed. */ deadline = get_ticks() + get_tbclk(); for (;;) { /* check timeout */ if (get_ticks() > deadline) return -ETIMEDOUT; if (ctrlc()) return -EINTR; /* tx completed ? */ if (readl(&ectl_p->con1.raw) & ETHCON_TXRTS) { udelay(1); continue; } /* h/w not released ownership yet? */ invalidate_dcache_range((ulong)txd, (ulong)txd + sizeof(*txd)); if (!(txd->hdr & EDH_EOWN)) break; } return 0; } static int pic32_eth_recv(struct udevice *dev, int flags, uchar **packetp) { struct pic32eth_dev *priv = dev_get_priv(dev); struct eth_dma_desc *rxd; u32 idx = priv->rxd_idx; u32 rx_count; /* find the next ready to receive */ rxd = &priv->rxd_ring[idx]; invalidate_dcache_range((ulong)rxd, (ulong)rxd + sizeof(*rxd)); /* check if owned by MAC */ if (rxd->hdr & EDH_EOWN) return -EAGAIN; /* Sanity check on header: SOP and EOP */ if ((rxd->hdr & (EDH_SOP | EDH_EOP)) != (EDH_SOP | EDH_EOP)) { printf("%s: %s, rx pkt across multiple descr\n", __FILE__, __func__); return 0; } debug("%s: %d /idx %i, hdr=%x, data_buff %x, stat %x, nexted %x\n", __func__, __LINE__, idx, rxd->hdr, rxd->data_buff, rxd->stat2, rxd->next_ed); /* Sanity check on rx_stat: OK, CRC */ if (!RSV_RX_OK(rxd->stat2) || RSV_CRC_ERR(rxd->stat2)) { debug("%s: %s: Error, rx problem detected\n", __FILE__, __func__); return 0; } /* invalidate dcache */ rx_count = RSV_RX_COUNT(rxd->stat2); invalidate_dcache_range((ulong)net_rx_packets[idx], (ulong)net_rx_packets[idx] + rx_count); /* Pass the packet to protocol layer */ *packetp = net_rx_packets[idx]; /* increment number of bytes rcvd (ignore CRC) */ return rx_count - 4; } static int pic32_eth_free_pkt(struct udevice *dev, uchar *packet, int length) { struct pic32eth_dev *priv = dev_get_priv(dev); struct pic32_ectl_regs *ectl_p = priv->ectl_regs; struct eth_dma_desc *rxd; int idx = priv->rxd_idx; /* sanity check */ if (packet != net_rx_packets[idx]) { printf("rxd_id %d: packet is not matched,\n", idx); return -EAGAIN; } /* prepare for receive */ rxd = &priv->rxd_ring[idx]; rxd->hdr = EDH_STICKY | EDH_NPV | EDH_EOWN; flush_dcache_range((ulong)rxd, (ulong)rxd + sizeof(*rxd)); /* decrement rx pkt count */ writel(ETHCON_BUFCDEC, &ectl_p->con1.set); debug("%s: %d / idx %i, hdr %x, data_buff %x, stat %x, nexted %x\n", __func__, __LINE__, idx, rxd->hdr, rxd->data_buff, rxd->stat2, rxd->next_ed); priv->rxd_idx = (priv->rxd_idx + 1) % MAX_RX_DESCR; return 0; } static const struct eth_ops pic32_eth_ops = { .start = pic32_eth_start, .send = pic32_eth_send, .recv = pic32_eth_recv, .free_pkt = pic32_eth_free_pkt, .stop = pic32_eth_stop, }; static int pic32_eth_probe(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); struct pic32eth_dev *priv = dev_get_priv(dev); const char *phy_mode; void __iomem *iobase; fdt_addr_t addr; fdt_size_t size; int offset = 0; int phy_addr = -1; addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg", &size); if (addr == FDT_ADDR_T_NONE) return -EINVAL; iobase = ioremap(addr, size); pdata->iobase = (phys_addr_t)addr; /* get phy mode */ pdata->phy_interface = -1; phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode", NULL); if (phy_mode) pdata->phy_interface = phy_get_interface_by_name(phy_mode); if (pdata->phy_interface == -1) { debug("%s: Invalid PHY interface '%s'\n", __func__, phy_mode); return -EINVAL; } /* get phy addr */ offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev), "phy-handle"); if (offset > 0) phy_addr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1); /* phy reset gpio */ gpio_request_by_name_nodev(dev_ofnode(dev), "reset-gpios", 0, &priv->rst_gpio, GPIOD_IS_OUT); priv->phyif = pdata->phy_interface; priv->phy_addr = phy_addr; priv->ectl_regs = iobase; priv->emac_regs = iobase + PIC32_EMAC1CFG1; pic32_mii_init(priv); return pic32_phy_init(priv, dev); } static int pic32_eth_remove(struct udevice *dev) { struct pic32eth_dev *priv = dev_get_priv(dev); struct mii_dev *bus; dm_gpio_free(dev, &priv->rst_gpio); phy_shutdown(priv->phydev); free(priv->phydev); bus = miiphy_get_dev_by_name(PIC32_MDIO_NAME); mdio_unregister(bus); mdio_free(bus); iounmap(priv->ectl_regs); return 0; } static const struct udevice_id pic32_eth_ids[] = { { .compatible = "microchip,pic32mzda-eth" }, { } }; U_BOOT_DRIVER(pic32_ethernet) = { .name = "pic32_ethernet", .id = UCLASS_ETH, .of_match = pic32_eth_ids, .probe = pic32_eth_probe, .remove = pic32_eth_remove, .ops = &pic32_eth_ops, .priv_auto_alloc_size = sizeof(struct pic32eth_dev), .platdata_auto_alloc_size = sizeof(struct eth_pdata), };
7,067
2,114
/* * Copyright 2017-present Facebook, 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. */ #include <folly/Portability.h> #if FOLLY_HAS_COROUTINES #include <folly/executors/InlineExecutor.h> #include <folly/experimental/coro/Baton.h> #include <folly/experimental/coro/Future.h> #include <folly/experimental/coro/Promise.h> #include <folly/experimental/coro/Task.h> #include <folly/portability/GTest.h> using namespace folly; TEST(Baton, Ready) { coro::Baton b; CHECK(!b.ready()); b.post(); CHECK(b.ready()); b.reset(); CHECK(!b.ready()); } TEST(Baton, InitiallyReady) { coro::Baton b{true}; CHECK(b.ready()); b.reset(); CHECK(!b.ready()); } TEST(Baton, AwaitBaton) { coro::Baton baton; bool reachedBeforeAwait = false; bool reachedAfterAwait = false; auto makeTask = [&]() -> coro::Task<void> { reachedBeforeAwait = true; co_await baton; reachedAfterAwait = true; }; coro::Task<void> t = makeTask(); CHECK(!reachedBeforeAwait); CHECK(!reachedAfterAwait); auto& executor = InlineExecutor::instance(); coro::Future<void> f = via(&executor, std::move(t)); CHECK(reachedBeforeAwait); CHECK(!reachedAfterAwait); baton.post(); CHECK(reachedAfterAwait); } #endif
623
2,816
#pragma once #include "duckdb/common/file_system.hpp" #include "duckdb/common/pair.hpp" #include "duckdb/common/unordered_map.hpp" namespace duckdb_httplib_openssl { struct Response; } namespace duckdb { using HeaderMap = unordered_map<string, string>; struct ResponseWrapper { /* avoid including httplib in header */ public: ResponseWrapper(duckdb_httplib_openssl::Response &res); int code; string error; HeaderMap headers; }; class HTTPFileHandle : public FileHandle { public: HTTPFileHandle(FileSystem &fs, std::string path); // This two-phase construction allows subclasses more flexible setup. virtual void InitializeMetadata(); idx_t length; time_t last_modified; std::unique_ptr<data_t[]> buffer; constexpr static idx_t BUFFER_LEN = 1000000; idx_t buffer_available; idx_t buffer_idx; idx_t file_offset; idx_t buffer_start; idx_t buffer_end; public: void Close() override { } }; class HTTPFileSystem : public FileSystem { public: std::unique_ptr<FileHandle> OpenFile(const string &path, uint8_t flags, FileLockType lock = DEFAULT_LOCK, FileCompressionType compression = DEFAULT_COMPRESSION, FileOpener *opener = nullptr) override final; std::vector<std::string> Glob(const std::string &path) override { return {path}; // FIXME } void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override; virtual unique_ptr<ResponseWrapper> Request(FileHandle &handle, string url, string method, HeaderMap header_map = {}, idx_t file_offset = 0, char *buffer_out = nullptr, idx_t buffer_len = 0); int64_t Read(FileHandle &handle, void *buffer, int64_t nr_bytes) override; int64_t GetFileSize(FileHandle &handle) override; time_t GetLastModifiedTime(FileHandle &handle) override; bool FileExists(const string &filename) override; static void Verify(); bool CanSeek() override { return true; } void Seek(FileHandle &handle, idx_t location) override; bool CanHandleFile(const string &fpath) override; bool OnDiskFile(FileHandle &handle) override { return false; } std::string GetName() const override { return "HTTPFileSystem"; } protected: virtual std::unique_ptr<HTTPFileHandle> CreateHandle(const string &path, uint8_t flags, FileLockType lock, FileCompressionType compression, FileOpener *opener); }; } // namespace duckdb
988
14,793
<filename>weixin-java-pay/src/main/java/com/github/binarywang/wxpay/util/XmlConfig.java package com.github.binarywang.wxpay.util; public class XmlConfig { /** * 是否使用快速模式 * * 如果设置为true,将会影响下面的方法,不再使用反射的方法来进行xml转换。 * 1: BaseWxPayRequest的toXML方法 * 2: BaseWxPayResult的fromXML方法 * @see com.github.binarywang.wxpay.bean.request.BaseWxPayRequest#toXML * @see com.github.binarywang.wxpay.bean.result.BaseWxPayResult#fromXML * * 启用快速模式后,将能: * 1:性能提升约 10 ~ 15倍 * 2:可以通过 graalvm 生成native image,大大减少系统开销(CPU,RAM),加快应用启动速度(亚秒级),加快系统部署速度(脱离JRE). * * 参考测试案例: com.github.binarywang.wxpay.bean.result.WxPayRedpackQueryResultTest#benchmark * 参考网址: https://www.graalvm.org/ */ public static boolean fastMode = false; }
517
4,036
<filename>java/ql/test/stubs/google-android-9.0.0/android/database/sqlite/SQLiteTransactionListener.java // Generated automatically from android.database.sqlite.SQLiteTransactionListener for testing purposes package android.database.sqlite; public interface SQLiteTransactionListener { void onBegin(); void onCommit(); void onRollback(); }
104
892
{ "schema_version": "1.2.0", "id": "GHSA-m5vr-3m74-jwxp", "modified": "2021-11-19T15:43:34Z", "published": "2020-07-29T16:15:19Z", "aliases": [ "CVE-2020-15098" ], "summary": "Missing Required Cryptographic Step Leading to Sensitive Information Disclosure in TYPO3 CMS", "details": "> ### Meta\n> * CVSS: `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C` (8.2)\n> * CWE-325, CWE-20, CWE-200, CWE-502\n\n### Problem\nIt has been discovered that an internal verification mechanism can be used to generate arbitrary checksums. This allows to inject arbitrary data having a valid cryptographic message authentication code (HMAC-SHA1) and can lead to various attack chains as described below.\n\n* [TYPO3-CORE-SA-2020-007](https://typo3.org/security/advisory/typo3-core-sa-2020-007), [CVE-2020-15099](https://nvd.nist.gov/vuln/detail/CVE-2020-15099): Potential Privilege Escalation\n + the database server used for a TYPO3 installation must be accessible for an attacker (either via internet or shared hosting network)\n + `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C` (7.5, high)\n* [TYPO3-CORE-SA-2016-013](https://typo3.org/security/advisory/typo3-core-sa-2016-013), [CVE-2016-5091](https://nvd.nist.gov/vuln/detail/CVE-2016-5091): Insecure Deserialization & Remote Code Execution\n + an attacker must have access to at least one Extbase plugin or module action in a TYPO3 installation\n + `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C` (9.1, critical)\n\nThe overall severity of this vulnerability is **high (8.2)** based on mentioned attack chains and the requirement of having a valid backend user session (authenticated).\n\n### Solution\nUpdate to TYPO3 versions 9.5.20 or 10.4.6 that fix the problem described.\n\n### Credits\nThanks to TYPO3 security team member <NAME> who reported and fixed the issue.\n\n### References\n* [TYPO3-CORE-SA-2020-008](https://typo3.org/security/advisory/typo3-core-sa-2020-008)", "severity": [ { "type": "CVSS_V3", "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H" } ], "affected": [ { "package": { "ecosystem": "Packagist", "name": "typo3/cms-core" }, "ranges": [ { "type": "ECOSYSTEM", "events": [ { "introduced": "9.0.0" }, { "fixed": "9.5.20" } ] } ] }, { "package": { "ecosystem": "Packagist", "name": "typo3/cms-core" }, "ranges": [ { "type": "ECOSYSTEM", "events": [ { "introduced": "10.0.0" }, { "fixed": "10.4.6" } ] } ] } ], "references": [ { "type": "WEB", "url": "https://github.com/TYPO3/TYPO3.CMS/security/advisories/GHSA-m5vr-3m74-jwxp" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2016-5091" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2020-15098" }, { "type": "WEB", "url": "https://github.com/TYPO3/TYPO3.CMS/commit/85d3e70dff35a99ef53f4b561114acfa9e5c47e1" }, { "type": "WEB", "url": "https://typo3.org/security/advisory/typo3-core-sa-2016-013" }, { "type": "WEB", "url": "https://typo3.org/security/advisory/typo3-core-sa-2020-008" }, { "type": "PACKAGE", "url": "https://github.com/TYPO3/TYPO3.CMS" } ], "database_specific": { "cwe_ids": [ "CWE-20", "CWE-200", "CWE-325", "CWE-327", "CWE-502" ], "severity": "HIGH", "github_reviewed": true } }
1,895
310
""" Copyright (c) 2019-2020 Intel Corporation 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. """ from typing import List import torch from nncf.api.compression import CompressionLoss from nncf.api.compression import CompressionScheduler from nncf.api.compression import CompressionStage from nncf.common.graph import NNCFNode from nncf.common.graph import NNCFNodeName from nncf.common.graph.transformations.commands import TargetType from nncf.common.schedulers import BaseCompressionScheduler from nncf.common.schedulers import StubCompressionScheduler from nncf.common.sparsity.controller import SparsityController from nncf.common.utils.logger import logger as nncf_logger from nncf.torch.algo_selector import ZeroCompressionLoss from nncf.torch.compression_method_api import PTCompressionAlgorithmBuilder from nncf.torch.compression_method_api import PTCompressionAlgorithmController from nncf.torch.graph.transformations.commands import PTInsertionCommand from nncf.torch.graph.transformations.commands import PTTargetPoint from nncf.torch.graph.transformations.commands import TransformationPriority from nncf.torch.graph.transformations.layout import PTTransformationLayout from nncf.torch.nncf_network import NNCFNetwork class SparseModuleInfo: def __init__(self, module_node_name: NNCFNodeName, module: torch.nn.Module, operand): self.module_node_name = module_node_name self.module = module self.operand = operand class BaseSparsityAlgoBuilder(PTCompressionAlgorithmBuilder): def __init__(self, config, should_init: bool = True): super().__init__(config, should_init) self._sparsified_module_info = [] def _get_transformation_layout(self, target_model: NNCFNetwork) -> PTTransformationLayout: layout = PTTransformationLayout() commands = self._sparsify_weights(target_model) for command in commands: layout.register(command) return layout def _sparsify_weights(self, target_model: NNCFNetwork) -> List[PTInsertionCommand]: device = next(target_model.parameters()).device sparsified_module_nodes = target_model.get_weighted_original_graph_nodes( nncf_module_names=self.compressed_nncf_module_names) insertion_commands = [] for module_node in sparsified_module_nodes: node_name = module_node.node_name if not self._should_consider_scope(node_name): nncf_logger.info("Ignored adding Weight Sparsifier in scope: {}".format(node_name)) continue nncf_logger.info("Adding Weight Sparsifier in scope: {}".format(node_name)) compression_lr_multiplier = \ self.config.get_redefinable_global_param_value_for_algo('compression_lr_multiplier', self.name) operation = self.create_weight_sparsifying_operation(module_node, compression_lr_multiplier) hook = operation.to(device) insertion_commands.append(PTInsertionCommand(PTTargetPoint(TargetType.OPERATION_WITH_WEIGHTS, target_node_name=node_name), hook, TransformationPriority.SPARSIFICATION_PRIORITY)) sparsified_module = target_model.get_containing_module(node_name) self._sparsified_module_info.append( SparseModuleInfo(node_name, sparsified_module, hook)) return insertion_commands def create_weight_sparsifying_operation(self, target_module_node: NNCFNode, compression_lr_multiplier: float): raise NotImplementedError def initialize(self, model: NNCFNetwork) -> None: pass class BaseSparsityAlgoController(PTCompressionAlgorithmController, SparsityController): def __init__(self, target_model: NNCFNetwork, sparsified_module_info: List[SparseModuleInfo]): super().__init__(target_model) self._loss = ZeroCompressionLoss(next(target_model.parameters()).device) self._scheduler = BaseCompressionScheduler() self.sparsified_module_info = sparsified_module_info @property def loss(self) -> CompressionLoss: return self._loss @property def scheduler(self) -> CompressionScheduler: return self._scheduler def disable_scheduler(self): self._scheduler = StubCompressionScheduler() self._scheduler.target_level = 0.0 self._scheduler.current_sparsity_level = 0.0 def compression_stage(self) -> CompressionStage: return CompressionStage.FULLY_COMPRESSED
2,008
1,010
/* * The Shadow Simulator * See LICENSE for licensing information */ #include <stddef.h> #include <syscall.h> #include "lib/shim/shim_api.h" /// The purpose of the injector library is to facilitate connecting Shadow to /// each of the managed processes that it runs. This interaction is controlled /// using a shim. We have two main goals: /// /// 1. Inject the shim into the managaged process space. /// 2. Be minimally invasive, i.e., do not unnecessarily intercept functions /// called by the managed process. /// /// We accomplish the first goal by preloading the injector lib, which links to /// the shim and calls a shim function in a constructor (to ensure that the shim /// does get loaded). We accomplish the second goal by defining no other /// functions in this injector lib, which decouples shim injection from function /// interception. /// /// Notes: /// /// - We do not preload the shim directly because it does not meet the second /// goal of being minimally invasive. /// - Technically, the shim will already be injected if there are other /// preloaded libraries that link to it. But the injector library enables a /// minimally invasive way to inject the shim that works even if those other /// libraries are not preloaded. // A constructor is used to load the shim as soon as possible. __attribute__((constructor, used)) void _injector_load() { // Make a call to the shim to ensure that it's loaded. The SYS_time syscall // will be handled locally in the shim, avoiding IPC with Shadow. shim_api_syscall(SYS_time, NULL); return; } // Do NOT define other symbols.
449
1,127
<reponame>ryanloney/openvino-1 // Copyright (C) 2018-2022 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // /////////////////////////////////////////////////////////////////////////////////////////////////// #include "custom_gpu_primitive_inst.h" #include "primitive_type_base.h" #include <sstream> #include "json_object.h" #include <string> namespace cldnn { primitive_type_id custom_gpu_primitive::type_id() { static primitive_type_base<custom_gpu_primitive> instance; return &instance; } std::string custom_gpu_primitive_inst::to_string(custom_gpu_primitive_node const& node) { auto desc = node.get_primitive(); auto node_info = node.desc_to_json(); std::stringstream primitive_description; json_composite custom_gpu_prim_info; custom_gpu_prim_info.add("entry point", desc->kernel_entry_point); custom_gpu_prim_info.add("kernels code", desc->kernels_code); custom_gpu_prim_info.add("build options", desc->build_options); custom_gpu_prim_info.add("gws", desc->gws); custom_gpu_prim_info.add("lws", desc->lws); // TODO: consider printing more information here node_info->add("custom primitive info", custom_gpu_prim_info); node_info->dump(primitive_description); return primitive_description.str(); } custom_gpu_primitive_inst::typed_primitive_inst(network& network, custom_gpu_primitive_node const& node) : parent(network, node) {} } // namespace cldnn
485
3,095
/***************************************************************************** * vlc_timestamp_helper.h : timestamp handling helpers ***************************************************************************** * Copyright (C) 2014 VLC authors and VideoLAN * $Id: 90840fbcf7a5197f235ab6160a2cc2708a87c54d $ * * Authors: <NAME> <<EMAIL>> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifndef VLC_TIMESTAMP_H #define VLC_TIMESTAMP_H 1 /* Implementation of a circular buffer of timestamps with overwriting * of older values. MediaCodec has only one type of timestamp, if a * block has no PTS, we send the DTS instead. Some hardware decoders * cannot cope with this situation and output the frames in the wrong * order. As a workaround in this case, we use a FIFO of timestamps in * order to remember which input packets had no PTS. Since an * hardware decoder can silently drop frames, this might cause a * growing desynchronization with the actual timestamp. Thus the * circular buffer has a limited size and will overwrite older values. */ typedef struct { uint32_t begin; uint32_t size; uint32_t capacity; int64_t *buffer; } timestamp_fifo_t; static inline timestamp_fifo_t *timestamp_FifoNew(uint32_t capacity) { timestamp_fifo_t *fifo = calloc(1, sizeof(*fifo)); if (!fifo) return NULL; fifo->buffer = vlc_alloc(capacity, sizeof(*fifo->buffer)); if (!fifo->buffer) { free(fifo); return NULL; } fifo->capacity = capacity; return fifo; } static inline void timestamp_FifoRelease(timestamp_fifo_t *fifo) { free(fifo->buffer); free(fifo); } static inline bool timestamp_FifoIsEmpty(timestamp_fifo_t *fifo) { return fifo->size == 0; } static inline bool timestamp_FifoIsFull(timestamp_fifo_t *fifo) { return fifo->size == fifo->capacity; } static inline void timestamp_FifoEmpty(timestamp_fifo_t *fifo) { fifo->size = 0; } static inline void timestamp_FifoPut(timestamp_fifo_t *fifo, int64_t ts) { uint32_t end = (fifo->begin + fifo->size) % fifo->capacity; fifo->buffer[end] = ts; if (!timestamp_FifoIsFull(fifo)) fifo->size += 1; else fifo->begin = (fifo->begin + 1) % fifo->capacity; } static inline int64_t timestamp_FifoGet(timestamp_fifo_t *fifo) { if (timestamp_FifoIsEmpty(fifo)) return VLC_TS_INVALID; int64_t result = fifo->buffer[fifo->begin]; fifo->begin = (fifo->begin + 1) % fifo->capacity; fifo->size -= 1; return result; } #endif
1,126
785
/* * Copyright 2016-2021 Pnoker. 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. */ package org.openscada.opc.lib.da.browser; public enum Access { READ(1), WRITE(2); private int _code = 0; private Access(final int code) { this._code = code; } public int getCode() { return this._code; } }
267
6,989
<filename>catboost/libs/algo/ders_holder.h #pragma once struct TDers { double Der1; double Der2; double Der3; };
57
884
/* * Copyright 2014 - 2021 Blazebit. * * 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.blazebit.persistence.criteria.impl.expression; import com.blazebit.persistence.criteria.impl.BlazeCriteriaBuilderImpl; import com.blazebit.persistence.criteria.impl.ParameterVisitor; import com.blazebit.persistence.criteria.impl.RenderContext; /** * @author <NAME> * @since 1.2.0 */ public class BooleanLiteralPredicate extends AbstractSimplePredicate { private static final long serialVersionUID = 1L; private final Boolean value; public BooleanLiteralPredicate(BlazeCriteriaBuilderImpl criteriaBuilder, Boolean value) { super(criteriaBuilder, false); this.value = value; } @Override public AbstractPredicate copyNegated() { return new BooleanLiteralPredicate(criteriaBuilder, !value); } @Override public void visitParameters(ParameterVisitor visitor) { // no-op } @Override public void render(RenderContext context) { if (value ^ isNegated()) { context.getBuffer().append("1=1"); } else { context.getBuffer().append("1=0"); } } }
559
2,174
package ceui.lisa.utils; public class Params { public static final String ID = "simple id"; public static final String USER_ID = "user id"; public static final String ILLUST_ID = "illust id"; public static final String NOVEL_ID = "novel id"; public static final String ILLUST_TITLE = "illust title"; public static final String DATA_TYPE = "data type"; public static final String INDEX = "index"; public static final String CONTENT = "content"; public static final String DAY = "day"; public static final String URL = "url"; public static final String TITLE = "title"; public static final String KEY_WORD = "key word"; public static final String SORT_TYPE = "sort type"; public static final String CONTENT_TYPE = "content type"; public static final String SIZE = "size"; public static final String SEARCH_TYPE = "search type"; public static final String STAR_SIZE = "star size"; public static final String MANGA = "is manga"; public static final String SHOW_DIALOG = "show dialog"; public static final String USER_MODEL = "user model"; public static final String USE_DEBUG = "use debug mode"; public static final String FILE_PATH = "file path"; public static final String STAR_TYPE = "star type"; public static final String FLAG = "flag"; public static final String RESPONSE = "response"; public static final String MIME = "mime"; public static final String ENCODING = "encoding"; public static final String HISTORY_URL = "history url"; public static final String TYPE_ILLUST = "illust"; public static final String TYPE_NOVEL = "novel"; public static final String TYPE_MANGA = "manga"; public static final String NOVEL_KEY = "pixiv_shaft_novel_"; public static final String USER_KEY = "pixiv_shaft_local_user"; public static final String PAGE_UUID = "page_uuid"; public static final String POSITION = "position"; public static final String IS_LIKED = "is liked"; public static final String IS_POPULAR = "is popular"; public static final String LAST_CLASS = "last class"; public static final String NOVEL_DETAIL = "novel detail"; public static final String PREFER_PRESERVE = "prefer preserve"; public static final String TAG_NAMES = "tag names"; public static final String MAIN_ACTIVITY_NAVIGATION_POSITION = "main activity navigation position"; public static final String FRAGMENT_SEARCH_CLIPBOARD_VALUE = "fragment search clipboard value"; public static final String MANGA_SERIES_ID = "manga series id"; public static final String REVERSE_SEARCH_RESULT = "reverse result"; public static final String REVERSE_SEARCH_IMAGE_URI = "reverse image uri"; public static final String VIEW_PAGER_MUTED = "muted history viewpager"; public static final String VIEW_PAGER_R18 = "r18 viewpager"; public static final String FILTER_ILLUST = "ceui.lisa.fragments.NetListFragment FILTER_ILLUST"; public static final String FILTER_NOVEL = "ceui.lisa.fragments.NetListFragment FILTER_NOVEL"; public static final String LIKED_ILLUST = "ceui.lisa.fragments.NetListFragment LIKED_ILLUST"; public static final String PLAY_GIF = "ceui.lisa.fragments.FragmentSingleUgora PLAY_GIF"; public static final String LIKED_USER = "ceui.lisa.fragments.NetListFragment LIKED_USER"; public static final String LIKED_NOVEL = "ceui.lisa.fragments.NetListFragment LIKED_NOVEL"; public static final String DOWNLOAD_FINISH = "ceui.lisa.fragments.NetListFragment DOWNLOAD_FINISH"; public static final String DOWNLOAD_ING = "ceui.lisa.fragments.NetListFragment DOWNLOAD_ING"; public static final String REFRESH_MAIN_ACTIVITY = "ceui.lisa.REFRESH_MAIN_ACTIVITY"; public static final String FRAGMENT_ADD_DATA = "ceui.lisa.FRAGMENT_ADD_DATA"; public static final String FRAGMENT_SCROLL_TO_POSITION = "ceui.lisa.FRAGMENT_SCROLL_TO_POSITION"; public static final String FRAGMENT_ADD_RELATED_DATA = "ceui.lisa.FRAGMENT_ADD_RELATED_DATA"; public static final String MAP_KEY = "Referer"; public static final String MAP_KEY_SMALL = "referer"; public static final String IMAGE_REFERER = "https://app-api.pixiv.net/"; public static final String USER_AGENT = "User-Agent"; public static final String PHONE_MODEL = "PixivIOSApp/5.8.0"; public static final String HOST = "Host"; public static final String CLOUD_DNS = "cloud dns"; public static final String HOST_NAME = "i.pximg.net"; public static final int DOWNLOAD_FAILED = -86; public static final int DOWNLOAD_SUCCESS = -87; public static final int MUTE_TAG = 0; public static final int MUTE_ILLUST = 1; public static final int MUTE_NOVEL = 2; public static final int MUTE_USER = 3; // ColorPickerDialog public static final int DIALOG_NOVEL_BG_COLOR = 0; public static final int DIALOG_NOVEL_TEXT_COLOR = 1; //hint public static final String HINT_MULTI_DOWNLOAD = "HINT_MULTI_DOWNLOAD"; public static final String HINT_MULTI_DOWNLOAD_LONG_PRESS = "HINT_MULTI_DOWNLOAD_LONG_PRESS"; public static final String HINT_DOWNLOAD_LONG_PRESS = "HINT_DOWNLOAD"; public static final String IMAGE_UNKNOWN = "https://s.pximg.net/common/images/limit_unknown_360.png"; public static final String HEAD_UNKNOWN = "https://s.pximg.net/common/images/no_profile.png"; public static final String URL_R18_SETTING = "https://www.pixiv.net/settings.php?mode=age-check"; public static final String URL_PREMIUM_SETTING = "https://www.pixiv.net/premium.php#premium-payment"; public static final String TYPE_PUBLIC = "public"; public static final String TYPE_PRIVATE = "private"; public static final String TYPE_ALL = "all"; public static final String IMAGE_RESOLUTION_ORIGINAL = "original"; public static final String IMAGE_RESOLUTION_LARGE = "large"; public static final String IMAGE_RESOLUTION_MEDIUM = "medium"; public static final String IMAGE_RESOLUTION_SQUARE_MEDIUM = "square_medium"; public static final String SHOW_LONG_DIALOG = "show long dialog"; public static final String IS_MIGRATE = "IS_MIGRATE"; public static final String MMKV_KEY_ISSHOWTIPS_SEARCHSORT = "tips searchsort"; public static final int REQUEST_CODE_CHOOSE = 10086; public static final String EXAMPLE_ILLUST = "{\n" + " \"caption\":\"\",\n" + " \"create_date\":\"2020-07-07T00:30:02+09:00\",\n" + " \"gifDelay\":0,\n" + " \"height\":2000,\n" + " \"id\":82805170,\n" + " \"image_urls\":{\n" + " \"large\":\"https://i.pximg.net/c/600x1200_90/img-master/img/2020/07/07/00/30/02/82805170_p0_master1200.jpg\",\n" + " \"medium\":\"https://i.pximg.net/c/540x540_70/img-master/img/2020/07/07/00/30/02/82805170_p0_master1200.jpg\",\n" + " \"square_medium\":\"https://i.pximg.net/c/360x360_70/img-master/img/2020/07/07/00/30/02/82805170_p0_square1200.jpg\"\n" + " },\n" + " \"isChecked\":false,\n" + " \"isShield\":false,\n" + " \"is_bookmarked\":false,\n" + " \"is_muted\":false,\n" + " \"meta_pages\":[\n" + " {\n" + " \"image_urls\":{\n" + " \"large\":\"https://i.pximg.net/c/600x1200_90/img-master/img/2020/07/07/00/30/02/82805170_p0_master1200.jpg\",\n" + " \"medium\":\"https://i.pximg.net/c/540x540_70/img-master/img/2020/07/07/00/30/02/82805170_p0_master1200.jpg\",\n" + " \"original\":\"https://i.pximg.net/img-original/img/2020/07/07/00/30/02/82805170_p0.png\",\n" + " \"square_medium\":\"https://i.pximg.net/c/360x360_70/img-master/img/2020/07/07/00/30/02/82805170_p0_square1200.jpg\"\n" + " }\n" + " },\n" + " {\n" + " \"image_urls\":{\n" + " \"large\":\"https://i.pximg.net/c/600x1200_90/img-master/img/2020/07/07/00/30/02/82805170_p1_master1200.jpg\",\n" + " \"medium\":\"https://i.pximg.net/c/540x540_70/img-master/img/2020/07/07/00/30/02/82805170_p1_master1200.jpg\",\n" + " \"original\":\"https://i.pximg.net/img-original/img/2020/07/07/00/30/02/82805170_p1.png\",\n" + " \"square_medium\":\"https://i.pximg.net/c/360x360_70/img-master/img/2020/07/07/00/30/02/82805170_p1_square1200.jpg\"\n" + " }\n" + " }\n" + " ],\n" + " \"meta_single_page\":{\n" + "\n" + " },\n" + " \"page_count\":2,\n" + " \"restrict\":0,\n" + " \"sanity_level\":2,\n" + " \"tags\":[\n" + " {\n" + " \"added_by_uploaded_user\":false,\n" + " \"count\":0,\n" + " \"isSelected\":false,\n" + " \"name\":\"オリジナル\",\n" + " \"translated_name\":\"原创\"\n" + " },\n" + " {\n" + " \"added_by_uploaded_user\":false,\n" + " \"count\":0,\n" + " \"isSelected\":false,\n" + " \"name\":\"女の子\",\n" + " \"translated_name\":\"女孩子\"\n" + " },\n" + " {\n" + " \"added_by_uploaded_user\":false,\n" + " \"count\":0,\n" + " \"isSelected\":false,\n" + " \"name\":\"銀髪碧眼\",\n" + " \"translated_name\":\"银发碧眼\"\n" + " },\n" + " {\n" + " \"added_by_uploaded_user\":false,\n" + " \"count\":0,\n" + " \"isSelected\":false,\n" + " \"name\":\"オリジナル10000users入り\",\n" + " \"translated_name\":\"原创10000users加入书籤\"\n" + " }\n" + " ],\n" + " \"title\":\"作品标题\",\n" + " \"tools\":[\n" + "\n" + " ],\n" + " \"total_bookmarks\":14306,\n" + " \"total_view\":47802,\n" + " \"type\":\"illust\",\n" + " \"user\":{\n" + " \"account\":\"sinsihukunokonaka\",\n" + " \"id\":1122006,\n" + " \"is_followed\":false,\n" + " \"is_login\":false,\n" + " \"is_mail_authorized\":false,\n" + " \"is_premium\":false,\n" + " \"lastTokenTime\":-1,\n" + " \"name\":\"画师昵称\",\n" + " \"profile_image_urls\":{\n" + " \"medium\":\"https://i.pximg.net/user-profile/img/2016/02/26/03/01/16/10587767_da08b7a0bc20d8eadbe8e7f9539b5400_170.png\"\n" + " },\n" + " \"require_policy_agreement\":false,\n" + " \"x_restrict\":0\n" + " },\n" + " \"visible\":true,\n" + " \"width\":1200,\n" + " \"x_restrict\":0\n" + "}"; }
5,847
726
<filename>code/41.java class MedianFinder { PriorityQueue<Integer> heapS; PriorityQueue<Integer> heapL; /** initialize your data structure here. */ public MedianFinder() { heapS = new PriorityQueue<>(); heapL = new PriorityQueue<>(new Comparator<Integer>(){ public int compare(Integer o1, Integer o2){ return o2 - o1; } }); } public void addNum(int num) { //当heapS为空或者heapS和heapL的size一样时, 优先向heapS中添加元素 if(heapS.isEmpty() || heapS.size()==heapL.size()){ if(!heapL.isEmpty() && num < heapL.peek()){ heapL.add(num); num = heapL.poll(); } heapS.add(num); }else{ if(!heapS.isEmpty() && num > heapS.peek()){ heapS.add(num); num = heapS.poll(); } heapL.add(num); } } public double findMedian() { return heapS.size()>heapL.size()? heapS.peek() : (heapL.peek() + heapS.peek())/2.0; } }
590
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. // ---------------------------------------------------------------------------- #include "open3d/ml/tensorflow/TensorFlowHelper.h" #include "tensorflow/core/framework/common_shape_fns.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/shape_inference.h" using namespace tensorflow; REGISTER_OP("Open3DTrilinearDevoxelize") .Attr("resolution: int") .Attr("is_training: bool") .Input("coords: float32") .Input("features: float32") .Output("outputs: float32") .Output("indices: int32") .Output("weights: float32") .SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) { using namespace ::tensorflow::shape_inference; using namespace open3d::ml::op_util; ShapeHandle coords; // (batch_size, 3, N) ShapeHandle features; // (batch_size, C, R, R, R) TF_RETURN_IF_ERROR(c->WithRank(c->input(0), 3, &coords)); TF_RETURN_IF_ERROR(c->WithRank(c->input(1), 5, &features)); Dim batch_size("batch_size"); Dim num_points("num_points"); Dim resolution("resolution"); Dim feat_dim("feat_dim"); CHECK_SHAPE_HANDLE(c, coords, batch_size, 3, num_points); CHECK_SHAPE_HANDLE(c, features, batch_size, feat_dim, resolution, resolution, resolution); ShapeHandle out1, out2; out1 = c->MakeShape( {c->MakeDim(batch_size.value()), c->MakeDim(feat_dim.value()), c->MakeDim(num_points.value())}); // (batch_size, C, N) out2 = c->MakeShape( {c->MakeDim(batch_size.value()), 8, c->MakeDim(num_points.value())}); // (batch_size, 8, N) c->set_output(0, out1); c->set_output(1, out2); c->set_output(2, out2); return Status::OK(); }) .Doc(R"doc( Trilinear Devoxelize. This function takes a 3D voxel grid and a list of coordinates and computes interpolated features corresponding to each point. Minimal example:: import open3d.ml.tf as ml3d coords = tf.Tensor( [[[0.2 0.0 0.0 1.0 1.5] [1.0 1.2 0.9 0.0 0.7] [0.2 0.6 0.8 0.7 1.1]]], shape=(1, 3, 5), dtype=float32) features = tf.Tensor( [[[[[0. 0.5] [0.6 0.4]] [[0.5 0.7] [0.6 0.5]]] [[[0.4 0.8] [0.6 0.3]] [[0.4 0.2] [0.8 0.6]]] [[[0.1 0.2] [0. 0.6]] [[0.9 0. ] [0.2 0.3]]]]], shape=(1, 3, 2, 2, 2), dtype=float32) ml3d.ops.trilinear_devoxelize(coords, features, resolution, is_training) # returns output tf.Tensor( # array([[[0.564 , 0.508 , 0.436 , 0.64 , 0.5005 ], # [0.58400005, 0.39200002, 0.396 , 0.26000002, 0.47900003], # [0.14 , 0.36 , 0.45000002, 0.27 , 0.0975 ]]], # shape=(1, 3, 5), dtype=float32) # # indices tf.Tensor([[[ 2, 2, 0, 4, 5], # [ 3, 3, 1, 5, 6], # [ 2, 4, 2, 4, 7], # [ 3, 5, 3, 5, 8], # [ 6, 2, 0, 4, 9], # [ 7, 3, 1, 5, 10], # [ 6, 4, 2, 4, 11], # [ 7, 5, 3, 5, 12]]], # shape=(1, 8, 5), dtype=float32) # # weights tf.Tensor([[[0.64000005, 0.31999996, 0.02 , 0.3 , 0.135 ], # [0.16000001, 0.48 , 0.08000002, 0.7 , 0.015 ], # [0. , 0.08000001, 0.17999998, 0. , 0.315 ], # [0. , 0.12000003, 0.71999997, 0. , 0.03500001], # [0.16000001, 0. , 0. , 0. , 0.135 ], # [0.04 , 0. , 0. , 0. , 0.015 ], # [0. , 0. , 0. , 0. , 0.315 ], # [0. , 0. , 0. , 0. , 0.03500001]]], # shape=(1, 8, 5), dtype=float32) coords: List of 3D coordinates for which features to be interpolated. The shape of this tensor is [B, 3, N]. The range of coordinates is [0, resolution-1]. If all of the adjacent position of any coordinate are out of range, then the interpolated features will be 0. Voxel centers are at integral values of voxel grid. features: A voxel grid of shape [B, C, R, R, R]. Here R is resolution. resolution: Integer attribute defining resolution of the voxel grid. is_training: Boolean variable for training phase. outputs: Features for each point. The shape of this tensor is [B, C, N]. indices: Indices which are used to interpolate features. Shape is [B, 8, N]. weights: Weights for each index used to interpolate features. Shape is [B, 8, N]. )doc"); REGISTER_OP("Open3DTrilinearDevoxelizeGrad") .Input("grad_y: float32") .Input("indices: int32") .Input("weights: float32") .Attr("resolution: int") .Output("grad_x: float32") .SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) { using namespace ::tensorflow::shape_inference; using namespace open3d::ml::op_util; ShapeHandle grad_y; // (batch_size, C, N) ShapeHandle indices; // (batch_size, 8, N) TF_RETURN_IF_ERROR(c->WithRank(c->input(0), 3, &grad_y)); TF_RETURN_IF_ERROR(c->WithRank(c->input(1), 3, &indices)); Dim batch_size("batch_size"); Dim feat_dim("feat_dim"); Dim num_points("num_points"); CHECK_SHAPE_HANDLE(c, grad_y, batch_size, feat_dim, num_points); CHECK_SHAPE_HANDLE(c, indices, batch_size, 8, num_points); ShapeHandle out; int r_; TF_RETURN_IF_ERROR(c->GetAttr("resolution", &r_)); out = c->MakeShape({c->MakeDim(batch_size.value()), c->MakeDim(feat_dim.value()), r_, r_, r_}); // (batch_size, C, R, R, R) c->set_output(0, out); return Status::OK(); }) .Doc(R"doc( Gradient function for Trilinear Devoxelize op. This function takes feature gradients and indices, weights returned from the op and computes gradient for voxelgrid. grad_y: Gradients for the interpolated features. Shape is [B, C, N]. indices: Indices which are used to interpolate features. Shape is [B, 8, N]. weights: Weights for each index used to interpolate features. Shape is [B, 8, N]. resolution: Integer attribute defining resolution of the grid. grad_x: Output gradients for the voxel grid. Shape is [B, C, R, R, R] )doc");
4,196
2,151
<filename>third_party/feed/src/src/test/java/com/google/android/libraries/feed/hostimpl/storage/PersistentContentStorageTest.java<gh_stars>1000+ // Copyright 2018 The Feed 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. package com.google.android.libraries.feed.hostimpl.storage; import static org.mockito.MockitoAnnotations.initMocks; import android.content.Context; import com.google.android.libraries.feed.api.common.ThreadUtils; import com.google.android.libraries.feed.testing.conformance.storage.ContentStorageConformanceTest; import com.google.common.util.concurrent.MoreExecutors; import org.junit.After; import org.junit.Before; import org.junit.runner.RunWith; import org.mockito.Mock; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; /** Tests for {@link PersistentContentStorage}. */ @RunWith(RobolectricTestRunner.class) public class PersistentContentStorageTest extends ContentStorageConformanceTest { @Mock private ThreadUtils threadUtils; private Context context; @Before public void setUp() { initMocks(this); context = RuntimeEnvironment.application; storage = new PersistentContentStorage( context, MoreExecutors.newDirectExecutorService(), threadUtils); } @After public void tearDown() { context.getFilesDir().delete(); } }
557
848
/* * Copyright 2019 Xilinx 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. */ #pragma once #include <condition_variable> #include <mutex> #include <vector> namespace xilinx { namespace ai { template <typename T> class RingQueue { public: explicit RingQueue(std::size_t capacity) : capacity_(capacity), buffer_(capacity), size_(0U), front_(0U), rear_(0U) {} std::size_t capacity() const { return capacity_; } std::size_t size() const { return size_; } void push(const T &new_value) { std::lock_guard<std::mutex> lock(mtx_); buffer_[rear_] = new_value; rear_ = (rear_ + 1) % capacity_; if (size_ >= capacity_) { front_ = rear_; } else { ++size_; } } bool pop(T &value) { std::lock_guard<std::mutex> lock(mtx_); bool res = false; if (size_ > 0) { value = buffer_[front_]; front_ = (front_ + 1) % capacity_; --size_; res = true; } return res; } T *pop() { std::lock_guard<std::mutex> lock(mtx_); T *res = nullptr; if (size_ > 0) { res = &buffer_[front_]; front_ = (front_ + 1) % capacity_; --size_; } return res; } T *front() { std::lock_guard<std::mutex> lock(mtx_); T *res = nullptr; if (size_ > 0) { res = &buffer_[front_]; } return res; } bool clear() { std::lock_guard<std::mutex> lock(mtx_); if (size_ > 0) { front_ = rear_ = 0; size_ = 0; } return true; } private: std::size_t capacity_; std::vector<T> buffer_; std::size_t size_; std::size_t front_; std::size_t rear_; mutable std::mutex mtx_; }; } // namespace ai } // namespace xilinx
913
670
<gh_stars>100-1000 package com.uddernetworks.mspaint.code.languages.java; import com.uddernetworks.mspaint.cmd.Commandline; import com.uddernetworks.mspaint.code.gui.BooleanLangGUIOption; import com.uddernetworks.mspaint.code.gui.DropdownLangGUIOption; import com.uddernetworks.mspaint.code.gui.FileLangGUIOption; import com.uddernetworks.mspaint.code.gui.StringLangGUIOption; import com.uddernetworks.mspaint.code.languages.LanguageSettings; import com.uddernetworks.mspaint.main.ProjectFileFilter; import com.uddernetworks.mspaint.project.ProjectManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; public class JavaSettings extends LanguageSettings { private static Logger LOGGER = LoggerFactory.getLogger(JavaSettings.class); public JavaSettings() { super("Java"); } public JavaSettings(LanguageSettings settings) { super("Java"); this.settings = settings.settings; } @Override public void initOptions() { addOption(JavaLangOptions.INPUT_DIRECTORY, new FileLangGUIOption("Input directory") .setChooserTitle("Select the source directory containing your sourcecode images") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setSelectDirectories(true), () -> createSubOfProject("src")); addOption(JavaLangOptions.HIGHLIGHT_DIRECTORY, new FileLangGUIOption("Highlight directory") .setChooserTitle("Select the directory to contain all highlighted code images") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setSelectDirectories(true), () -> createSubOfProject("highlight")); addOption(JavaLangOptions.MAIN, new StringLangGUIOption("Main class", "com.example.Main"), // TODO: Class selection () -> new File(ProjectManager.getPPFProject().getFile().getParentFile(), "Output.jar")); addOption(JavaLangOptions.JAR, new FileLangGUIOption("Jar output") .setChooserTitle("Select or create the file the compiled jar will be") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setExtensionFilter(ProjectFileFilter.JAR) .setSave(true), () -> new File(ProjectManager.getPPFProject().getFile().getParentFile(), "Output.jar")); addOption(JavaLangOptions.CLASS_OUTPUT, new FileLangGUIOption("Class output") .setChooserTitle("Select the directory the classes will compile to") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setSelectDirectories(true), () -> create(new File(ProjectManager.getPPFProject().getFile().getParentFile(), "build"))); addOption(JavaLangOptions.COMPILER_OUTPUT, new FileLangGUIOption("Compiler output") .setChooserTitle("Select or create the png file where compiler output text will be located") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setExtensionFilter(ProjectFileFilter.PNG) .setSave(true), () -> new File(ProjectManager.getPPFProject().getFile().getParentFile(), "compiler.png")); addOption(JavaLangOptions.PROGRAM_OUTPUT, new FileLangGUIOption("Program output") .setChooserTitle("Select or create the png file where program output text will be located") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setExtensionFilter(ProjectFileFilter.PNG) .setSave(true), () -> new File(ProjectManager.getPPFProject().getFile().getParentFile(), "program.png")); addOption(JavaLangOptions.JAVA_VERSION, new DropdownLangGUIOption("Java Version", "Java 8", "Java 9", "Java 10", "Java 11", "Java 12", "Java 13"), () -> { var output = Commandline.runCommand("java", "--version"); if (!output.contains(" ")) return "Java 11"; var version = "Java " + output.split("\\s+")[1].split("\\.")[0]; LOGGER.info("Current version of Java is {}", version); return version; }); addOption(JavaLangOptions.HIGHLIGHT, new BooleanLangGUIOption("Syntax highlight"), () -> true); addOption(JavaLangOptions.COMPILE, new BooleanLangGUIOption("Compile program"), () -> true); addOption(JavaLangOptions.EXECUTE, new BooleanLangGUIOption("Execute program"), () -> true); addOption(JavaLangOptions.LIBRARY_LOCATION, new FileLangGUIOption("Library location") .setChooserTitle("Select the directory containing libraries used in your program") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setSelectDirectories(true)); addOption(JavaLangOptions.OTHER_LOCATION, new FileLangGUIOption("Other location") .setChooserTitle("Select the directory containing all non-java files to be put in your program, used as a 'resources' directory") .setInitialDirectory(FileLangGUIOption.PPF_PARENT_DIR) .setSelectDirectories(true)); reload(); } @Override protected JavaOptions nameToEnum(String name) { return JavaLangOptions.staticFromName(name); } }
2,490