max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
36,552
<gh_stars>1000+ /* This file was generated by upbc (the upb compiler) from the input * file: * * envoy/type/matcher/v3/struct.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ #include <stddef.h> #include "upb/msg_internal.h" #include "envoy/type/matcher/v3/struct.upb.h" #include "envoy/type/matcher/v3/value.upb.h" #include "udpa/annotations/status.upb.h" #include "udpa/annotations/versioning.upb.h" #include "validate/validate.upb.h" #include "upb/port_def.inc" static const upb_msglayout *const envoy_type_matcher_v3_StructMatcher_submsgs[2] = { &envoy_type_matcher_v3_StructMatcher_PathSegment_msginit, &envoy_type_matcher_v3_ValueMatcher_msginit, }; static const upb_msglayout_field envoy_type_matcher_v3_StructMatcher__fields[2] = { {2, UPB_SIZE(8, 16), 0, 0, 11, _UPB_MODE_ARRAY}, {3, UPB_SIZE(4, 8), 1, 1, 11, _UPB_MODE_SCALAR}, }; const upb_msglayout envoy_type_matcher_v3_StructMatcher_msginit = { &envoy_type_matcher_v3_StructMatcher_submsgs[0], &envoy_type_matcher_v3_StructMatcher__fields[0], UPB_SIZE(16, 24), 2, false, 0, 255, }; static const upb_msglayout_field envoy_type_matcher_v3_StructMatcher_PathSegment__fields[1] = { {1, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, _UPB_MODE_SCALAR}, }; const upb_msglayout envoy_type_matcher_v3_StructMatcher_PathSegment_msginit = { NULL, &envoy_type_matcher_v3_StructMatcher_PathSegment__fields[0], UPB_SIZE(16, 32), 1, false, 1, 255, }; #include "upb/port_undef.inc"
658
1,172
// Copyright (C) 2008 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.caja.render; /** * Quickly classifies JS and CSS tokens so they can be rendered to an output * stream. * * @author <EMAIL> */ enum TokenClassification { LINEBREAK, SPACE, STRING, REGEX, COMMENT, PUNCTUATION, OTHER, ; static TokenClassification classify(CharSequence text) { if ("".equals(text)) { return null; } char ch0 = text.charAt(0); if (ch0 == '\n' || ch0 == '\r') { return LINEBREAK; } if (ch0 == ' ') { return SPACE; } int n = text.length(); if (n >= 2) { char ch1 = text.charAt(1); char chLast = text.charAt(n - 1); switch (ch0) { case '/': if (ch1 == '*') { if (chLast != '/' || text.charAt(n - 2) != '*') { // Prevent any tricky regex that looks like a comment. throw new IllegalArgumentException(); } return COMMENT; } if (ch1 == '/') { return COMMENT; } if (n > 2) { // /= is 2 characters and / is 1 return REGEX; } break; case '-': case '+': if (ch1 == '.') { ch1 = n >= 3 ? text.charAt(2) : 0; } if (Character.isLetterOrDigit(ch1)) { return OTHER; } break; case '.': if (Character.isLetterOrDigit(ch1)) { return OTHER; } break; case '"': case '\'': return STRING; } } if (Character.isLetterOrDigit(ch0) || ch0 == '$' || ch0 == '_' // Starts with a unicode escape || (ch0 == '\\' && n >= 6 && 'u' == text.charAt(1))) { return OTHER; } return PUNCTUATION; } static boolean isNumber(String s) { int n = s.length(); if (n == 0) { return false; } char ch = s.charAt(0); if (ch == '+' || ch == '-') { if (n == 1) { return false; } ch = s.charAt(1); } return ch >= '0' && ch <= '9'; } static boolean isComment(String s) { if (s.length() < 2 || s.charAt(0) != '/') { return false; } switch (s.charAt(1)) { case '/': case '*': return true; default: return false; } } static boolean isLineComment(String s) { return s.startsWith("//"); } }
1,247
348
<reponame>chamberone/Leaflet.PixiOverlay {"nom":"Mailleroncourt-Charette","circ":"2ème circonscription","dpt":"Haute-Saône","inscrits":249,"abs":112,"votants":137,"blancs":3,"nuls":16,"exp":118,"res":[{"nuance":"REM","nom":"<NAME>","voix":77},{"nuance":"FN","nom":"M. <NAME>","voix":41}]}
117
764
<filename>erc20/0x31497f218c005fE3d5eE87e5a33e133A909A7a4b.json { "symbol": "DTA", "token_name": "<PASSWORD>", "address": "0x31497f218c005fE3d5eE87e5a33e133A909A7a4b", "total_supply": "21000000", "suggested_gas_limit_setting": "60000", "overview":{ "en": "The full name of the Digital Twin Agreement is the Digital Twin Agreement, which is a super oracle agreement, and DTA is the only token of its ecological value. DTA is currently initiated by a group of active and mysterious cypherpunk organizations, including cryptographers, financiers, mathematicians, machine intelligence experts, blockchain experts and other geeks in various fields. Its organizational form is not limited to The cognition and human boundary of a certain initiator forms the DAO organization to govern this great network protocol with group wisdom and code laws.", "zh": "数字孪生协议全称Digital Twin Agreement,是一种超级预言机协议,DTA是其生态唯一价值通证。DTA 目前由一群活跃而神秘的密码朋克组织发起,其中 包括密码学家、金融学家、数学家、机器智能专家、区块链专家等各领域极客组成,其组织 形式起初并不受限制于某个发起人的认知和人性边界,而是形成 DAO 组织,以群体智慧和 代码法律来治理这个伟大的网络协议。" }, "email": "<EMAIL>", "website": "http://dtaorg.top", "whitepaper": "http://dtaorg.top/doc/dta.pdf", "state": "NORMAL", "published_on": "2020-10-15", "initial_price":{ "USDT":"3.72 USDT" }, "links": { "media_publications": "https://www.bishijie.com/kuaixun/786454.html", "etherscan_link": "https://etherscan.io/address/0x31497f218c005fE3d5eE87e5a33e133A909A7a4b" } }
805
14,499
<filename>infer/tests/codetoanalyze/java/pulse/AutoGenerated.java<gh_stars>1000+ /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package codetoanalyze.java.infer; /* @generated */ public class AutoGenerated { void npeBad() { String s = null; int n = s.length(); } }
141
1,256
<gh_stars>1000+ /* char_width.cpp Fullwidth support */ /* Copyright © 2021 Far Group All rights reserved. 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. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ // BUGBUG #include "platform.headers.hpp" // Self: #include "char_width.hpp" // Internal: #include "console.hpp" #include "locale.hpp" // Platform: // Common: #include "common/algorithm.hpp" // External: //---------------------------------------------------------------------------- namespace { enum class full_width { off, on, automatic }; static auto s_FullWidthState = full_width::off; enum class codepoint_width: char { ambiguous, narrow, wide, }; [[nodiscard]] static auto quick_width(char_width::codepoint const Codepoint) noexcept { return in_closed_range(0x20u, Codepoint, 0x7Eu)? codepoint_width::narrow : codepoint_width::ambiguous; } struct unicode_range { char_width::codepoint LowerBound, UpperBound; codepoint_width Width; [[nodiscard]] bool operator<(char_width::codepoint const Codepoint) const noexcept { return UpperBound < Codepoint; } }; // These mappings are based on src\types\CodepointWidthDetector.cpp from Windows Terminal. // Generated on 10/25/2020 7:32:04 AM (UTC) from Unicode 13.0.0. // Note: unlike Terminal, we don't use any overrides since we don't control any drawing code // and have no other choice but to do as the Romans do. using cpw = codepoint_width; static constexpr unicode_range s_WideAndAmbiguousTable[] { { 0x0000A1, 0x0000A1, cpw::ambiguous }, { 0x0000A4, 0x0000A4, cpw::ambiguous }, { 0x0000A7, 0x0000A8, cpw::ambiguous }, { 0x0000AA, 0x0000AA, cpw::ambiguous }, { 0x0000AD, 0x0000AE, cpw::ambiguous }, { 0x0000B0, 0x0000B4, cpw::ambiguous }, { 0x0000B6, 0x0000BA, cpw::ambiguous }, { 0x0000BC, 0x0000BF, cpw::ambiguous }, { 0x0000C6, 0x0000C6, cpw::ambiguous }, { 0x0000D0, 0x0000D0, cpw::ambiguous }, { 0x0000D7, 0x0000D8, cpw::ambiguous }, { 0x0000DE, 0x0000E1, cpw::ambiguous }, { 0x0000E6, 0x0000E6, cpw::ambiguous }, { 0x0000E8, 0x0000EA, cpw::ambiguous }, { 0x0000EC, 0x0000ED, cpw::ambiguous }, { 0x0000F0, 0x0000F0, cpw::ambiguous }, { 0x0000F2, 0x0000F3, cpw::ambiguous }, { 0x0000F7, 0x0000FA, cpw::ambiguous }, { 0x0000FC, 0x0000FC, cpw::ambiguous }, { 0x0000FE, 0x0000FE, cpw::ambiguous }, { 0x000101, 0x000101, cpw::ambiguous }, { 0x000111, 0x000111, cpw::ambiguous }, { 0x000113, 0x000113, cpw::ambiguous }, { 0x00011B, 0x00011B, cpw::ambiguous }, { 0x000126, 0x000127, cpw::ambiguous }, { 0x00012B, 0x00012B, cpw::ambiguous }, { 0x000131, 0x000133, cpw::ambiguous }, { 0x000138, 0x000138, cpw::ambiguous }, { 0x00013F, 0x000142, cpw::ambiguous }, { 0x000144, 0x000144, cpw::ambiguous }, { 0x000148, 0x00014B, cpw::ambiguous }, { 0x00014D, 0x00014D, cpw::ambiguous }, { 0x000152, 0x000153, cpw::ambiguous }, { 0x000166, 0x000167, cpw::ambiguous }, { 0x00016B, 0x00016B, cpw::ambiguous }, { 0x0001CE, 0x0001CE, cpw::ambiguous }, { 0x0001D0, 0x0001D0, cpw::ambiguous }, { 0x0001D2, 0x0001D2, cpw::ambiguous }, { 0x0001D4, 0x0001D4, cpw::ambiguous }, { 0x0001D6, 0x0001D6, cpw::ambiguous }, { 0x0001D8, 0x0001D8, cpw::ambiguous }, { 0x0001DA, 0x0001DA, cpw::ambiguous }, { 0x0001DC, 0x0001DC, cpw::ambiguous }, { 0x000251, 0x000251, cpw::ambiguous }, { 0x000261, 0x000261, cpw::ambiguous }, { 0x0002C4, 0x0002C4, cpw::ambiguous }, { 0x0002C7, 0x0002C7, cpw::ambiguous }, { 0x0002C9, 0x0002CB, cpw::ambiguous }, { 0x0002CD, 0x0002CD, cpw::ambiguous }, { 0x0002D0, 0x0002D0, cpw::ambiguous }, { 0x0002D8, 0x0002DB, cpw::ambiguous }, { 0x0002DD, 0x0002DD, cpw::ambiguous }, { 0x0002DF, 0x0002DF, cpw::ambiguous }, { 0x000300, 0x00036F, cpw::ambiguous }, { 0x000391, 0x0003A1, cpw::ambiguous }, { 0x0003A3, 0x0003A9, cpw::ambiguous }, { 0x0003B1, 0x0003C1, cpw::ambiguous }, { 0x0003C3, 0x0003C9, cpw::ambiguous }, { 0x000401, 0x000401, cpw::ambiguous }, { 0x000410, 0x00044F, cpw::ambiguous }, { 0x000451, 0x000451, cpw::ambiguous }, { 0x001100, 0x00115F, cpw::wide }, { 0x002010, 0x002010, cpw::ambiguous }, { 0x002013, 0x002016, cpw::ambiguous }, { 0x002018, 0x002019, cpw::ambiguous }, { 0x00201C, 0x00201D, cpw::ambiguous }, { 0x002020, 0x002022, cpw::ambiguous }, { 0x002024, 0x002027, cpw::ambiguous }, { 0x002030, 0x002030, cpw::ambiguous }, { 0x002032, 0x002033, cpw::ambiguous }, { 0x002035, 0x002035, cpw::ambiguous }, { 0x00203B, 0x00203B, cpw::ambiguous }, { 0x00203E, 0x00203E, cpw::ambiguous }, { 0x002074, 0x002074, cpw::ambiguous }, { 0x00207F, 0x00207F, cpw::ambiguous }, { 0x002081, 0x002084, cpw::ambiguous }, { 0x0020AC, 0x0020AC, cpw::ambiguous }, { 0x002103, 0x002103, cpw::ambiguous }, { 0x002105, 0x002105, cpw::ambiguous }, { 0x002109, 0x002109, cpw::ambiguous }, { 0x002113, 0x002113, cpw::ambiguous }, { 0x002116, 0x002116, cpw::ambiguous }, { 0x002121, 0x002122, cpw::ambiguous }, { 0x002126, 0x002126, cpw::ambiguous }, { 0x00212B, 0x00212B, cpw::ambiguous }, { 0x002153, 0x002154, cpw::ambiguous }, { 0x00215B, 0x00215E, cpw::ambiguous }, { 0x002160, 0x00216B, cpw::ambiguous }, { 0x002170, 0x002179, cpw::ambiguous }, { 0x002189, 0x002189, cpw::ambiguous }, { 0x002190, 0x002199, cpw::ambiguous }, { 0x0021B8, 0x0021B9, cpw::ambiguous }, { 0x0021D2, 0x0021D2, cpw::ambiguous }, { 0x0021D4, 0x0021D4, cpw::ambiguous }, { 0x0021E7, 0x0021E7, cpw::ambiguous }, { 0x002200, 0x002200, cpw::ambiguous }, { 0x002202, 0x002203, cpw::ambiguous }, { 0x002207, 0x002208, cpw::ambiguous }, { 0x00220B, 0x00220B, cpw::ambiguous }, { 0x00220F, 0x00220F, cpw::ambiguous }, { 0x002211, 0x002211, cpw::ambiguous }, { 0x002215, 0x002215, cpw::ambiguous }, { 0x00221A, 0x00221A, cpw::ambiguous }, { 0x00221D, 0x002220, cpw::ambiguous }, { 0x002223, 0x002223, cpw::ambiguous }, { 0x002225, 0x002225, cpw::ambiguous }, { 0x002227, 0x00222C, cpw::ambiguous }, { 0x00222E, 0x00222E, cpw::ambiguous }, { 0x002234, 0x002237, cpw::ambiguous }, { 0x00223C, 0x00223D, cpw::ambiguous }, { 0x002248, 0x002248, cpw::ambiguous }, { 0x00224C, 0x00224C, cpw::ambiguous }, { 0x002252, 0x002252, cpw::ambiguous }, { 0x002260, 0x002261, cpw::ambiguous }, { 0x002264, 0x002267, cpw::ambiguous }, { 0x00226A, 0x00226B, cpw::ambiguous }, { 0x00226E, 0x00226F, cpw::ambiguous }, { 0x002282, 0x002283, cpw::ambiguous }, { 0x002286, 0x002287, cpw::ambiguous }, { 0x002295, 0x002295, cpw::ambiguous }, { 0x002299, 0x002299, cpw::ambiguous }, { 0x0022A5, 0x0022A5, cpw::ambiguous }, { 0x0022BF, 0x0022BF, cpw::ambiguous }, { 0x002312, 0x002312, cpw::ambiguous }, { 0x00231A, 0x00231B, cpw::wide }, { 0x002329, 0x00232A, cpw::wide }, { 0x0023E9, 0x0023EC, cpw::wide }, { 0x0023F0, 0x0023F0, cpw::wide }, { 0x0023F3, 0x0023F3, cpw::wide }, { 0x002460, 0x0024E9, cpw::ambiguous }, { 0x0024EB, 0x0024FF, cpw::ambiguous }, { 0x002500, 0x00259F, cpw::ambiguous }, { 0x0025A0, 0x0025A1, cpw::ambiguous }, { 0x0025A3, 0x0025A9, cpw::ambiguous }, { 0x0025B2, 0x0025B3, cpw::ambiguous }, { 0x0025B6, 0x0025B7, cpw::ambiguous }, { 0x0025BC, 0x0025BD, cpw::ambiguous }, { 0x0025C0, 0x0025C1, cpw::ambiguous }, { 0x0025C6, 0x0025C8, cpw::ambiguous }, { 0x0025CB, 0x0025CB, cpw::ambiguous }, { 0x0025CE, 0x0025D1, cpw::ambiguous }, { 0x0025E2, 0x0025E5, cpw::ambiguous }, { 0x0025EF, 0x0025EF, cpw::ambiguous }, { 0x0025FD, 0x0025FE, cpw::wide }, { 0x002605, 0x002606, cpw::ambiguous }, { 0x002609, 0x002609, cpw::ambiguous }, { 0x00260E, 0x00260F, cpw::ambiguous }, { 0x002614, 0x002615, cpw::wide }, { 0x00261C, 0x00261C, cpw::ambiguous }, { 0x00261E, 0x00261E, cpw::ambiguous }, { 0x002640, 0x002640, cpw::ambiguous }, { 0x002642, 0x002642, cpw::ambiguous }, { 0x002648, 0x002653, cpw::wide }, { 0x002660, 0x002661, cpw::ambiguous }, { 0x002663, 0x002665, cpw::ambiguous }, { 0x002667, 0x00266A, cpw::ambiguous }, { 0x00266C, 0x00266D, cpw::ambiguous }, { 0x00266F, 0x00266F, cpw::ambiguous }, { 0x00267F, 0x00267F, cpw::wide }, { 0x002693, 0x002693, cpw::wide }, { 0x00269E, 0x00269F, cpw::ambiguous }, { 0x0026A1, 0x0026A1, cpw::wide }, { 0x0026AA, 0x0026AB, cpw::wide }, { 0x0026BD, 0x0026BE, cpw::wide }, { 0x0026BF, 0x0026BF, cpw::ambiguous }, { 0x0026C4, 0x0026C5, cpw::wide }, { 0x0026C6, 0x0026CD, cpw::ambiguous }, { 0x0026CE, 0x0026CE, cpw::wide }, { 0x0026CF, 0x0026D3, cpw::ambiguous }, { 0x0026D4, 0x0026D4, cpw::wide }, { 0x0026D5, 0x0026E1, cpw::ambiguous }, { 0x0026E3, 0x0026E3, cpw::ambiguous }, { 0x0026E8, 0x0026E9, cpw::ambiguous }, { 0x0026EA, 0x0026EA, cpw::wide }, { 0x0026EB, 0x0026F1, cpw::ambiguous }, { 0x0026F2, 0x0026F3, cpw::wide }, { 0x0026F4, 0x0026F4, cpw::ambiguous }, { 0x0026F5, 0x0026F5, cpw::wide }, { 0x0026F6, 0x0026F9, cpw::ambiguous }, { 0x0026FA, 0x0026FA, cpw::wide }, { 0x0026FB, 0x0026FC, cpw::ambiguous }, { 0x0026FD, 0x0026FD, cpw::wide }, { 0x0026FE, 0x0026FF, cpw::ambiguous }, { 0x002705, 0x002705, cpw::wide }, { 0x00270A, 0x00270B, cpw::wide }, { 0x002728, 0x002728, cpw::wide }, { 0x00273D, 0x00273D, cpw::ambiguous }, { 0x00274C, 0x00274C, cpw::wide }, { 0x00274E, 0x00274E, cpw::wide }, { 0x002753, 0x002755, cpw::wide }, { 0x002757, 0x002757, cpw::wide }, { 0x002776, 0x00277F, cpw::ambiguous }, { 0x002795, 0x002797, cpw::wide }, { 0x0027B0, 0x0027B0, cpw::wide }, { 0x0027BF, 0x0027BF, cpw::wide }, { 0x002B1B, 0x002B1C, cpw::wide }, { 0x002B50, 0x002B50, cpw::wide }, { 0x002B55, 0x002B55, cpw::wide }, { 0x002B56, 0x002B59, cpw::ambiguous }, { 0x002E80, 0x002E99, cpw::wide }, { 0x002E9B, 0x002EF3, cpw::wide }, { 0x002F00, 0x002FD5, cpw::wide }, { 0x002FF0, 0x002FFB, cpw::wide }, { 0x003000, 0x00303E, cpw::wide }, { 0x003041, 0x003096, cpw::wide }, { 0x003099, 0x0030FF, cpw::wide }, { 0x003105, 0x00312F, cpw::wide }, { 0x003131, 0x00318E, cpw::wide }, { 0x003190, 0x0031E3, cpw::wide }, { 0x0031F0, 0x00321E, cpw::wide }, { 0x003220, 0x003247, cpw::wide }, { 0x003248, 0x00324F, cpw::ambiguous }, { 0x003250, 0x004DBF, cpw::wide }, { 0x004DC0, 0x004DFF, cpw::ambiguous }, { 0x004E00, 0x00A48C, cpw::wide }, { 0x00A490, 0x00A4C6, cpw::wide }, { 0x00A960, 0x00A97C, cpw::wide }, { 0x00AC00, 0x00D7A3, cpw::wide }, { 0x00E000, 0x00F8FF, cpw::ambiguous }, { 0x00F900, 0x00FAFF, cpw::wide }, { 0x00FE00, 0x00FE0F, cpw::ambiguous }, { 0x00FE10, 0x00FE19, cpw::wide }, { 0x00FE20, 0x00FE2F, cpw::ambiguous }, { 0x00FE30, 0x00FE52, cpw::wide }, { 0x00FE54, 0x00FE66, cpw::wide }, { 0x00FE68, 0x00FE6B, cpw::wide }, { 0x00FF01, 0x00FF60, cpw::wide }, { 0x00FFE0, 0x00FFE6, cpw::wide }, { 0x00FFFD, 0x00FFFD, cpw::ambiguous }, { 0x016FE0, 0x016FE4, cpw::wide }, { 0x016FF0, 0x016FF1, cpw::wide }, { 0x017000, 0x0187F7, cpw::wide }, { 0x018800, 0x018CD5, cpw::wide }, { 0x018D00, 0x018D08, cpw::wide }, { 0x01B000, 0x01B11E, cpw::wide }, { 0x01B150, 0x01B152, cpw::wide }, { 0x01B164, 0x01B167, cpw::wide }, { 0x01B170, 0x01B2FB, cpw::wide }, { 0x01F004, 0x01F004, cpw::wide }, { 0x01F0CF, 0x01F0CF, cpw::wide }, { 0x01F100, 0x01F10A, cpw::ambiguous }, { 0x01F110, 0x01F12D, cpw::ambiguous }, { 0x01F130, 0x01F169, cpw::ambiguous }, { 0x01F170, 0x01F18D, cpw::ambiguous }, { 0x01F18E, 0x01F18E, cpw::wide }, { 0x01F18F, 0x01F190, cpw::ambiguous }, { 0x01F191, 0x01F19A, cpw::wide }, { 0x01F19B, 0x01F1AC, cpw::ambiguous }, { 0x01F1E6, 0x01F202, cpw::wide }, { 0x01F210, 0x01F23B, cpw::wide }, { 0x01F240, 0x01F248, cpw::wide }, { 0x01F250, 0x01F251, cpw::wide }, { 0x01F260, 0x01F265, cpw::wide }, { 0x01F300, 0x01F320, cpw::wide }, { 0x01F32D, 0x01F335, cpw::wide }, { 0x01F337, 0x01F37C, cpw::wide }, { 0x01F37E, 0x01F393, cpw::wide }, { 0x01F3A0, 0x01F3CA, cpw::wide }, { 0x01F3CF, 0x01F3D3, cpw::wide }, { 0x01F3E0, 0x01F3F0, cpw::wide }, { 0x01F3F4, 0x01F3F4, cpw::wide }, { 0x01F3F8, 0x01F43E, cpw::wide }, { 0x01F440, 0x01F440, cpw::wide }, { 0x01F442, 0x01F4FC, cpw::wide }, { 0x01F4FF, 0x01F53D, cpw::wide }, { 0x01F54B, 0x01F54E, cpw::wide }, { 0x01F550, 0x01F567, cpw::wide }, { 0x01F57A, 0x01F57A, cpw::wide }, { 0x01F595, 0x01F596, cpw::wide }, { 0x01F5A4, 0x01F5A4, cpw::wide }, { 0x01F5FB, 0x01F64F, cpw::wide }, { 0x01F680, 0x01F6C5, cpw::wide }, { 0x01F6CC, 0x01F6CC, cpw::wide }, { 0x01F6D0, 0x01F6D2, cpw::wide }, { 0x01F6D5, 0x01F6D7, cpw::wide }, { 0x01F6EB, 0x01F6EC, cpw::wide }, { 0x01F6F4, 0x01F6FC, cpw::wide }, { 0x01F7E0, 0x01F7EB, cpw::wide }, { 0x01F90C, 0x01F93A, cpw::wide }, { 0x01F93C, 0x01F945, cpw::wide }, { 0x01F947, 0x01F978, cpw::wide }, { 0x01F97A, 0x01F9CB, cpw::wide }, { 0x01F9CD, 0x01F9FF, cpw::wide }, { 0x01FA70, 0x01FA74, cpw::wide }, { 0x01FA78, 0x01FA7A, cpw::wide }, { 0x01FA80, 0x01FA86, cpw::wide }, { 0x01FA90, 0x01FAA8, cpw::wide }, { 0x01FAB0, 0x01FAB6, cpw::wide }, { 0x01FAC0, 0x01FAC2, cpw::wide }, { 0x01FAD0, 0x01FAD6, cpw::wide }, { 0x020000, 0x02FFFD, cpw::wide }, { 0x030000, 0x03FFFD, cpw::wide }, { 0x0E0100, 0x0E01EF, cpw::ambiguous }, { 0x0F0000, 0x0FFFFD, cpw::ambiguous }, { 0x100000, 0x10FFFD, cpw::ambiguous }, }; [[nodiscard]] static auto lookup_width(char_width::codepoint const Codepoint) { if ( const auto Iterator = std::lower_bound(ALL_CONST_RANGE(s_WideAndAmbiguousTable), Codepoint); Iterator != std::end(s_WideAndAmbiguousTable) && in_closed_range(Iterator->LowerBound, Codepoint, Iterator->UpperBound) ) { return Iterator->Width; } return codepoint_width::narrow; } [[nodiscard]] static auto is_bmp(char_width::codepoint const Codepoint) { return Codepoint <= std::numeric_limits<wchar_t>::max(); } [[nodiscard]] static auto device_width(char_width::codepoint const Codepoint, bool const ClearCacheOnly = false) { static_assert(sizeof(wchar_t) == 2, "4 GB for a cache is too much, rewrite it."); static codepoint_width FastCache[std::numeric_limits<wchar_t>::max()]; static std::unordered_map<char_width::codepoint, codepoint_width> SlowCache; if (ClearCacheOnly) { std::fill(ALL_RANGE(FastCache), codepoint_width::ambiguous); SlowCache.clear(); (void)console.IsWidePreciseExpensive(0, true); return codepoint_width::ambiguous; } const auto IsBMP = is_bmp(Codepoint); if (IsBMP) { if (FastCache[Codepoint] != codepoint_width::ambiguous) return FastCache[Codepoint]; } else { if (const auto Iterator = SlowCache.find(Codepoint); Iterator != SlowCache.cend()) return Iterator->second; } const auto Result = console.IsWidePreciseExpensive(Codepoint)? codepoint_width::wide : codepoint_width::narrow; (IsBMP? FastCache[Codepoint] : SlowCache[Codepoint]) = Result; return Result; } [[nodiscard]] static auto is_fullwidth_needed() { return console.IsVtSupported() || locale.is_cjk(); } [[nodiscard]] static auto get_width(char_width::codepoint const RawCodepoint) { const auto Codepoint = RawCodepoint > std::numeric_limits<wchar_t>::max()? RawCodepoint : ReplaceControlCharacter(static_cast<wchar_t>(RawCodepoint)); if (const auto Width = quick_width(Codepoint); Width != codepoint_width::ambiguous) return Width; if (const auto Width = lookup_width(Codepoint); Width != codepoint_width::ambiguous) return Width; if (const auto Width = device_width(Codepoint); Width != codepoint_width::ambiguous) return Width; return codepoint_width::wide; } } namespace char_width { [[nodiscard]] bool is_wide(unsigned int const Codepoint) { switch (s_FullWidthState) { default: case full_width::off: return !is_bmp(Codepoint); case full_width::automatic: if (!is_fullwidth_needed()) return false; [[fallthrough]]; case full_width::on: return get_width(Codepoint) == codepoint_width::wide; } } void enable(int const Value) { switch (Value) { case BSTATE_UNCHECKED: invalidate(); s_FullWidthState = full_width::off; break; case BSTATE_CHECKED: s_FullWidthState = full_width::on; break; case BSTATE_3STATE: s_FullWidthState = full_width::automatic; break; } } [[nodiscard]] bool is_enabled() { return s_FullWidthState != full_width::off; } void invalidate() { if (is_enabled()) (void)device_width(0, true); } }
9,136
467
<filename>app/src/main/java/com/yoyiyi/soleil/module/region/RegionTypeActivity.java package com.yoyiyi.soleil.module.region; import android.content.Context; import android.content.Intent; import android.os.Bundle; import com.annimon.stream.Stream; import com.yoyiyi.soleil.R; import com.yoyiyi.soleil.bean.region.RegionTagType; import com.yoyiyi.soleil.constant.Constants; import com.yoyiyi.soleil.mvp.contract.region.AllRegionRankPositionContract; import com.yoyiyi.soleil.mvp.presenter.region.AllRegionRankPositionPresenter; import javax.annotation.Nullable; /** * @author zzq 作者 E-mail: <EMAIL> * @date 创建时间:2017/5/30 18:11 * 描述:分区type界面 */ public class RegionTypeActivity extends BaseRegionActivity<AllRegionRankPositionPresenter, Nullable> implements AllRegionRankPositionContract.View { private RegionTagType mRegionType; public String mTitle; @Override protected int getLayoutId() { return R.layout.activity_region_type; } public static void startActivity(Context context, RegionTagType type) { Bundle bundle = new Bundle(); Intent intent = new Intent(context, RegionTypeActivity.class); bundle.putParcelable(Constants.EXTRA_PARCELABLE, type); intent.putExtra(Constants.EXTRA_BUNDLE, bundle); context.startActivity(intent); } @Override protected void initVariables() { Intent intent = getIntent(); if (intent != null) { Bundle bundle = intent.getBundleExtra(Constants.EXTRA_BUNDLE); mRegionType = bundle.getParcelable(Constants.EXTRA_PARCELABLE); } mTitle = mRegionType.name; mTitles.add("推荐"); //推荐 mFragments.add(RegionTypeRecommendFragment.newInstance(mRegionType.tid)); Stream.of(mRegionType.children) .forEach(childrenBean -> { mTitles.add(childrenBean.name); //其他标签页面 mFragments.add(RegionTypeFragment.newInstance(childrenBean.tid)); }); } @Override protected void initWidget() { super.initWidget(); mViewPager.setOffscreenPageLimit(mRegionType.children.size() + 1); mViewPager.setAdapter(new BaseRegionTypeAdapte(getSupportFragmentManager(), mTitles, mFragments)); mSlidingTabLayout.setViewPager(mViewPager); mViewPager.setCurrentItem(0); } @Override protected void initToolbar() { super.initToolbar(); setTitle(mTitle); } @Override protected void loadData() { //设置推荐Fragment entrance 监听 mPresenter.getEventPostion(); } @Override public void showEventPostion(int postion) { //设置位置 viewpager mViewPager.setCurrentItem(postion + 1); } @Override protected void initInject() { getActivityComponent().inject(this); } }
1,247
1,056
<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.websvc.rest.wizard; import java.awt.event.KeyAdapter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Set; import javax.lang.model.element.TypeElement; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.JTextComponent; import org.netbeans.api.java.source.ClassIndex.NameKind; import org.netbeans.api.java.source.ClassIndex.SearchScope; import org.netbeans.api.java.source.ClasspathInfo; import org.netbeans.api.java.source.ElementHandle; import org.netbeans.api.java.source.ui.TypeElementFinder; import org.openide.util.Utilities; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectUtils; import org.netbeans.api.project.SourceGroup; import org.netbeans.modules.websvc.rest.codegen.Constants; import org.netbeans.modules.websvc.rest.codegen.Constants.MimeType; import org.netbeans.modules.websvc.rest.codegen.model.GenericResourceBean; import org.netbeans.modules.websvc.rest.support.SourceGroupSupport; import org.netbeans.spi.java.project.support.ui.PackageView; import org.netbeans.spi.project.ui.templates.support.Templates; import org.openide.WizardDescriptor; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.util.Exceptions; /** * * @author <NAME> */ public class SingletonSetupPanelVisual extends javax.swing.JPanel implements AbstractPanel.Settings, SourcePanel { private Project project; private List<ChangeListener> listeners; private boolean resourceClassNameOveridden; /** Creates new form CrudSetupPanel */ public SingletonSetupPanelVisual(String name) { setName(name); this.listeners = new ArrayList<ChangeListener>(); initComponents(); packageComboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { fireChange(); } }); medaTypeComboBox.setModel(new DefaultComboBoxModel(GenericResourceBean.getSupportedMimeTypes())); ((JTextComponent) packageComboBox.getEditor().getEditorComponent()).getDocument().addDocumentListener( new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { fireChange(); } @Override public void removeUpdate(DocumentEvent e) { fireChange(); } @Override public void changedUpdate(DocumentEvent e) { fireChange(); } }); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { classLabel = new javax.swing.JLabel(); classTextField = new javax.swing.JTextField(); uriLabel = new javax.swing.JLabel(); uriTextField = new javax.swing.JTextField(); projectLabel = new javax.swing.JLabel(); projectTextField = new javax.swing.JTextField(); locationLabel = new javax.swing.JLabel(); locationComboBox = new javax.swing.JComboBox(); packageLabel = new javax.swing.JLabel(); packageComboBox = new javax.swing.JComboBox(); medaTypeComboBox = new javax.swing.JComboBox(); mediaTypeLabel = new javax.swing.JLabel(); contentClassLabel = new javax.swing.JLabel(); selectClassButton = new javax.swing.JButton(); contentClassTextField = new javax.swing.JTextField(); jSeparator2 = new javax.swing.JSeparator(); setName(""); // NOI18N setPreferredSize(new java.awt.Dimension(450, 193)); classLabel.setLabelFor(classTextField); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/websvc/rest/wizard/Bundle"); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(classLabel, bundle.getString("MSG_ClassName")); // NOI18N classTextField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { classTextFieldKeyReleased(evt); } }); uriLabel.setLabelFor(uriTextField); org.openide.awt.Mnemonics.setLocalizedText(uriLabel, org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_UriTemplate")); // NOI18N uriTextField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { uriTextFieldKeyReleased(evt); } }); projectLabel.setLabelFor(projectTextField); org.openide.awt.Mnemonics.setLocalizedText(projectLabel, org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_Project")); // NOI18N projectTextField.setEditable(false); locationLabel.setLabelFor(locationComboBox); org.openide.awt.Mnemonics.setLocalizedText(locationLabel, org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_SrcLocation")); // NOI18N locationComboBox.setMinimumSize(new java.awt.Dimension(4, 20)); locationComboBox.setPreferredSize(new java.awt.Dimension(130, 25)); locationComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { locationComboBoxActionPerformed(evt); } }); packageLabel.setLabelFor(packageComboBox); org.openide.awt.Mnemonics.setLocalizedText(packageLabel, org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_Package")); // NOI18N packageComboBox.setEditable(true); packageComboBox.setMinimumSize(new java.awt.Dimension(4, 20)); packageComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { packageChanged(evt); } }); packageComboBox.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { packageComboBoxKeyReleased(evt); } }); medaTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); medaTypeComboBox.setMinimumSize(new java.awt.Dimension(4, 20)); mediaTypeLabel.setLabelFor(medaTypeComboBox); org.openide.awt.Mnemonics.setLocalizedText(mediaTypeLabel, org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_MimeType")); // NOI18N contentClassLabel.setLabelFor(contentClassTextField); org.openide.awt.Mnemonics.setLocalizedText(contentClassLabel, org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_RepresentationClass")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(selectClassButton, org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_Select")); // NOI18N selectClassButton.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); selectClassButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { selectClassButtonActionPerformed(evt); } }); selectClassButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { mouseClickHandler(evt); } }); contentClassTextField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { representationClassChanged(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(projectLabel) .addComponent(contentClassLabel) .addComponent(classLabel) .addComponent(uriLabel) .addComponent(mediaTypeLabel) .addComponent(packageLabel) .addComponent(locationLabel)) .addGap(7, 7, 7) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(classTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE) .addComponent(medaTypeComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, 303, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(contentClassTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(selectClassButton)) .addComponent(uriTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE) .addComponent(locationComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, 303, Short.MAX_VALUE) .addComponent(packageComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, 303, Short.MAX_VALUE) .addComponent(projectTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)) .addContainerGap()) .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 454, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(projectLabel) .addComponent(projectTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(locationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(locationLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(packageComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(packageLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(uriLabel) .addComponent(uriTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(classLabel) .addComponent(classTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(mediaTypeLabel) .addComponent(medaTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(contentClassTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(contentClassLabel) .addComponent(selectClassButton)))) ); classLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "ClassName")); // NOI18N classLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_ClassName")); // NOI18N classTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "ClassName")); // NOI18N classTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_ClassName")); // NOI18N uriLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "UirTemplate")); // NOI18N uriLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_Uri")); // NOI18N uriTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "UriTemplate")); // NOI18N uriTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_Uri")); // NOI18N projectLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "Project")); // NOI18N projectLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_Project")); // NOI18N projectTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "Project")); // NOI18N projectTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_Project")); // NOI18N locationLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "Location")); // NOI18N locationLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_Location")); // NOI18N locationComboBox.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "Location")); // NOI18N locationComboBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_Location")); // NOI18N packageLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "ResourcePackage")); // NOI18N packageLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_ResourcePackage")); // NOI18N packageComboBox.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "ResourcePackage")); // NOI18N packageComboBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_ResourcePackage")); // NOI18N medaTypeComboBox.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "MimeType")); // NOI18N medaTypeComboBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_MimeType")); // NOI18N mediaTypeLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "MimeType")); // NOI18N mediaTypeLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_MimeType")); // NOI18N contentClassLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "RepresentationClass")); // NOI18N contentClassLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_RepresentationClass")); // NOI18N selectClassButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "SelectRepresentationClass")); // NOI18N selectClassButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_SelectRepresenationClass")); // NOI18N contentClassTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "RepresentationClass")); // NOI18N contentClassTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "DESC_RepresentationClass")); // NOI18N getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_Specify_Resource_Class")); // NOI18N getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SingletonSetupPanelVisual.class, "LBL_Specify_Resource_Class")); // NOI18N }// </editor-fold>//GEN-END:initComponents private void containerTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_containerTextFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_containerTextFieldActionPerformed private void representationClassChanged(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_representationClassChanged fireChange(); }//GEN-LAST:event_representationClassChanged private void selectClassButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectClassButtonActionPerformed fireChange(); }//GEN-LAST:event_selectClassButtonActionPerformed private void mouseClickHandler(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickHandler SwingUtilities.invokeLater(new Runnable() { public void run() { final ElementHandle<TypeElement> handle = TypeElementFinder.find(Util.getClasspathInfo(project), new TypeElementFinder.Customizer() { public Set<ElementHandle<TypeElement>> query(ClasspathInfo classpathInfo, String textForQuery, NameKind nameKind, Set<SearchScope> searchScopes) { return classpathInfo.getClassIndex().getDeclaredTypes(textForQuery, nameKind, searchScopes); } public boolean accept(ElementHandle<TypeElement> typeHandle) { return true; } }); if (handle != null) { contentClassTextField.setText(handle.getQualifiedName()); fireChange(); } } }); }//GEN-LAST:event_mouseClickHandler private void locationComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_locationComboBoxActionPerformed locationChanged(); }//GEN-LAST:event_locationComboBoxActionPerformed private void classTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_classTextFieldKeyReleased resourceClassNameOveridden = true; fireChange(); }//GEN-LAST:event_classTextFieldKeyReleased private void packageComboBoxKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_packageComboBoxKeyReleased fireChange(); }//GEN-LAST:event_packageComboBoxKeyReleased private void uriTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_uriTextFieldKeyReleased // TODO add your handling code here: String uri = uriTextField.getText(); if (!resourceClassNameOveridden) { classTextField.setText(findFreeClassName(uri)); } fireChange(); }//GEN-LAST:event_uriTextFieldKeyReleased private void packageChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_packageChanged fireChange(); }//GEN-LAST:event_packageChanged // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel classLabel; private javax.swing.JTextField classTextField; private javax.swing.JLabel contentClassLabel; private javax.swing.JTextField contentClassTextField; private javax.swing.JSeparator jSeparator2; private javax.swing.JComboBox locationComboBox; private javax.swing.JLabel locationLabel; private javax.swing.JComboBox medaTypeComboBox; private javax.swing.JLabel mediaTypeLabel; private javax.swing.JComboBox packageComboBox; private javax.swing.JLabel packageLabel; private javax.swing.JLabel projectLabel; private javax.swing.JTextField projectTextField; private javax.swing.JButton selectClassButton; private javax.swing.JLabel uriLabel; private javax.swing.JTextField uriTextField; // End of variables declaration//GEN-END:variables public void addChangeListener(ChangeListener listener) { listeners.add(listener); } public void fireChange() { ChangeEvent event = new ChangeEvent(this); for (ChangeListener listener : listeners) { listener.stateChanged(event); } } public boolean valid(WizardDescriptor wizard) { AbstractPanel.clearErrorMessage(wizard); String resourceUri = uriTextField.getText().trim(); String packageName = getPackage(); String className = classTextField.getText().trim(); SourceGroup[] groups = SourceGroupSupport.getJavaSourceGroups(project); if (groups == null || groups.length < 1) { AbstractPanel.setErrorMessage(wizard, "MSG_NoJavaSourceRoots"); return false; } else if (className.length() == 0 || !Utilities.isJavaIdentifier(className)) { AbstractPanel.setErrorMessage(wizard, "MSG_InvalidResourceClassName"); return false; } else if (resourceUri.length() == 0) { AbstractPanel.setErrorMessage(wizard, "MSG_EmptyUriTemplate"); return false; } else if (!Util.isValidPackageName(packageName)) { AbstractPanel.setErrorMessage(wizard, "MSG_InvalidPackageName"); return false; } else if (getResourceClassFile() != null) { AbstractPanel.setErrorMessage(wizard, "MSG_ExistingClass"); return false; } else if (!Util.isValidUri(resourceUri)) { AbstractPanel.setErrorMessage(wizard, "MSG_IncorrectUriTemplate"); return false; } return true; } public SourceGroup getLocationValue() { return (SourceGroup) locationComboBox.getSelectedItem(); } public String getPackage() { return ((JTextComponent) packageComboBox.getEditor().getEditorComponent()).getText(); } private void locationChanged() { updateSourceGroupPackages(); fireChange(); } private String getResourceClassName() { return classTextField.getText(); } private FileObject getResourceClassFile() { FileObject folder = null; try { folder = SourceGroupSupport.getFolderForPackage(getLocationValue(), getPackage()); if (folder != null) { return folder.getFileObject(getResourceClassName(), Constants.JAVA_EXT); } } catch (IOException ex) { //OK just return null } return null; } public static final String DEFAULT_URI = "generic"; public void read(WizardDescriptor settings) { project = Templates.getProject(settings); FileObject targetFolder = Templates.getTargetFolder(settings); projectTextField.setText(ProjectUtils.getInformation(project).getDisplayName()); SourceGroup[] sourceGroups = SourceGroupSupport.getJavaSourceGroups(project); SourceGroupUISupport.connect(locationComboBox, sourceGroups); packageComboBox.setRenderer(PackageView.listRenderer()); updateSourceGroupPackages(); // set default source group and package cf. targetFolder if (targetFolder != null) { SourceGroup targetSourceGroup = SourceGroupSupport.findSourceGroupForFile(sourceGroups, targetFolder); // if (targetSourceGroup == null) { // targetSourceGroup = getLocationValue(); // targetFolder = targetSourceGroup.getRootFolder(); // } if (targetSourceGroup != null) { locationComboBox.setSelectedItem(targetSourceGroup); String targetPackage = SourceGroupSupport.getPackageForFolder(targetSourceGroup, targetFolder); if (targetPackage != null) { ((JTextComponent) packageComboBox.getEditor().getEditorComponent()).setText(targetPackage); } } } else { String targetPackage = (String) settings.getProperty(WizardProperties.TARGET_PACKAGE); if (targetPackage != null) { ((JTextComponent) packageComboBox.getEditor().getEditorComponent()).setText(targetPackage); } } String value = (String) settings.getProperty(WizardProperties.RESOURCE_URI); if (value == null || value.trim().length() == 0) { uriTextField.setText(DEFAULT_URI); classTextField.setText(findFreeClassName(DEFAULT_URI)); //uriTextField.setText("/" + Util.pluralize(Util.lowerFirstChar(getResourceName())) + "/{name}"); //NOI18N contentClassTextField.setText(GenericResourceBean.getDefaultRepresetationClass((MimeType) medaTypeComboBox.getSelectedItem())); } else { uriTextField.setText(value); classTextField.setText((String) settings.getProperty(WizardProperties.RESOURCE_CLASS)); medaTypeComboBox.setSelectedItem(((MimeType[]) settings.getProperty(WizardProperties.MIME_TYPES))[0]); String[] types = (String[]) settings.getProperty(WizardProperties.REPRESENTATION_TYPES); if (types != null && types.length > 0) { contentClassTextField.setText(types[0]); } } } public void store(WizardDescriptor settings) { settings.putProperty(WizardProperties.RESOURCE_PACKAGE, getPackage()); settings.putProperty(WizardProperties.RESOURCE_CLASS, classTextField.getText()); settings.putProperty(WizardProperties.RESOURCE_URI, uriTextField.getText()); settings.putProperty(WizardProperties.MIME_TYPES, new MimeType[]{(MimeType) medaTypeComboBox.getSelectedItem()}); settings.putProperty(WizardProperties.REPRESENTATION_TYPES, new String[]{contentClassTextField.getText()}); settings.putProperty(WizardProperties.SOURCE_GROUP, getLocationValue()); try { FileObject packageFO = SourceGroupSupport.getFolderForPackage(getLocationValue(), getPackage(), false); if (packageFO != null) { Templates.setTargetFolder(settings, packageFO); } else { Templates.setTargetFolder(settings, null); settings.putProperty(WizardProperties.TARGET_PACKAGE, getPackage()); } } catch (IOException ex) { Exceptions.printStackTrace(ex); } } @Override public SourceGroup getSourceGroup() { return (SourceGroup) locationComboBox.getSelectedItem(); } @Override public String getPackageName() { return ((JTextComponent) packageComboBox.getEditor().getEditorComponent()).getText(); } public double getRenderedHeight(){ return selectClassButton.getLocation().getY()+ selectClassButton.getSize().getHeight()+getGap(); } private double getGap(){ double gap = contentClassTextField.getLocation().getY(); gap = gap - (medaTypeComboBox.getLocation().getY() +medaTypeComboBox.getHeight()); return gap; } private void updateSourceGroupPackages() { SourceGroup sourceGroup = getSourceGroup(); if (sourceGroup != null) { ComboBoxModel model = PackageView.createListView(sourceGroup); if (model.getSelectedItem() != null && model.getSelectedItem().toString().startsWith("META-INF") && model.getSize() > 1) { // NOI18N model.setSelectedItem(model.getElementAt(1)); } packageComboBox.setModel(model); } } private String findFreeClassName(String uri) { try { FileObject folder = SourceGroupSupport.getFolderForPackage(getLocationValue(), getPackage()); if (folder != null) { return FileUtil.findFreeFileName(folder, Util.deriveResourceClassName(uri), Constants.JAVA_EXT); } } catch (IOException ex) { //OK just return null Exceptions.printStackTrace(ex); } return null; } }
12,663
4,069
// // Use this file to import your target's public headers that you would like to expose to Swift. // //model #import "YALTabBarItem.h" //controller #import "YALFoldingTabBarController.h" //helpers #import "YALAnimatingTabBarConstants.h"
79
480
/* * Copyright [2013-2021], Alibaba Group Holding Limited * * 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.alibaba.polardbx.common.constants; public class ExecutorAttribute { public static final String DUAL_GROUP = "DUAL_GROUP"; public static final String DEFAULT_DB = "DEFAULT_DB"; public static final String SHADOW_DB = "SHADOW_DB"; public static final String INFORMATION_SCHEMA = "INFORMATION_SCHEMA"; public static final String PERFORMANCE_SCHEMA = "PERFORMANCE_SCHEMA"; public static final String QUERY_SHADOW_DB = "QUERY_SHADOW_DB"; public static final String QUERY_INFORMATION_SCHEMA = "QUERY_INFORMATION_SCHEMA"; public static final String QUERY_PERFORMANCE_SCHEMA = "QUERY_PERFORMANCE_SCHEMA"; }
447
1,738
/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include "StdAfx.h" #include <AzTest/AzTest.h> #include <AzCore/Component/ComponentApplication.h> #include <AzCore/UnitTest/TestTypes.h> #include <Lib/Tests/IEditorMock.h> #include <Mocks/ISystemMock.h> #include <Mocks/I3DEngineMock.h> #include <Mocks/IConsoleMock.h> #include <Cry3DEngine/Cry3DEngineBase.h> #include <Cry3DEngine/cvars.h> #include <CryCommon/StatObjBus.h> #include "VegetationMap.h" #include <VegetationObject.h> #include <AzFramework/IO/LocalFileIO.h> #include <IMissingAssetResolver.h> #ifdef LY_TERRAIN_EDITOR #include <Terrain/Heightmap.h> class CHeightmapMock : public IHeightmap { public: MOCK_METHOD6(UpdateEngineTerrain, void(int x1, int y1, int width, int height, bool bElevation, bool bInfoBits)); MOCK_METHOD4(RecordAzUndoBatchTerrainModify, void(AZ::u32 x, AZ::u32 y, AZ::u32 width, AZ::u32 height)); MOCK_CONST_METHOD0(GetOceanLevel, float()); MOCK_METHOD0(GetUseTerrain, bool()); }; #endif //#ifdef LY_TERRAIN_EDITOR namespace UnitTest { struct ErrorReportMock : IErrorReport { MOCK_METHOD0(Clear, void()); MOCK_METHOD0(Display, void()); MOCK_METHOD1(GetError, CErrorRecord& (int)); MOCK_CONST_METHOD0(GetErrorCount, int()); MOCK_CONST_METHOD0(IsEmpty, bool()); MOCK_CONST_METHOD0(IsImmediateMode, bool()); MOCK_METHOD1(Report, void(SValidatorRecord&)); MOCK_METHOD1(ReportError, void(CErrorRecord&)); MOCK_METHOD1(SetCurrentFile, void(const QString&)); MOCK_METHOD1(SetCurrentValidatorItem, void(CBaseLibraryItem*)); MOCK_METHOD1(SetCurrentValidatorObject, void(CBaseObject*)); MOCK_METHOD1(SetImmediateMode, void(bool)); MOCK_METHOD1(SetShowErrors, void(bool)); }; struct MissingAssetResolverMock : IMissingAssetResolver { MOCK_METHOD2(AcceptRequest, void (uint32, const char*)); MOCK_METHOD4(AddResolveRequest, uint32 (const char*, const TMissingAssetResolveCallback&, char, bool)); MOCK_METHOD2(CancelRequest, void (const TMissingAssetResolveCallback&, uint32)); MOCK_METHOD1(CancelRequest, void (uint32)); MOCK_CONST_METHOD1(GetAssetSearcherById, IAssetSearcher* (int)); MOCK_METHOD0(GetReport, CMissingAssetReport* ()); MOCK_METHOD1(OnEditorNotifyEvent, void (EEditorNotifyEvent)); MOCK_METHOD0(PumpEvents, void ()); MOCK_METHOD0(Shutdown, void ()); MOCK_METHOD0(StartResolver, void ()); MOCK_METHOD0(StopResolver, void ()); }; class VegetationMapTestFixture : public UnitTest::AllocatorsTestFixture , private StatInstGroupEventBus::Handler { public: void SetUp() override { // capture prior state. m_savedState.m_Env = gEnv; UnitTest::AllocatorsTestFixture::SetUp(); // LegacyAllocator is a lazily-created allocator, so it will always exist, but we still manually shut it down and // start it up again between tests so we can have consistent behavior. if (!AZ::AllocatorInstance<AZ::LegacyAllocator>::GetAllocator().IsReady()) { AZ::AllocatorInstance<AZ::LegacyAllocator>::Create(); } m_data = AZStd::make_unique<DataMembers>(); // override state with our needed test mocks gEnv = &(m_data->m_mockGEnv); m_data->m_mockGEnv.pSystem = &(m_data->m_mockSystem); m_data->m_mockGEnv.pConsole = &(m_data->m_mockConsole); SetIEditor(&(m_data->m_mockEditor)); ON_CALL(m_data->m_mockEditor, GetSystem()).WillByDefault(::testing::Return(&(m_data->m_mockSystem))); ON_CALL(m_data->m_mockEditor, GetRenderer()).WillByDefault(::testing::Return(nullptr)); ON_CALL(m_data->m_mockEditor, Get3DEngine()).WillByDefault(::testing::Return(&(m_data->m_mock3DEngine))); ON_CALL(m_data->m_mockEditor, GetErrorReport()).WillByDefault(::testing::Return(&m_data->m_mockErrorReport)); ON_CALL(m_data->m_mockEditor, GetMissingAssetResolver()).WillByDefault(::testing::Return(&(m_data->m_missingAssetResolver))); ON_CALL(m_data->m_mockSystem, GetI3DEngine()).WillByDefault(::testing::Return(&(m_data->m_mock3DEngine))); ON_CALL(m_data->m_mock3DEngine, GetWaterLevel()).WillByDefault(::testing::Return(0.0f)); #ifdef LY_TERRAIN_EDITOR ON_CALL(m_data->m_mockEditor, GetHeightmap()).WillByDefault(::testing::Return((CHeightmap*)&(m_data->m_mockHeightmap))); ON_CALL(m_data->m_mockHeightmap, GetOceanLevel()).WillByDefault(::testing::Return(0.0f)); #endif // #ifdef LY_TERRAIN_EDITOR m_localFileIO = aznew AZ::IO::LocalFileIO(); AZ::IO::FileIOBase::SetInstance(nullptr); AZ::IO::FileIOBase::SetInstance(m_localFileIO); StatInstGroupEventBus::Handler::BusConnect(); } void TearDown() override { StatInstGroupEventBus::Handler::BusDisconnect(); AZ::IO::FileIOBase::SetInstance(nullptr); delete m_localFileIO; SetIEditor(nullptr); // Remove the other mocked systems m_data.reset(); AZ::AllocatorInstance<AZ::LegacyAllocator>::Destroy(); UnitTest::AllocatorsTestFixture::TearDown(); // restore the global state that we modified during the test. gEnv = m_savedState.m_Env; } protected: StatInstGroupId GenerateStatInstGroupId() override { return m_groupId++; } void ReleaseStatInstGroupId(StatInstGroupId statInstGroupId) override {} void ReleaseStatInstGroupIdSet(const AZStd::unordered_set<StatInstGroupId>& statInstGroupIdSet) override {} void ReserveStatInstGroupIdRange(StatInstGroupId from, StatInstGroupId to) override {} struct DataMembers { SSystemGlobalEnvironment m_mockGEnv; ::testing::NiceMock<SystemMock> m_mockSystem; ::testing::NiceMock<CEditorMock> m_mockEditor; ::testing::NiceMock<I3DEngineMock> m_mock3DEngine; ::testing::NiceMock<ErrorReportMock> m_mockErrorReport; ::testing::NiceMock<MissingAssetResolverMock> m_missingAssetResolver; #ifdef LY_TERRAIN_EDITOR ::testing::NiceMock<CHeightmapMock> m_mockHeightmap; #endif // #ifdef LY_TERRAIN_EDITOR ::testing::NiceMock<ConsoleMock> m_mockConsole; }; AZStd::unique_ptr<DataMembers> m_data; AZ::Entity* m_systemEntity = nullptr; AZ::IO::FileIOBase* m_localFileIO = nullptr; StatInstGroupId m_groupId{ 0 }; private: struct SavedState { SSystemGlobalEnvironment* m_Env = nullptr; ISystem* m_system = nullptr; }; SavedState m_savedState; }; struct MockAssetSystem : AzFramework::AssetSystemRequestBus::Handler { MockAssetSystem() { BusConnect(); } ~MockAssetSystem() { BusDisconnect(); } AzFramework::AssetSystem::AssetStatus CompileAssetSync(const AZStd::string& assetPath) override { m_compileSync = assetPath; return AzFramework::AssetSystem::AssetStatus::AssetStatus_Queued; } MOCK_METHOD1(CompileAssetSync_FlushIO, AzFramework::AssetSystem::AssetStatus (const AZStd::string&)); MOCK_METHOD1(CompileAssetSyncById, AzFramework::AssetSystem::AssetStatus (const AZ::Data::AssetId&)); MOCK_METHOD1(CompileAssetSyncById_FlushIO, AzFramework::AssetSystem::AssetStatus (const AZ::Data::AssetId&)); MOCK_METHOD4(ConfigureSocketConnection, bool (const AZStd::string&, const AZStd::string&, const AZStd::string&, const AZStd::string&)); MOCK_METHOD1(Connect, bool (const char*)); MOCK_METHOD2(ConnectWithTimeout, bool (const char*, AZStd::chrono::duration<float>)); MOCK_METHOD0(Disconnect, bool ()); MOCK_METHOD1(EscalateAssetBySearchTerm, bool (AZStd::string_view)); MOCK_METHOD1(EscalateAssetByUuid, bool (const AZ::Uuid&)); MOCK_METHOD0(GetAssetProcessorPingTimeMilliseconds, float ()); MOCK_METHOD1(GetAssetStatus, AzFramework::AssetSystem::AssetStatus (const AZStd::string&)); MOCK_METHOD1(GetAssetStatus_FlushIO, AzFramework::AssetSystem::AssetStatus (const AZStd::string&)); MOCK_METHOD1(GetAssetStatusById, AzFramework::AssetSystem::AssetStatus (const AZ::Data::AssetId&)); MOCK_METHOD1(GetAssetStatusById_FlushIO, AzFramework::AssetSystem::AssetStatus (const AZ::Data::AssetId&)); MOCK_METHOD3(GetUnresolvedProductReferences, void (AZ::Data::AssetId, AZ::u32&, AZ::u32&)); MOCK_METHOD0(SaveCatalog, bool ()); MOCK_METHOD1(SetAssetProcessorIP, void (const AZStd::string&)); MOCK_METHOD1(SetAssetProcessorPort, void (AZ::u16)); MOCK_METHOD1(SetBranchToken, void (const AZStd::string&)); MOCK_METHOD1(SetProjectName, void (const AZStd::string&)); MOCK_METHOD0(ShowAssetProcessor, void ()); MOCK_METHOD1(ShowInAssetProcessor, void (const AZStd::string&)); AZStd::string m_compileSync; }; TEST_F(VegetationMapTestFixture, LoadVegObject_AssetSyncRequested) { MockAssetSystem assetSystem; const int maxVegetationInstances = 1; CVegetationMap vegMap(maxVegetationInstances); const int worldSize = 1024; vegMap.Allocate(worldSize, false); CVegetationObject* testVegObject = vegMap.CreateObject(); testVegObject->SetFileName("TestFile"); testVegObject->LoadObject(); ASSERT_STREQ(assetSystem.m_compileSync.c_str(), "TestFile"); } TEST_F(VegetationMapTestFixture, InstantiateEmptySuccess) { CVegetationMap vegMap; } TEST_F(VegetationMapTestFixture, LY111661_CreateMaxInstancesThenCopyAreaWithoutCrashing) { const int maxVegetationInstances = 10000; // Create a default vegetation map set to an arbitrary world size. CVegetationMap vegMap(maxVegetationInstances); const int worldSize = 1024; vegMap.Allocate(worldSize, false); // Calculate the number of instances needed per row to space all our // veg instances evenly. We add one to ensure that we overestimate // when going float->int instead of underestimate. It's not *really* // important that we get the spacing 100% correct, we just want a roughly // even distribution. const int instancesPerRow = aznumeric_cast<int>(sqrt(maxVegetationInstances)) + 1; float worldSpacing = aznumeric_cast<float>(worldSize) / aznumeric_cast<float>(instancesPerRow); // Add the maximum number of instances possible to the vegetation map CVegetationObject *testVegObject = vegMap.CreateObject(); for (int instance = 0; instance < maxVegetationInstances; instance++) { Vec3 worldPos(worldSpacing * (instance % instancesPerRow), worldSpacing * (instance / instancesPerRow), 0.0f); vegMap.PlaceObjectInstance(worldPos, testVegObject); } EXPECT_TRUE(vegMap.GetNumInstances() == maxVegetationInstances); // Copy a box from (50,50)-(150,150) to (250,250)-(350,350). If the bug still exists, // this will crash from trying to create more than the max number of vegetation instances. vegMap.RepositionArea(AABB(Vec3(100.0f, 100.0f, 0.0f), 50.0f), Vec3(200.0f, 200.0f, 0), ImageRotationDegrees::Rotate0, true); } } // namespace UnitTest
5,140
657
<filename>lib/slack/web/docs/team.integrationLogs.json { "desc": "Gets the integration logs for the current team.", "args": { "service_id": { "type" : "int", "required" : false, "desc" : "Filter logs to this service. Defaults to all logs." }, "app_id": { "type" : "int", "required" : false, "desc" : "Filter logs to this Slack app. Defaults to all logs." }, "user": { "type" : "user", "required" : false, "desc" : "Filter logs generated by this user’s actions. Defaults to all logs." }, "change_type": { "required" : false, "example" : "added", "desc" : "Filter logs with this change type. Defaults to all logs." } }, "has_paging" : true, "default_count" : 100, "errors": { } }
325
332
<gh_stars>100-1000 package com.vk.api.sdk.objects.enums; import com.google.gson.annotations.SerializedName; import com.vk.api.sdk.queries.EnumParam; public enum VideoPrivacy implements EnumParam { @SerializedName("0") ALL("0"), @SerializedName("1") FRIENDS("1"), @SerializedName("2") FRIENDS_OF_FRIENDS("2"), @SerializedName("3") ONLY_ME("3"); private final String value; VideoPrivacy(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return value.toLowerCase(); } }
265
5,169
{ "name": "IBentifiers", "version": "1.2.0", "summary": "Handle your identifiable IB elements swiftly.", "description": "IBentifiers provide swifty shortcuts and extensions that ease handling of identifiable IB elements such as storyboards and NIBs.", "homepage": "https://github.com/fellipecaetano/IBentifiers", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "<NAME>": "<EMAIL>" }, "source": { "git": "https://github.com/fellipecaetano/IBentifiers.git", "tag": "1.2.0" }, "platforms": { "ios": "9.0" }, "source_files": "Source/**/*.swift" }
231
348
<gh_stars>100-1000 {"nom":"Ressons-le-Long","circ":"4ème circonscription","dpt":"Aisne","inscrits":596,"abs":318,"votants":278,"blancs":5,"nuls":1,"exp":272,"res":[{"nuance":"REM","nom":"<NAME>","voix":82},{"nuance":"LR","nom":"Mme <NAME>","voix":67},{"nuance":"FN","nom":"<NAME>","voix":64},{"nuance":"FI","nom":"Mme <NAME>","voix":22},{"nuance":"DVG","nom":"Mme <NAME>","voix":13},{"nuance":"ECO","nom":"M. <NAME>","voix":10},{"nuance":"COM","nom":"M. <NAME>","voix":6},{"nuance":"EXG","nom":"M. <NAME>","voix":4},{"nuance":"EXD","nom":"Mme <NAME>","voix":4},{"nuance":"DIV","nom":"Mme <NAME>","voix":0}]}
250
5,538
package com.jayway.jsonpath; import org.junit.Test; import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; public class EvaluationListenerTest extends BaseTest { @Test public void an_evaluation_listener_can_abort_after_one_result_using_fluent_api() { EvaluationListener firstResultListener = new EvaluationListener() { @Override public EvaluationContinuation resultFound(FoundResult found) { return EvaluationContinuation.ABORT; } }; List<String> title = JsonPath.parse(JSON_DOCUMENT).withListeners(firstResultListener).read("$..title", List.class); assertThat(title).containsExactly("Sayings of the Century"); } @Test public void an_evaluation_listener_can_abort_after_one_result_using_configuration() { EvaluationListener firstResultListener = new EvaluationListener() { @Override public EvaluationContinuation resultFound(FoundResult found) { return EvaluationContinuation.ABORT; } }; Configuration configuration = Configuration.builder().evaluationListener(firstResultListener).build(); List<String> title = JsonPath.using(configuration).parse(JSON_DOCUMENT).read("$..title", List.class); assertThat(title).containsExactly("Sayings of the Century"); } @Test public void an_evaluation_lister_can_continue() { final List<Integer> idxs = new ArrayList<Integer>(); EvaluationListener firstResultListener = new EvaluationListener() { @Override public EvaluationContinuation resultFound(FoundResult found) { idxs.add(found.index()); return EvaluationContinuation.CONTINUE; } }; List<String> title = JsonPath.parse(JSON_DOCUMENT).withListeners(firstResultListener).read("$..title", List.class); assertThat(title).containsExactly("Sayings of the Century", "Sword of Honour", "Moby Dick", "The Lord of the Rings"); assertThat(idxs).containsExactly(0, 1, 2, 3); } @Test public void evaluation_results_can_be_limited() { List<String> res = JsonPath.parse(JSON_DOCUMENT).limit(1).read("$..title", List.class); assertThat(res).containsExactly("Sayings of the Century"); res = JsonPath.parse(JSON_DOCUMENT).limit(2).read("$..title", List.class); assertThat(res).containsExactly("Sayings of the Century", "Sword of Honour"); } @Test public void multiple_evaluation_listeners_can_be_added() { final List<Integer> idxs1 = new ArrayList<Integer>(); final List<Integer> idxs2 = new ArrayList<Integer>(); EvaluationListener listener1 = new EvaluationListener() { @Override public EvaluationContinuation resultFound(FoundResult found) { idxs1.add(found.index()); return EvaluationContinuation.CONTINUE; } }; EvaluationListener listener2 = new EvaluationListener() { @Override public EvaluationContinuation resultFound(FoundResult found) { idxs2.add(found.index()); return EvaluationContinuation.CONTINUE; } }; List<String> title = JsonPath.parse(JSON_DOCUMENT).withListeners(listener1, listener2).read("$..title", List.class); assertThat(title).containsExactly("Sayings of the Century", "Sword of Honour", "<NAME>", "The Lord of the Rings"); assertThat(idxs1).containsExactly(0, 1, 2, 3); assertThat(idxs2).containsExactly(0, 1, 2, 3); } @Test public void evaluation_listeners_can_be_cleared() { EvaluationListener listener = new EvaluationListener() { @Override public EvaluationContinuation resultFound(FoundResult found) { return EvaluationContinuation.CONTINUE; } }; Configuration configuration1 = Configuration.builder().evaluationListener(listener).build(); Configuration configuration2 = configuration1.setEvaluationListeners(); assertThat(configuration1.getEvaluationListeners()).hasSize(1); assertThat(configuration2.getEvaluationListeners()).hasSize(0); } }
1,681
981
<reponame>Alexmitter/box64<filename>src/wrapped/generated/wrappedlibcryptundefs.h<gh_stars>100-1000 /******************************************************************* * File automatically generated by rebuild_wrappers.py (v2.1.0.16) * *******************************************************************/ #ifndef __wrappedlibcryptUNDEFS_H_ #define __wrappedlibcryptUNDEFS_H_ #endif // __wrappedlibcryptUNDEFS_H_
117
1,602
<reponame>MayukhSobo/chapel /* * Copyright 2021 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is 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. */ #ifndef CHPL_RESOLUTION_SCOPE_QUERIES_H #define CHPL_RESOLUTION_SCOPE_QUERIES_H #include "chpl/resolution/scope-types.h" namespace chpl { namespace resolution { /** Returns true if this AST type can create a scope. */ bool createsScope(uast::ASTTag tag); /** Returns the Scope for an ID. */ const Scope* scopeForId(Context* context, ID id); /** Given an ID for a Module, returns a Scope that represents the Module scope (and what symbols are defined in it). */ const Scope* scopeForModule(Context* context, ID moduleId); /** Given a Scope, compute the ResolvedVisibilityScope by processing the use/import statements in order. If the scope didn't have use/imports, returns nullptr. */ const ResolvedVisibilityScope* resolveVisibilityStmts(Context* context, const Scope* scope); /** Given an Expression and a Scope, return the things that Expression might refer to. The config argument is a group of or-ed together bit flags that adjusts the behavior of the lookup: * If LOOKUP_DECLS is set, looks for symbols declared in this Scope. * If LOOKUP_IMPORT_AND_USE is set, looks for symbols from use/import statements in this Scope. * If LOOKUP_PARENTS is set, looks for symbols from parent scopes (but not parent modules of a module) including looking for declarations and handling imports, and including finding declarations in the root module. * If LOOKUP_TOPLEVEL is set, checks for a toplevel module with this name. * If LOOKUP_INNERMOST is true, limits search to the innermost scope with a match. */ std::vector<BorrowedIdsWithName> lookupInScope(Context* context, const Scope* scope, const uast::Expression* expr, LookupConfig config); /** Same as lookupInScope above but uses a name instead of an Expression. */ std::vector<BorrowedIdsWithName> lookupNameInScope(Context* context, const Scope* scope, UniqueString name, LookupConfig config); /** Same as lookupInScope but includes a set tracking visited scopes. */ std::vector<BorrowedIdsWithName> lookupInScopeWithSet(Context* context, const Scope* scope, const uast::Expression* expr, LookupConfig config, std::unordered_set<const Scope*>& visited); /** Same as lookupNameInScope but includes a set tracking visited scopes. */ std::vector<BorrowedIdsWithName> lookupNameInScopeWithSet(Context* context, const Scope* scope, UniqueString name, LookupConfig config, std::unordered_set<const Scope*>& visited); /** Returns true if all of checkScope is visible from fromScope due to scope containment or whole-module use statements. */ bool isWholeScopeVisibleFromScope(Context* context, const Scope* checkScope, const Scope* fromScope); /** Returns a unique'd point-of-instantiation scope for the passed scope and parent POI scope. Collapses away POI scopes that do not affect visible functions. */ const PoiScope* pointOfInstantiationScope(Context* context, const Scope* scope, const PoiScope* parentPoiScope); /** Given a name and a Scope, return the innermost and first ID for a definition of that name, and an indication of whether 0, 1, or more matches were found. */ const InnermostMatch& findInnermostDecl(Context* context, const Scope* scope, UniqueString name); } // end namespace resolution } // end namespace chpl #endif
2,032
14,668
// 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. #ifndef ASH_PUBLIC_CPP_EXTERNAL_ARC_MESSAGE_CENTER_ARC_NOTIFICATION_DELEGATE_H_ #define ASH_PUBLIC_CPP_EXTERNAL_ARC_MESSAGE_CENTER_ARC_NOTIFICATION_DELEGATE_H_ #include "base/memory/weak_ptr.h" #include "ui/message_center/public/cpp/notification_delegate.h" namespace message_center { class MessageView; class Notification; } // namespace message_center namespace ash { class ArcNotificationItem; // Implementation of NotificationDelegate for ARC notifications. class ArcNotificationDelegate : public message_center::NotificationDelegate { public: explicit ArcNotificationDelegate(base::WeakPtr<ArcNotificationItem> item); ArcNotificationDelegate(const ArcNotificationDelegate&) = delete; ArcNotificationDelegate& operator=(const ArcNotificationDelegate&) = delete; // Creates a view for the given notification (which must have been the one // generated by |item_|). std::unique_ptr<message_center::MessageView> CreateCustomMessageView( const message_center::Notification& notification); // message_center::NotificationDelegate overrides: void Close(bool by_user) override; void Click(const absl::optional<int>& button_index, const absl::optional<std::u16string>& reply) override; void SettingsClick() override; private: // The destructor is private since this class is ref-counted. ~ArcNotificationDelegate() override; // We use weak ptr to detect potential use-after-free. The lives of objects // around ARC notification is somewhat complex so we want to use it until // it gets stable. base::WeakPtr<ArcNotificationItem> item_; }; } // namespace ash #endif // ASH_PUBLIC_CPP_EXTERNAL_ARC_MESSAGE_CENTER_ARC_NOTIFICATION_DELEGATE_H_
580
2,053
<reponame>zbum/scouter /* * Copyright 2015 the original author or authors. * @https://github.com/scouter-project/scouter * * 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 scouter.lang.pack; import scouter.io.DataInputX; import scouter.io.DataOutputX; import scouter.lang.value.FloatValue; import scouter.lang.value.MapValue; import scouter.lang.value.NumberValue; import scouter.lang.value.Value; import java.io.IOException; /** * Object that contains counter information */ public class InteractionPerfCounterPack implements Pack { /** * Counter time */ public long time; /** * Object name */ public String objName; /** * Interaction type @ CounterConstants */ public String interactionType; public int fromHash; public int toHash; public int period; public int count; public int errorCount; public long totalElapsed; public MapValue customData = new MapValue(); public InteractionPerfCounterPack() { } public InteractionPerfCounterPack(String objName, String interactionType) { this.objName = objName; this.interactionType = interactionType; } public byte getPackType() { return PackEnum.PERF_INTERACTION_COUNTER; } public void write(DataOutputX dout) throws IOException { dout.writeLong(time); dout.writeText(objName); dout.writeText(interactionType); dout.writeInt(fromHash); dout.writeInt(toHash); dout.writeInt(period); dout.writeInt(count); dout.writeInt(errorCount); dout.writeLong(totalElapsed); dout.writeValue(customData); } public Pack read(DataInputX din) throws IOException { this.time = din.readLong(); this.objName = din.readText(); this.interactionType = din.readText(); this.fromHash = din.readInt(); this.toHash = din.readInt(); this.period = din.readInt(); this.count = din.readInt(); this.errorCount = din.readInt(); this.totalElapsed = din.readLong(); this.customData = (MapValue) din.readValue(); return this; } public void putCustom(String key, Object o) { if (o instanceof Number) { this.customData.put(key, new FloatValue(((Number) o).floatValue())); } } public void putCustom(String key, Value value) { this.customData.put(key, value); } public void addCustom(String key, NumberValue value) { Value old = this.customData.get(key); if (old == null) { this.customData.put(key, value); } else if (old instanceof NumberValue) { ((NumberValue) old).add(value); } } @Override public String toString() { return "PerfInteractionCounterPack{" + "time=" + time + ", objName='" + objName + '\'' + ", interactionType='" + interactionType + '\'' + ", fromHash='" + fromHash + '\'' + ", toHash='" + toHash + '\'' + ", period=" + period + ", count=" + count + ", errorCount=" + errorCount + ", totalElapsed=" + totalElapsed + ", customData=" + customData + '}'; } }
1,183
2,039
<gh_stars>1000+ /*- * * * Copyright 2015 Skymind,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 org.nd4j.linalg.util; import lombok.val; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; /** * Feature matrix related jcuda.utils */ public class FeatureUtil { /** * Creates an out come vector from the specified inputs * * @param index the index of the label * @param numOutcomes the number of possible outcomes * @return a binary label matrix used for supervised learning */ public static INDArray toOutcomeVector(long index, long numOutcomes) { if (index > Integer.MAX_VALUE || numOutcomes > Integer.MAX_VALUE) throw new UnsupportedOperationException(); val nums = new int[(int) numOutcomes]; nums[(int) index] = 1; return NDArrayUtil.toNDArray(nums); } /** * Creates an out come vector from the specified inputs * * @param index the index of the label * @param numOutcomes the number of possible outcomes * @return a binary label matrix used for supervised learning */ public static INDArray toOutcomeMatrix(int[] index, long numOutcomes) { INDArray ret = Nd4j.create(index.length, numOutcomes); for (int i = 0; i < ret.rows(); i++) { int[] nums = new int[(int) numOutcomes]; nums[index[i]] = 1; ret.putRow(i, NDArrayUtil.toNDArray(nums)); } return ret; } public static void normalizeMatrix(INDArray toNormalize) { INDArray columnMeans = toNormalize.mean(0); toNormalize.subiRowVector(columnMeans); INDArray std = toNormalize.std(0); std.addi(Nd4j.scalar(1e-12)); toNormalize.diviRowVector(std); } /** * Divides each row by its max * * @param toScale the matrix to divide by its row maxes */ public static void scaleByMax(INDArray toScale) { INDArray scale = toScale.max(1); for (int i = 0; i < toScale.rows(); i++) { double scaleBy = scale.getDouble(i); toScale.putRow(i, toScale.getRow(i).divi(scaleBy)); } } /** * Scales the ndarray columns * to the given min/max values * * @param min the minimum number * @param max the max number */ public static void scaleMinMax(double min, double max, INDArray toScale) { //X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min INDArray min2 = toScale.min(0); INDArray max2 = toScale.max(0); INDArray std = toScale.subRowVector(min2).diviRowVector(max2.sub(min2)); INDArray scaled = std.mul(max - min).addi(min); toScale.assign(scaled); } }
1,384
778
<filename>modDbImpl/src/org/aion/db/store/XorDataSource.java package org.aion.db.store; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Optional; import org.aion.db.impl.ByteArrayKeyValueStore; import org.aion.util.bytes.ByteUtil; public class XorDataSource implements ByteArrayKeyValueStore { private final ByteArrayKeyValueStore source; private final byte[] subKey; private final boolean propagateDeletions; public XorDataSource(ByteArrayKeyValueStore source, byte[] subKey, boolean propagateDeletions) { this.source = source; this.subKey = subKey; this.propagateDeletions = propagateDeletions; } private byte[] convertKey(byte[] key) { return ByteUtil.xorAlignRight(key, subKey); } @Override public Optional<byte[]> get(byte[] key) { return source.get(convertKey(key)); } @Override public Iterator<byte[]> keys() { return new XorDSIteratorWrapper(source.keys()); } /** * A wrapper for the iterator needed by {@link XorDataSource} conforming to the {@link Iterator} * interface. * * @author <NAME> */ private class XorDSIteratorWrapper implements Iterator<byte[]> { final Iterator<byte[]> sourceIterator; /** * @implNote Building two wrappers for the same {@link Iterator} will lead to inconsistent * behavior. */ XorDSIteratorWrapper(final Iterator<byte[]> sourceIterator) { this.sourceIterator = sourceIterator; } @Override public boolean hasNext() { return sourceIterator.hasNext(); } @Override public byte[] next() { return convertKey(sourceIterator.next()); } } @Override public void putBatch(Map<byte[], byte[]> rows) { Map<byte[], byte[]> converted = new HashMap<>(rows.size()); for (Map.Entry<byte[], byte[]> entry : rows.entrySet()) { converted.put(convertKey(entry.getKey()), entry.getValue()); } source.putBatch(converted); } @Override public void close() throws Exception { source.close(); } @Override public void deleteBatch(Collection<byte[]> keys) { if (propagateDeletions) { for (byte[] k : keys) { source.delete(convertKey(k)); } source.commit(); } } @Override public void check() { source.check(); } @Override public boolean isEmpty() { return source.isEmpty(); } @Override public void put(byte[] key, byte[] value) { source.put(convertKey(key), value); } @Override public void delete(byte[] key) { if (propagateDeletions) { source.delete(convertKey(key)); } } @Override public void commit() { source.commit(); } }
1,249
2,151
<reponame>bighitbiker3/webrtc /* * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "modules/remote_bitrate_estimator/test/metric_recorder.h" #include <inttypes.h> #include <algorithm> #include "modules/remote_bitrate_estimator/test/packet_sender.h" #include "typedefs.h" // NOLINT(build/include) namespace webrtc { namespace testing { namespace bwe { namespace { // Holder mean, Manhattan distance for p=1, EuclidianNorm/sqrt(n) for p=2. template <typename T> double NormLp(T sum, size_t size, double p) { return pow(sum / size, 1.0 / p); } } const double kP = 1.0; // Used for Norm Lp. LinkShare::LinkShare(ChokeFilter* choke_filter) : choke_filter_(choke_filter), running_flows_(choke_filter->flow_ids()) { } void LinkShare::PauseFlow(int flow_id) { running_flows_.erase(flow_id); } void LinkShare::ResumeFlow(int flow_id) { running_flows_.insert(flow_id); } uint32_t LinkShare::TotalAvailableKbps() { return choke_filter_->capacity_kbps(); } uint32_t LinkShare::AvailablePerFlowKbps(int flow_id) { uint32_t available_capacity_per_flow_kbps = 0; if (running_flows_.find(flow_id) != running_flows_.end()) { available_capacity_per_flow_kbps = TotalAvailableKbps() / static_cast<uint32_t>(running_flows_.size()); } return available_capacity_per_flow_kbps; } MetricRecorder::MetricRecorder(const std::string algorithm_name, int flow_id, PacketSender* packet_sender, LinkShare* link_share) : algorithm_name_(algorithm_name), flow_id_(flow_id), link_share_(link_share), now_ms_(0), sum_delays_ms_(0), delay_histogram_ms_(), sum_delays_square_ms2_(0), sum_throughput_bytes_(0), last_unweighted_estimate_error_(0), optimal_throughput_bits_(0), last_available_bitrate_per_flow_kbps_(0), start_computing_metrics_ms_(0), started_computing_metrics_(false), num_packets_received_(0) { std::fill_n(sum_lp_weighted_estimate_error_, 2, 0); if (packet_sender != nullptr) packet_sender->set_metric_recorder(this); } void MetricRecorder::SetPlotInformation( const std::vector<std::string>& prefixes, bool plot_delay, bool plot_loss) { assert(prefixes.size() == kNumMetrics); for (size_t i = 0; i < kNumMetrics; ++i) { plot_information_[i].prefix = prefixes[i]; } plot_information_[kThroughput].plot_interval_ms = 100; plot_information_[kSendingEstimate].plot_interval_ms = 100; plot_information_[kDelay].plot_interval_ms = 100; plot_information_[kLoss].plot_interval_ms = 500; plot_information_[kObjective].plot_interval_ms = 1000; plot_information_[kTotalAvailable].plot_interval_ms = 1000; plot_information_[kAvailablePerFlow].plot_interval_ms = 1000; for (int i = kThroughput; i < kNumMetrics; ++i) { plot_information_[i].last_plot_ms = 0; switch (i) { case kSendingEstimate: case kObjective: case kAvailablePerFlow: plot_information_[i].plot = false; break; case kLoss: plot_information_[i].plot = plot_loss; break; case kDelay: plot_information_[i].plot = plot_delay; break; default: plot_information_[i].plot = true; } } } void MetricRecorder::PlotAllDynamics() { for (int i = kThroughput; i < kNumMetrics; ++i) { if (plot_information_[i].plot && now_ms_ - plot_information_[i].last_plot_ms >= plot_information_[i].plot_interval_ms) { PlotDynamics(i); } } } void MetricRecorder::PlotDynamics(int metric) { if (metric == kTotalAvailable) { BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC( 0, plot_information_[kTotalAvailable].prefix, now_ms_, GetTotalAvailableKbps(), flow_id_, "Available"); } else if (metric == kAvailablePerFlow) { BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC( 0, plot_information_[kAvailablePerFlow].prefix, now_ms_, GetAvailablePerFlowKbps(), flow_id_, "Available_per_flow"); } else { PlotLine(metric, plot_information_[metric].prefix, plot_information_[metric].time_ms, plot_information_[metric].value); } plot_information_[metric].last_plot_ms = now_ms_; } template <typename T> void MetricRecorder::PlotLine(int windows_id, const std::string& prefix, int64_t time_ms, T y) { BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC(windows_id, prefix, time_ms, static_cast<double>(y), flow_id_, algorithm_name_); } void MetricRecorder::UpdateTimeMs(int64_t time_ms) { now_ms_ = std::max(now_ms_, time_ms); } void MetricRecorder::UpdateThroughput(int64_t bitrate_kbps, size_t payload_size) { // Total throughput should be computed before updating the time. PushThroughputBytes(payload_size, now_ms_); plot_information_[kThroughput].Update(now_ms_, bitrate_kbps); } void MetricRecorder::UpdateSendingEstimateKbps(int64_t bitrate_kbps) { plot_information_[kSendingEstimate].Update(now_ms_, bitrate_kbps); } void MetricRecorder::UpdateDelayMs(int64_t delay_ms) { PushDelayMs(delay_ms, now_ms_); plot_information_[kDelay].Update(now_ms_, delay_ms); } void MetricRecorder::UpdateLoss(float loss_ratio) { plot_information_[kLoss].Update(now_ms_, loss_ratio); } void MetricRecorder::UpdateObjective() { plot_information_[kObjective].Update(now_ms_, ObjectiveFunction()); } uint32_t MetricRecorder::GetTotalAvailableKbps() { if (link_share_ == nullptr) return 0; return link_share_->TotalAvailableKbps(); } uint32_t MetricRecorder::GetAvailablePerFlowKbps() { if (link_share_ == nullptr) return 0; return link_share_->AvailablePerFlowKbps(flow_id_); } uint32_t MetricRecorder::GetSendingEstimateKbps() { return static_cast<uint32_t>(plot_information_[kSendingEstimate].value); } void MetricRecorder::PushDelayMs(int64_t delay_ms, int64_t arrival_time_ms) { if (ShouldRecord(arrival_time_ms)) { sum_delays_ms_ += delay_ms; sum_delays_square_ms2_ += delay_ms * delay_ms; if (delay_histogram_ms_.find(delay_ms) == delay_histogram_ms_.end()) { delay_histogram_ms_[delay_ms] = 0; } ++delay_histogram_ms_[delay_ms]; } } void MetricRecorder::UpdateEstimateError(int64_t new_value) { int64_t lp_value = pow(static_cast<double>(std::abs(new_value)), kP); if (new_value < 0) { sum_lp_weighted_estimate_error_[0] += lp_value; } else { sum_lp_weighted_estimate_error_[1] += lp_value; } } void MetricRecorder::PushThroughputBytes(size_t payload_size, int64_t arrival_time_ms) { if (ShouldRecord(arrival_time_ms)) { ++num_packets_received_; sum_throughput_bytes_ += payload_size; int64_t current_available_per_flow_kbps = static_cast<int64_t>(GetAvailablePerFlowKbps()); int64_t current_bitrate_diff_kbps = static_cast<int64_t>(GetSendingEstimateKbps()) - current_available_per_flow_kbps; int64_t weighted_estimate_error = (((current_bitrate_diff_kbps + last_unweighted_estimate_error_) * (arrival_time_ms - plot_information_[kThroughput].time_ms)) / 2); UpdateEstimateError(weighted_estimate_error); optimal_throughput_bits_ += ((current_available_per_flow_kbps + last_available_bitrate_per_flow_kbps_) * (arrival_time_ms - plot_information_[kThroughput].time_ms)) / 2; last_available_bitrate_per_flow_kbps_ = current_available_per_flow_kbps; } } bool MetricRecorder::ShouldRecord(int64_t arrival_time_ms) { if (arrival_time_ms >= start_computing_metrics_ms_) { if (!started_computing_metrics_) { start_computing_metrics_ms_ = arrival_time_ms; now_ms_ = arrival_time_ms; started_computing_metrics_ = true; } return true; } else { return false; } } void MetricRecorder::PlotThroughputHistogram( const std::string& title, const std::string& bwe_name, size_t num_flows, int64_t extra_offset_ms, const std::string optimum_id) const { double optimal_bitrate_per_flow_kbps = static_cast<double>( optimal_throughput_bits_ / RunDurationMs(extra_offset_ms)); double neg_error = Renormalize( NormLp(sum_lp_weighted_estimate_error_[0], num_packets_received_, kP)); double pos_error = Renormalize( NormLp(sum_lp_weighted_estimate_error_[1], num_packets_received_, kP)); double average_bitrate_kbps = AverageBitrateKbps(extra_offset_ms); // Prevent the error to be too close to zero (plotting issue). double extra_error = average_bitrate_kbps / 500; std::string optimum_title = optimum_id.empty() ? "optimal_bitrate" : "optimal_bitrates#" + optimum_id; BWE_TEST_LOGGING_LABEL(4, title, "average_bitrate_(kbps)", num_flows); BWE_TEST_LOGGING_LIMITERRORBAR( 4, bwe_name, average_bitrate_kbps, average_bitrate_kbps - neg_error - extra_error, average_bitrate_kbps + pos_error + extra_error, "estimate_error", optimal_bitrate_per_flow_kbps, optimum_title, flow_id_); BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Channel utilization : ", "%lf %%", 100.0 * static_cast<double>(average_bitrate_kbps) / optimal_bitrate_per_flow_kbps); RTC_UNUSED(pos_error); RTC_UNUSED(neg_error); RTC_UNUSED(extra_error); RTC_UNUSED(optimal_bitrate_per_flow_kbps); } void MetricRecorder::PlotThroughputHistogram(const std::string& title, const std::string& bwe_name, size_t num_flows, int64_t extra_offset_ms) const { PlotThroughputHistogram(title, bwe_name, num_flows, extra_offset_ms, ""); } void MetricRecorder::PlotDelayHistogram(const std::string& title, const std::string& bwe_name, size_t num_flows, int64_t one_way_path_delay_ms) const { double average_delay_ms = static_cast<double>(sum_delays_ms_) / num_packets_received_; int64_t percentile_5_ms = NthDelayPercentile(5); int64_t percentile_95_ms = NthDelayPercentile(95); BWE_TEST_LOGGING_LABEL(5, title, "average_delay_(ms)", num_flows); BWE_TEST_LOGGING_ERRORBAR(5, bwe_name, average_delay_ms, percentile_5_ms, percentile_95_ms, "5th and 95th percentiles", flow_id_); // Log added latency, disregard baseline path delay. BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay average : ", "%lf ms", average_delay_ms - one_way_path_delay_ms); BWE_TEST_LOGGING_LOG1( "RESULTS >>> " + bwe_name + " Delay 5th percentile : ", "%" PRId64 " ms", percentile_5_ms - one_way_path_delay_ms); BWE_TEST_LOGGING_LOG1( "RESULTS >>> " + bwe_name + " Delay 95th percentile : ", "%" PRId64 " ms", percentile_95_ms - one_way_path_delay_ms); RTC_UNUSED(average_delay_ms); RTC_UNUSED(percentile_5_ms); RTC_UNUSED(percentile_95_ms); } void MetricRecorder::PlotLossHistogram(const std::string& title, const std::string& bwe_name, size_t num_flows, float global_loss_ratio) const { BWE_TEST_LOGGING_LABEL(6, title, "packet_loss_ratio_(%)", num_flows); BWE_TEST_LOGGING_BAR(6, bwe_name, 100.0f * global_loss_ratio, flow_id_); BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Loss Ratio : ", "%f %%", 100.0f * global_loss_ratio); } void MetricRecorder::PlotObjectiveHistogram(const std::string& title, const std::string& bwe_name, size_t num_flows) const { BWE_TEST_LOGGING_LABEL(7, title, "objective_function", num_flows); BWE_TEST_LOGGING_BAR(7, bwe_name, ObjectiveFunction(), flow_id_); } void MetricRecorder::PlotZero() { for (int i = kThroughput; i <= kLoss; ++i) { if (plot_information_[i].plot) { std::stringstream prefix; // TODO(terelius): Since this does not use the BWE_TEST_LOGGING macros, // it hasn't been kept up to date with the plot format. Remove or fix? prefix << "Receiver_" << flow_id_ << "_" + plot_information_[i].prefix; PlotLine(i, prefix.str(), now_ms_, 0); plot_information_[i].last_plot_ms = now_ms_; } } } void MetricRecorder::PauseFlow() { PlotZero(); link_share_->PauseFlow(flow_id_); } void MetricRecorder::ResumeFlow(int64_t paused_time_ms) { UpdateTimeMs(now_ms_ + paused_time_ms); PlotZero(); link_share_->ResumeFlow(flow_id_); } double MetricRecorder::AverageBitrateKbps(int64_t extra_offset_ms) const { int64_t duration_ms = RunDurationMs(extra_offset_ms); if (duration_ms == 0) return 0.0; return static_cast<double>(8 * sum_throughput_bytes_ / duration_ms); } int64_t MetricRecorder::RunDurationMs(int64_t extra_offset_ms) const { return now_ms_ - start_computing_metrics_ms_ - extra_offset_ms; } double MetricRecorder::DelayStdDev() const { if (num_packets_received_ == 0) { return 0.0; } double mean = static_cast<double>(sum_delays_ms_) / num_packets_received_; double mean2 = static_cast<double>(sum_delays_square_ms2_) / num_packets_received_; return sqrt(mean2 - pow(mean, 2.0)); } // Since delay values are bounded in a subset of [0, 5000] ms, // this function's execution time is O(1), independend of num_packets_received_. int64_t MetricRecorder::NthDelayPercentile(int n) const { if (num_packets_received_ == 0) { return 0; } size_t num_packets_remaining = (n * num_packets_received_) / 100; for (auto hist : delay_histogram_ms_) { if (num_packets_remaining <= hist.second) return static_cast<int64_t>(hist.first); num_packets_remaining -= hist.second; } assert(false); return -1; } // The weighted_estimate_error_ was weighted based on time windows. // This function scales back the result before plotting. double MetricRecorder::Renormalize(double x) const { return (x * num_packets_received_) / now_ms_; } inline double U(int64_t x, double alpha) { if (alpha == 1.0) { return log(static_cast<double>(x)); } return pow(static_cast<double>(x), 1.0 - alpha) / (1.0 - alpha); } inline double U(size_t x, double alpha) { return U(static_cast<int64_t>(x), alpha); } // TODO(magalhaesc): Update ObjectiveFunction. double MetricRecorder::ObjectiveFunction() const { const double kDelta = 0.15; // Delay penalty factor. const double kAlpha = 1.0; const double kBeta = 1.0; double throughput_metric = U(sum_throughput_bytes_, kAlpha); double delay_penalty = kDelta * U(sum_delays_ms_, kBeta); return throughput_metric - delay_penalty; } } // namespace bwe } // namespace testing } // namespace webrtc
6,757
1,536
from tensorflow.keras.callbacks import Callback class ExperimentLogCallback(Callback): def __init__(self, experiment_name, params): '''Takes as input the name of the experiment which will be used for creating a .log file with the outputs and the params dictionary from the input model in `Scan()` experiment_name | str | must match the experiment_name in `Scan()` ''' super(ExperimentLogCallback, self).__init__() import glob import os # get the experiment id first list_of_files = glob.glob('./' + experiment_name + '/*.csv') try: latest_file = max(list_of_files, key=os.path.getmtime) except ValueError: print("\n TALOS ERROR: `experiment_name` has to match `Scan(experiment_name)`\n") self.name = latest_file.replace('.csv', '') + '.log' # rest of the config variables self.params = params self.counter = 1 self.new_file = True def on_train_begin(self, logs={}): import random self.hash = hex(abs(hash(str(random.random())))) self.final_out = [] def on_train_end(self, logs={}): f = open(self.name, 'a+') [f.write(','.join(map(str, i)) + '\n') for i in self.final_out] f.close() def on_epoch_begin(self, epoch, logs={}): self.epoch_out = [] def on_epoch_end(self, epoch, logs={}): if len(self.final_out) == 0: try: open(self.name, 'r') except FileNotFoundError: self.epoch_out.append('id') self.epoch_out.append('epoch') for key in logs.keys(): # add to the epoch out list self.epoch_out.append(key) self.final_out.append(self.epoch_out) self.epoch_out = [] self.epoch_out.append(self.hash) self.epoch_out.append(epoch + 1) for key in logs.keys(): # round the values rounded = round(logs[key], 4) # add to the epoch out list self.epoch_out.append(rounded) # add to the final out list self.final_out.append(self.epoch_out)
1,091
585
/*! * Copyright (c) 2017-2020 by Contributors * \file compiler.cc * \brief Registry of compilers */ #include <treelite/compiler.h> #include <treelite/compiler_param.h> #include <treelite/logging.h> #include <rapidjson/document.h> #include <limits> #include "./ast_native.h" #include "./failsafe.h" namespace treelite { Compiler* Compiler::Create(const std::string& name, const char* param_json_str) { compiler::CompilerParam param = compiler::CompilerParam::ParseFromJSON(param_json_str); if (name == "ast_native") { return new compiler::ASTNativeCompiler(param); } else if (name == "failsafe") { return new compiler::FailSafeCompiler(param); } else { TREELITE_LOG(FATAL) << "Unrecognized compiler '" << name << "'"; return nullptr; } } namespace compiler { CompilerParam CompilerParam::ParseFromJSON(const char* param_json_str) { CompilerParam param; // Default values param.annotate_in = "NULL"; param.quantize = 0; param.parallel_comp = 0; param.verbose = 0; param.native_lib_name = "predictor"; param.code_folding_req = std::numeric_limits<double>::infinity(); param.dump_array_as_elf = 0; rapidjson::Document doc; doc.Parse(param_json_str); TREELITE_CHECK(doc.IsObject()) << "Got an invalid JSON string:\n" << param_json_str; for (const auto& e : doc.GetObject()) { const std::string key = e.name.GetString(); if (key == "annotate_in") { TREELITE_CHECK(e.value.IsString()) << "Expected a string for 'annotate_in'"; param.annotate_in = e.value.GetString(); } else if (key == "quantize") { TREELITE_CHECK(e.value.IsInt()) << "Expected an integer for 'quantize'"; param.quantize = e.value.GetInt(); TREELITE_CHECK_GE(param.quantize, 0) << "'quantize' must be 0 or greater"; } else if (key == "parallel_comp") { TREELITE_CHECK(e.value.IsInt()) << "Expected an integer for 'parallel_comp'"; param.parallel_comp = e.value.GetInt(); TREELITE_CHECK_GE(param.parallel_comp, 0) << "'parallel_comp' must be 0 or greater"; } else if (key == "verbose") { TREELITE_CHECK(e.value.IsInt()) << "Expected an integer for 'verbose'"; param.verbose = e.value.GetInt(); } else if (key == "native_lib_name") { TREELITE_CHECK(e.value.IsString()) << "Expected a string for 'native_lib_name'"; param.native_lib_name = e.value.GetString(); } else if (key == "code_folding_req") { TREELITE_CHECK(e.value.IsDouble()) << "Expected a floating-point decimal for 'code_folding_req'"; param.code_folding_req = e.value.GetDouble(); TREELITE_CHECK_GE(param.code_folding_req, 0) << "'code_folding_req' must be 0 or greater"; } else if (key == "dump_array_as_elf") { TREELITE_CHECK(e.value.IsInt()) << "Expected an integer for 'dump_array_as_elf'"; param.dump_array_as_elf = e.value.GetInt(); TREELITE_CHECK_GE(param.dump_array_as_elf, 0) << "'dump_array_as_elf' must be 0 or greater"; } else { TREELITE_LOG(FATAL) << "Unrecognized key '" << key << "' in JSON"; } } return param; } } // namespace compiler } // namespace treelite
1,222
1,056
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.modules.xml.text.completion; import java.awt.*; import java.awt.font.TextAttribute; import java.util.Map; import java.util.HashMap; import java.text.AttributedString; import javax.swing.*; /** * * @author Samaresh (<EMAIL>) */ public class XMLCompletionResultItemPaintComponent extends JPanel { private Icon icon; /** * Creates a new instance of XMLCompletionResultItemPaintComponent */ public XMLCompletionResultItemPaintComponent() { super(); setOpaque(true); setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3)); } public void setString(String str){ this.str = str; } public void setSelected(boolean isSelected){ this.isSelected = isSelected; } protected void setDeprecated(boolean isDeprecated){ this.isDeprecated = isDeprecated; } public boolean isSelected(){ return isSelected; } protected boolean isDeprecated(){ return isDeprecated; } protected Icon getIcon() { return icon; } public void setIcon(Icon icon) { this.icon = icon; } public void paintComponent(Graphics g) { // clear background g.setColor(getBackground()); java.awt.Rectangle r = g.getClipBounds(); g.fillRect(r.x, r.y, r.width, r.height); draw(g); } protected void draw(Graphics g){ } /** Draw the icon if it is valid for the given type. * Here the initial drawing assignments are also done. */ protected void drawIcon(Graphics g, Icon icon) { Insets i = getInsets(); if (i != null) { drawX = i.left; drawY = i.top; } else { drawX = 0; drawY = 0; } if (icon != null) { if (g != null) { icon.paintIcon(this, g, drawX, drawY); } drawX += icon.getIconWidth() + iconTextGap; drawHeight = Math.max(fontHeight, icon.getIconHeight()); } else { drawHeight = fontHeight; } if (i != null) { drawHeight += i.bottom; } drawHeight += drawY; drawY += ascent; } protected void drawString(Graphics g, String s){ drawString(g, s, false); } /** Draw string using the foreground color */ protected void drawString(Graphics g, String s, boolean strike) { if (g != null) { g.setColor(getForeground()); } drawStringToGraphics(g, s, null, strike); } /** Draw string with given color which is first possibly modified * by calling getColor() method to care about selection etc. */ protected void drawString(Graphics g, String s, Color c) { if (g != null) { g.setColor(getColor(s, c)); } drawStringToGraphics(g, s); } protected void drawString(Graphics g, String s, Color c, Font font, boolean strike) { if (g != null) { g.setColor(getColor(s, c)); g.setFont(font); } drawStringToGraphics(g, s, font, strike); if (g != null) { g.setFont(drawFont); } } protected void drawStringToGraphics(Graphics g, String s) { drawStringToGraphics(g, s, null, false); } protected void drawStringToGraphics(Graphics g, String s, Font font, boolean strike) { if (g != null) { if (!strike){ g.drawString(s, drawX, drawY); }else{ Graphics2D g2 = ((Graphics2D)g); AttributedString strikeText = new AttributedString(s); strikeText.addAttribute(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON); strikeText.addAttribute(TextAttribute.FONT, g.getFont()); g2.drawString(strikeText.getIterator(), drawX, drawY); } } drawX += getWidth(s, font); } protected int getWidth(String s, Font font) { if (font != null) return getFontMetrics(getDrawFont()).stringWidth(s)*2; return (s == null)?fontMetrics.stringWidth(""):fontMetrics.stringWidth(s)*2; } protected Color getColor(String s, Color defaultColor) { return isSelected ? getForeground() : defaultColor; } private void storeWidth(String s) { fontMetrics.stringWidth(s); } public void setFont(Font font) { super.setFont(font); fontMetrics = this.getFontMetrics(font); fontHeight = fontMetrics.getHeight(); ascent = fontMetrics.getAscent(); if (widths != null) { widths.clear(); } else { widths = new HashMap(); } for (int i = 0; i < frequentWords.length; i++) { storeWidth(frequentWords[i]); } drawFont = font; } protected Font getDrawFont(){ return drawFont; } public Dimension getPreferredSize() { draw(null); Insets i = getInsets(); if (i != null) { drawX += i.right; } if (drawX > getMaximumSize().width) drawX = getMaximumSize().width; return new Dimension(drawX, drawHeight); } public static class StringPaintComponent extends XMLCompletionResultItemPaintComponent { private Color c; public StringPaintComponent(Color c) { this.c = c; } protected void draw(Graphics g){ drawIcon(g, getIcon()); drawString(g, str, c); } } static final String PACKAGE = "org/netbeans/modules/editor/resources/completion/defaultFolder.gif"; // NOI18N protected int drawX; protected int drawY; protected int drawHeight; private Font drawFont; private int iconTextGap = 5; private int fontHeight; private int ascent; private Map widths; private FontMetrics fontMetrics; private boolean isSelected; private boolean isDeprecated; private static final String THROWS = " throws "; // NOI18N private static String str; //completion item text private static final String[] frequentWords = new String[] { "", " ", "[]", "(", ")", ", ", "String", THROWS // NOI18N }; public static final Color KEYWORD_COLOR = Color.darkGray; public static final Color TYPE_COLOR = Color.black; }
3,049
5,169
<reponame>ftapp/cocoapods<filename>Specs/WalmartSDKKit/1.0.0/WalmartSDKKit.podspec.json { "name": "WalmartSDKKit", "version": "1.0.0", "summary": "Walmart SDK Kit for iOS", "description": "Walmart SDK is designed to let you drive sales right in your app or on your website. SDK components like BuyNow button can be placed next to a product offering on the website or in a mobile application and it can be configured to directly add the product to the cart on Walmart.com.s the world's largest retailer, and the Walmart Open API provides", "platforms": { "ios": "8.0" }, "requires_arc": true, "homepage": "https://affiliates.walmart.com/#!/mobilesdk", "license": "Private", "source": { "http": "https://affiliates.walmart.com/linksharepromo/assets/WalmartSDKKit-1.0.0.zip" }, "authors": { "@WalmartLabs": "<EMAIL>" }, "preserve_paths": [ "WalmartSDKKit.framework", "Example" ], "ios": { "frameworks": [ "Foundation", "UIKit" ], "vendored_frameworks": "WalmartSDKKit.framework" }, "dependencies": { "WalmartOpenApi": [ "~> 1" ] } }
430
879
<filename>plugin/localstorage/src/main/java/org/zstack/storage/primary/local/LocalStorageKvmFactory.java<gh_stars>100-1000 package org.zstack.storage.primary.local; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.zstack.core.cloudbus.CloudBus; import org.zstack.core.cloudbus.CloudBusCallBack; import org.zstack.core.db.DatabaseFacade; import org.zstack.core.db.Q; import org.zstack.core.errorcode.ErrorFacade; import org.zstack.header.core.workflow.Flow; import org.zstack.header.core.workflow.FlowTrigger; import org.zstack.header.core.workflow.NoRollbackFlow; import org.zstack.header.errorcode.ErrorCode; import org.zstack.header.host.*; import org.zstack.header.message.MessageReply; import org.zstack.header.storage.primary.*; import org.zstack.header.storage.snapshot.VolumeSnapshotVO; import org.zstack.header.vm.VmInstanceSpec; import org.zstack.kvm.*; import org.zstack.utils.Utils; import org.zstack.utils.logging.CLogger; import javax.persistence.TypedQuery; import java.util.Iterator; import java.util.List; import java.util.Map; import static org.zstack.core.Platform.operr; /** * Created by frank on 6/30/2015. */ public class LocalStorageKvmFactory implements LocalStorageHypervisorFactory, KVMHostConnectExtensionPoint, FailToAddHostExtensionPoint, KVMStartVmExtensionPoint { private static final CLogger logger = Utils.getLogger(LocalStorageKvmFactory.class); @Autowired private DatabaseFacade dbf; @Autowired private CloudBus bus; @Autowired private ErrorFacade errf; @Override public String getHypervisorType() { return KVMConstant.KVM_HYPERVISOR_TYPE; } @Override public LocalStorageHypervisorBackend getHypervisorBackend(PrimaryStorageVO vo) { return new LocalStorageKvmBackend(vo); } @Transactional(readOnly = true) private List<String> findLocalStorageUuidByHostUuid(String clusterUuid) { String sql = "select pri.uuid" + " from PrimaryStorageVO pri, PrimaryStorageClusterRefVO ref" + " where pri.uuid = ref.primaryStorageUuid" + " and ref.clusterUuid = :cuuid" + " and pri.type = :ptype"; TypedQuery<String> q = dbf.getEntityManager().createQuery(sql, String.class); q.setParameter("cuuid", clusterUuid); q.setParameter("ptype", LocalStorageConstants.LOCAL_STORAGE_TYPE); return q.getResultList(); } @Override public Flow createKvmHostConnectingFlow(final KVMHostConnectedContext context) { return new NoRollbackFlow() { String __name__ = "init-local-storage"; @Override public void run(final FlowTrigger trigger, Map data) { final List<String> priUuids = findLocalStorageUuidByHostUuid(context.getInventory().getClusterUuid()); if (priUuids == null || priUuids.isEmpty()) { trigger.next(); return; } Iterator<String> iterator = priUuids.iterator(); initLocalStorage(iterator, trigger, data, context); } }; } private void initLocalStorage(final Iterator<String> iterator, final FlowTrigger trigger, Map data, final KVMHostConnectedContext context) { if (!iterator.hasNext()) { trigger.next(); return; } final String priUuid = iterator.next(); InitPrimaryStorageOnHostConnectedMsg msg = new InitPrimaryStorageOnHostConnectedMsg(); msg.setPrimaryStorageUuid(priUuid); msg.setHostUuid(context.getInventory().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, priUuid); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { trigger.fail(operr("KVM host[uuid: %s] fails to be added into local primary storage[uuid: %s], %s", context.getInventory().getUuid(), priUuid, reply.getError())); } else { initLocalStorage(iterator, trigger, data, context); } } }); } @Override public void failedToAddHost(HostInventory host, AddHostMessage amsg) { final List<String> priUuids = findLocalStorageUuidByHostUuid(host.getClusterUuid()); if (priUuids == null || priUuids.isEmpty()) { return; } for (String priUUid : priUuids) { LocalStorageRecalculateCapacityMsg msg = new LocalStorageRecalculateCapacityMsg(); msg.setPrimaryStorageUuid(priUUid); msg.setNeedRecalculateRef(false); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, priUUid); bus.send(msg, new CloudBusCallBack(null) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { logger.warn(String.format("failed to sync primary storage[uuid:%s] capacity, %s", priUuids, reply.getError())); } } }); } } @Override public void beforeStartVmOnKvm(KVMHostInventory host, VmInstanceSpec spec, KVMAgentCommands.StartVmCmd cmd) { if (spec.getMemorySnapshotUuid() == null) { return; } VolumeSnapshotVO vo = dbf.findByUuid(spec.getMemorySnapshotUuid(), VolumeSnapshotVO.class); if (!Q.New(PrimaryStorageVO.class) .eq(PrimaryStorageVO_.type, LocalStorageConstants.LOCAL_STORAGE_TYPE) .eq(PrimaryStorageVO_.uuid, vo.getPrimaryStorageUuid()).isExists()) { return; } cmd.setMemorySnapshotPath(vo.getPrimaryStorageInstallPath()); } @Override public void startVmOnKvmSuccess(KVMHostInventory host, VmInstanceSpec spec) { } @Override public void startVmOnKvmFailed(KVMHostInventory host, VmInstanceSpec spec, ErrorCode err) { } }
2,746
648
<filename>spec/hl7.fhir.core/3.0.1/package/DataElement-StructureMap.group.rule.rule.json {"resourceType":"DataElement","id":"StructureMap.group.rule.rule","meta":{"lastUpdated":"2017-04-19T07:44:43.294+10:00"},"url":"http://hl7.org/fhir/DataElement/StructureMap.group.rule.rule","status":"draft","experimental":true,"stringency":"fully-specified","element":[{"id":"StructureMap.group.rule.rule","path":"StructureMap.group.rule.rule","short":"Rules contained in this rule","definition":"Rules contained in this rule.","min":0,"max":"*","contentReference":"#StructureMap.group.rule","isSummary":true}]}
189
412
<gh_stars>100-1000 /*******************************************************************\ Module: value_set_fi_Fp_removal Author: <NAME>, <EMAIL> \*******************************************************************/ /// \file /// flow insensitive value set function pointer removal #ifndef CPROVER_GOTO_INSTRUMENT_VALUE_SET_FI_FP_REMOVAL_H #define CPROVER_GOTO_INSTRUMENT_VALUE_SET_FI_FP_REMOVAL_H class goto_modelt; class message_handlert; /// Builds the flow-insensitive value set for all function pointers /// and replaces function pointers with a non-deterministic switch /// between this set. If the set is empty, the function pointer is /// not removed. Thus remove_function_pointers should be run after this to // guarantee removal of all function pointers. /// \param goto_model: goto model to be modified /// \param message_handler: message handler for status output void value_set_fi_fp_removal( goto_modelt &goto_model, message_handlert &message_handler); #endif // CPROVER_GOTO_INSTRUMENT_VALUE_SET_FI_FP_REMOVAL_H
301
9,959
class CleanupName { void test() { @lombok.Cleanup("toString") Object o = "Hello World!"; System.out.println(o); } void test2() { @lombok.Cleanup(value="toString") Object o = "Hello World too!"; System.out.println(o); } }
95
639
// // Created by zeyi on 1/10/19. // #include "thundergbm/parser.h" #include <thundergbm/dataset.h> #include "thundergbm/predictor.h" #ifdef _WIN32 INITIALIZE_EASYLOGGINGPP #endif int main(int argc, char **argv) { el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime %level %fbase:%line : %msg"); el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput); el::Loggers::addFlag(el::LoggingFlag::FixedTimeFormat); GBMParam model_param; Parser parser; parser.parse_param(model_param, argc, argv); if(model_param.verbose == 0) { el::Loggers::reconfigureAllLoggers(el::Level::Debug, el::ConfigurationType::Enabled, "false"); el::Loggers::reconfigureAllLoggers(el::Level::Trace, el::ConfigurationType::Enabled, "false"); el::Loggers::reconfigureAllLoggers(el::Level::Info, el::ConfigurationType::Enabled, "false"); } else if (model_param.verbose == 1) { el::Loggers::reconfigureAllLoggers(el::Level::Debug, el::ConfigurationType::Enabled, "false"); el::Loggers::reconfigureAllLoggers(el::Level::Trace, el::ConfigurationType::Enabled, "false"); } //load data set DataSet dataSet; //load model vector<vector<Tree>> boosted_model; parser.load_model("tgbm.model", model_param, boosted_model, dataSet); dataSet.load_from_file(model_param.path, model_param); //predict Predictor pred; vector<float_type> y_pred_vec = pred.predict(model_param, boosted_model, dataSet); //users can use y_pred_vec for their own purpose. }
603
3,102
<filename>clang/test/SemaCXX/type_pack_element.cpp // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s static_assert(__has_builtin(__type_pack_element), ""); using SizeT = decltype(sizeof(int)); template <SizeT i, typename ...T> using TypePackElement = __type_pack_element<i, T...>; template <int i> struct X; static_assert(__is_same(TypePackElement<0, X<0>>, X<0>), ""); static_assert(__is_same(TypePackElement<0, X<0>, X<1>>, X<0>), ""); static_assert(__is_same(TypePackElement<1, X<0>, X<1>>, X<1>), ""); static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>>, X<0>), ""); static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>>, X<1>), ""); static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>>, X<2>), ""); static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>>, X<0>), ""); static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>>, X<1>), ""); static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>>, X<2>), ""); static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>>, X<3>), ""); static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>, X<4>>, X<0>), ""); static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>, X<4>>, X<1>), ""); static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>, X<4>>, X<2>), ""); static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>, X<4>>, X<3>), ""); static_assert(__is_same(TypePackElement<4, X<0>, X<1>, X<2>, X<3>, X<4>>, X<4>), ""); static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<0>), ""); static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<1>), ""); static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<2>), ""); static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<3>), ""); static_assert(__is_same(TypePackElement<4, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<4>), ""); static_assert(__is_same(TypePackElement<5, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<5>), ""); // Test __type_pack_element with more than 2 top-level template arguments. static_assert(__is_same(__type_pack_element<5, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<5>), ""); template <SizeT Index, typename ...T> using ErrorTypePackElement1 = __type_pack_element<Index, T...>; // expected-error{{may not be accessed at an out of bounds index}} using illformed1 = ErrorTypePackElement1<3, X<0>, X<1>>; // expected-note{{in instantiation}}
1,154
1,668
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def rewrite_business_segment_from_pc(apps, schema_editor): Service = apps.get_model('assets', 'Service') for service in Service.objects.filter(profit_center__business_segment__isnull=False): print('Assigning {} to {}'.format(service.profit_center.business_segment.name, service.name)) service.business_segment = service.profit_center.business_segment service.save(update_fields=['business_segment']) def rewrite_business_segment_to_pc(apps, schema_editor): Service = apps.get_model('assets', 'Service') for service in Service.objects.filter(profit_center__isnull=False, business_segment__isnull=False): print('Assigning {} to {}'.format(service.business_segment.name, service.profit_center.name)) service.profit_center.business_segment = service.business_segment service.profit_center.save(update_fields=['business_segment']) class Migration(migrations.Migration): dependencies = [ ('assets', '0027_asset_buyout_date'), ] operations = [ migrations.AddField( model_name='service', name='business_segment', field=models.ForeignKey(blank=True, null=True, to='assets.BusinessSegment'), ), migrations.RunPython( rewrite_business_segment_from_pc, reverse_code=rewrite_business_segment_to_pc ), migrations.RemoveField( model_name='profitcenter', name='business_segment', ), ]
616
677
/* * Copyright (C) 2008-2017 Apple Inc. All rights reserved. * Copyright (C) 2012 Research In Motion Limited. All rights reserved. * * 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 Apple Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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. */ #pragma once #include "ArgList.h" #include "CatchScope.h" #include "FrameTracers.h" #include "JSCJSValue.h" #include "JSCell.h" #include "JSObject.h" #include "Opcode.h" #include "StackAlignment.h" #include <wtf/HashMap.h> #if !ENABLE(JIT) #include "CLoopStack.h" #endif namespace JSC { class CodeBlock; class EvalExecutable; class FunctionExecutable; class VM; class JSFunction; class JSGlobalObject; class JSModuleEnvironment; class JSModuleRecord; class LLIntOffsetsExtractor; class ProgramExecutable; class ModuleProgramExecutable; class Register; class JSScope; class StackFrame; struct CallFrameClosure; struct HandlerInfo; struct Instruction; struct ProtoCallFrame; struct UnlinkedInstruction; enum UnwindStart : uint8_t { UnwindFromCurrentFrame, UnwindFromCallerFrame }; enum DebugHookType { WillExecuteProgram, DidExecuteProgram, DidEnterCallFrame, DidReachBreakpoint, WillLeaveCallFrame, WillExecuteStatement, WillExecuteExpression, }; enum StackFrameCodeType { StackFrameGlobalCode, StackFrameEvalCode, StackFrameModuleCode, StackFrameFunctionCode, StackFrameNativeCode }; class Interpreter { WTF_MAKE_FAST_ALLOCATED; friend class CachedCall; friend class LLIntOffsetsExtractor; friend class JIT; friend class VM; public: Interpreter(VM &); ~Interpreter(); void initialize(); #if !ENABLE(JIT) CLoopStack& cloopStack() { return m_cloopStack; } #endif Opcode getOpcode(OpcodeID id) { ASSERT(m_initialized); #if ENABLE(COMPUTED_GOTO_OPCODES) return m_opcodeTable[id]; #else return id; #endif } OpcodeID getOpcodeID(Opcode opcode) { ASSERT(m_initialized); #if ENABLE(COMPUTED_GOTO_OPCODES) ASSERT(isOpcode(opcode)); return m_opcodeIDTable.get(opcode); #else return opcode; #endif } OpcodeID getOpcodeID(const Instruction&); OpcodeID getOpcodeID(const UnlinkedInstruction&); bool isOpcode(Opcode); JSValue executeProgram(const SourceCode&, CallFrame*, JSObject* thisObj); JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&); JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&, JSValue newTarget); JSValue execute(EvalExecutable*, CallFrame*, JSValue thisValue, JSScope*); JSValue execute(ModuleProgramExecutable*, CallFrame*, JSModuleEnvironment*); void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); NEVER_INLINE HandlerInfo* unwind(VM&, CallFrame*&, Exception*, UnwindStart); void notifyDebuggerOfExceptionToBeThrown(VM&, CallFrame*, Exception*); NEVER_INLINE void debug(CallFrame*, DebugHookType); static JSString* stackTraceAsString(VM&, const Vector<StackFrame>&); static EncodedJSValue JSC_HOST_CALL constructWithErrorConstructor(ExecState*); static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState*); static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecState*); static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState*); JS_EXPORT_PRIVATE void dumpCallFrame(CallFrame*); void getStackTrace(Vector<StackFrame>& results, size_t framesToSkip = 0, size_t maxStackSize = std::numeric_limits<size_t>::max()); private: enum ExecutionFlag { Normal, InitializeAndReturn }; CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, ProtoCallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*, const ArgList&); JSValue execute(CallFrameClosure&); void dumpRegisters(CallFrame*); bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval) || opcode == getOpcode(op_tail_call); } VM& m_vm; #if !ENABLE(JIT) CLoopStack m_cloopStack; #endif #if ENABLE(COMPUTED_GOTO_OPCODES) Opcode* m_opcodeTable; // Maps OpcodeID => Opcode for compiling HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling #endif #if !ASSERT_DISABLED bool m_initialized; #endif }; JSValue eval(CallFrame*); inline CallFrame* calleeFrameForVarargs(CallFrame* callFrame, unsigned numUsedStackSlots, unsigned argumentCountIncludingThis) { // We want the new frame to be allocated on a stack aligned offset with a stack // aligned size. Align the size here. argumentCountIncludingThis = WTF::roundUpToMultipleOf( stackAlignmentRegisters(), argumentCountIncludingThis + CallFrame::headerSizeInRegisters) - CallFrame::headerSizeInRegisters; // Align the frame offset here. unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf( stackAlignmentRegisters(), numUsedStackSlots + argumentCountIncludingThis + CallFrame::headerSizeInRegisters); return CallFrame::create(callFrame->registers() - paddedCalleeFrameOffset); } unsigned sizeOfVarargs(CallFrame* exec, JSValue arguments, uint32_t firstVarArgOffset); static const unsigned maxArguments = 0x10000; unsigned sizeFrameForVarargs(CallFrame* exec, VM&, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset); unsigned sizeFrameForForwardArguments(CallFrame* exec, VM&, unsigned numUsedStackSlots); void loadVarargs(CallFrame* execCaller, VirtualRegister firstElementDest, JSValue source, uint32_t offset, uint32_t length); void setupVarargsFrame(CallFrame* execCaller, CallFrame* execCallee, JSValue arguments, uint32_t firstVarArgOffset, uint32_t length); void setupVarargsFrameAndSetThis(CallFrame* execCaller, CallFrame* execCallee, JSValue thisValue, JSValue arguments, uint32_t firstVarArgOffset, uint32_t length); void setupForwardArgumentsFrame(CallFrame* execCaller, CallFrame* execCallee, uint32_t length); void setupForwardArgumentsFrameAndSetThis(CallFrame* execCaller, CallFrame* execCallee, JSValue thisValue, uint32_t length); } // namespace JSC
2,980
1,253
#include <iostream> using namespace std; int main() { int n; cout<<"Enter any number: "<<endl; cin>>n; cout<< (n&1?"Number is Odd":"Number is Even")<<endl; }
69
573
<gh_stars>100-1000 // Copyright 2015, VIXL authors // 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. // * Neither the name of ARM Limited 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 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 OWNER 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. // --------------------------------------------------------------------- // This file is auto generated using tools/generate_simulator_traces.py. // // PLEASE DO NOT EDIT. // --------------------------------------------------------------------- #ifndef VIXL_SIM_SQSHL_16B_TRACE_AARCH64_H_ #define VIXL_SIM_SQSHL_16B_TRACE_AARCH64_H_ const uint8_t kExpected_NEON_sqshl_16B[] = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfc, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfa, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x80, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf8, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0x80, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0x80, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0x80, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfc, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0x80, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x00, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x08, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0xfe, 0xfe, 0xfe, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf3, 0xfc, 0xfd, 0xfc, 0xfc, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xea, 0xe6, 0xf8, 0xfa, 0xf8, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe0, 0xd5, 0xcc, 0xf0, 0xf4, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0xe0, 0xc1, 0xaa, 0x98, 0xe0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xc1, 0x83, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0xc0, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0xc0, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x0a, 0x1f, 0x3f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0x00, 0x06, 0x15, 0x3e, 0x7e, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0x01, 0x0c, 0x2a, 0x7d, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0x02, 0x19, 0x55, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x33, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x08, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x10, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; const unsigned kExpectedCount_NEON_sqshl_16B = 361; #endif // VIXL_SIM_SQSHL_16B_TRACE_AARCH64_H_
24,307
1,546
<gh_stars>1000+ /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3.keyboard; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.RectEvaluator; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.util.FloatProperty; import android.view.View; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.util.Themes; /** * A helper class to draw background of a focused item. * @param <T> Item type */ public abstract class ItemFocusIndicatorHelper<T> implements AnimatorUpdateListener { private static final float MIN_VISIBLE_ALPHA = 0.2f; private static final long ANIM_DURATION = 150; public static final FloatProperty<ItemFocusIndicatorHelper> ALPHA = new FloatProperty<ItemFocusIndicatorHelper>("alpha") { @Override public void setValue(ItemFocusIndicatorHelper object, float value) { object.setAlpha(value); } @Override public Float get(ItemFocusIndicatorHelper object) { return object.mAlpha; } }; public static final FloatProperty<ItemFocusIndicatorHelper> SHIFT = new FloatProperty<ItemFocusIndicatorHelper>("shift") { @Override public void setValue(ItemFocusIndicatorHelper object, float value) { object.mShift = value; } @Override public Float get(ItemFocusIndicatorHelper object) { return object.mShift; } }; private static final RectEvaluator RECT_EVALUATOR = new RectEvaluator(new Rect()); private static final Rect sTempRect1 = new Rect(); private static final Rect sTempRect2 = new Rect(); private final View mContainer; protected final Paint mPaint; private final int mMaxAlpha; private final Rect mDirtyRect = new Rect(); private boolean mIsDirty = false; private T mLastFocusedItem; private T mCurrentItem; private T mTargetItem; /** * The fraction indicating the position of the focusRect between {@link #mCurrentItem} * & {@link #mTargetItem} */ private float mShift; private ObjectAnimator mCurrentAnimation; private float mAlpha; private float mRadius; public ItemFocusIndicatorHelper(View container, int color) { mContainer = container; mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mMaxAlpha = Color.alpha(color); mPaint.setColor(0xFF000000 | color); setAlpha(0); mShift = 0; if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { mRadius = Themes.getDialogCornerRadius(container.getContext()); } } protected void setAlpha(float alpha) { mAlpha = alpha; mPaint.setAlpha((int) (mAlpha * mMaxAlpha)); } @Override public void onAnimationUpdate(ValueAnimator animation) { invalidateDirty(); } protected void invalidateDirty() { if (mIsDirty) { mContainer.invalidate(mDirtyRect); mIsDirty = false; } Rect newRect = getDrawRect(); if (newRect != null) { mContainer.invalidate(newRect); } } /** * Draws the indicator on the canvas */ public void draw(Canvas c) { if (mAlpha <= 0) return; Rect newRect = getDrawRect(); if (newRect != null) { mDirtyRect.set(newRect); c.drawRoundRect((float) mDirtyRect.left, (float) mDirtyRect.top, (float) mDirtyRect.right, (float) mDirtyRect.bottom, mRadius, mRadius, mPaint); mIsDirty = true; } } private Rect getDrawRect() { if (mCurrentItem != null && shouldDraw(mCurrentItem)) { viewToRect(mCurrentItem, sTempRect1); if (mShift > 0 && mTargetItem != null) { viewToRect(mTargetItem, sTempRect2); return RECT_EVALUATOR.evaluate(mShift, sTempRect1, sTempRect2); } else { return sTempRect1; } } return null; } /** * Returns true if the provided item is valid */ protected boolean shouldDraw(T item) { return true; } protected void changeFocus(T item, boolean hasFocus) { if (hasFocus) { endCurrentAnimation(); if (mAlpha > MIN_VISIBLE_ALPHA) { mTargetItem = item; mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofFloat(ALPHA, 1), PropertyValuesHolder.ofFloat(SHIFT, 1)); mCurrentAnimation.addListener(new ViewSetListener(item, true)); } else { setCurrentItem(item); mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofFloat(ALPHA, 1)); } mLastFocusedItem = item; } else { if (mLastFocusedItem == item) { mLastFocusedItem = null; endCurrentAnimation(); mCurrentAnimation = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofFloat(ALPHA, 0)); mCurrentAnimation.addListener(new ViewSetListener(null, false)); } } // invalidate once invalidateDirty(); mLastFocusedItem = hasFocus ? item : null; if (mCurrentAnimation != null) { mCurrentAnimation.addUpdateListener(this); mCurrentAnimation.setDuration(ANIM_DURATION).start(); } } protected void endCurrentAnimation() { if (mCurrentAnimation != null) { mCurrentAnimation.cancel(); mCurrentAnimation = null; } } protected void setCurrentItem(T item) { mCurrentItem = item; mShift = 0; mTargetItem = null; } /** * Gets the position of the item relative to {@link #mContainer}. */ public abstract void viewToRect(T item, Rect outRect); private class ViewSetListener extends AnimatorListenerAdapter { private final T mItemToSet; private final boolean mCallOnCancel; private boolean mCalled = false; ViewSetListener(T item, boolean callOnCancel) { mItemToSet = item; mCallOnCancel = callOnCancel; } @Override public void onAnimationCancel(Animator animation) { if (!mCallOnCancel) { mCalled = true; } } @Override public void onAnimationEnd(Animator animation) { if (!mCalled) { setCurrentItem(mItemToSet); mCalled = true; } } } }
3,382
1,056
<filename>ide/image/src/org/netbeans/modules/image/ZoomOutAction.java /* * 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.image; import org.openide.awt.ActionID; import org.openide.awt.ActionRegistration; import org.openide.util.actions.CallableSystemAction; import org.openide.util.HelpCtx; import org.openide.windows.TopComponent; import org.openide.util.NbBundle; /** * Action which zooms out of an image. * * @author <NAME> */ @ActionID(id = "org.netbeans.modules.image.ZoomOutAction", category = "View") @ActionRegistration(lazy = false, displayName = "#LBL_ZoomOut") public class ZoomOutAction extends CallableSystemAction { /** Generated serial version UID. */ static final long serialVersionUID = 1859897546585041051L; /** Peforms action. */ public void performAction() { TopComponent curComponent = TopComponent.getRegistry().getActivated(); if(curComponent instanceof ImageViewer) ((ImageViewer) curComponent).zoomOut(); } /** Gets name of action. Implements superclass abstract method. */ public String getName() { return NbBundle.getBundle(ZoomOutAction.class).getString("LBL_ZoomOut"); } /** Gets help context for action. Implements superclass abstract method. */ public org.openide.util.HelpCtx getHelpCtx() { return HelpCtx.DEFAULT_HELP; } /** Overrides superclass method. */ public boolean isEnabled() { return true; } /** Gets icon resource. Overrides superclass method. */ protected String iconResource() { return "org/netbeans/modules/image/zoomOut.gif"; // NOI18N } @Override protected boolean asynchronous() { return false; } }
813
424
import os import sys import time import siliconcompiler # Setting up the experiment def main(): rootdir = os.path.dirname(__file__) target = "skywater130_demo" jobname = 'job0' examples = [{'heartbeat' : 1000}, {'picorv32' : 1000}, {'aes' : 1500}] results = {} for item in examples: design = list(item.keys())[0] size = list(item.values())[0] parent = os.path.abspath("..") rootdir = os.path.join(parent, design) results[design] = {} for n in ['1','2','4','8','16']: wall_start = time.time() chip = siliconcompiler.Chip(design) chip.set('jobname', f"job{n}") chip.load_target('skywater130_demo') chip.set('relax', True) chip.set('quiet', True) chip.set('remote',False) # load dsign chip.add('source', os.path.join(rootdir, f"{design}.v")) chip.add('constraint', os.path.join(rootdir, f"{design}.sdc")) chip.set('asic', 'diearea', [(0,0), (size,size)]) chip.set('asic', 'corearea', [(10,10), (size-10,size-10)]) # load flow chip.set('flowarg', 'syn_np', n) chip.set('flowarg', 'place_np', n) chip.set('flowarg', 'cts_np', n) chip.load_flow('asicflow') chip.set('flow', 'asicflow') # Set router to 1 thread to not interfere with measurement for i in range(int(n)): chip.set('eda','openroad','threads', 'route',str(i),1) #RUN chip.run() #OBSERVE/RECORD chip.summary() wall_end = time.time() walltime = round((wall_end - wall_start),2) results[design][n] = walltime with open(f"results.txt", 'w') as f: f.write(results) if __name__ == '__main__': main()
1,003
607
package dev.cheerfun.pixivic.biz.web.app.repository; import dev.cheerfun.pixivic.biz.web.app.po.ExternalLink; import org.springframework.data.jpa.repository.JpaRepository; public interface ExternalLinkRepository extends JpaRepository<ExternalLink, Integer> { }
89
2,748
/* * 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 com.alipay.sofa.tracer.boot.resttemplate; import com.alipay.sofa.tracer.boot.base.AbstractTestCloudBase; import com.sofa.alipay.tracer.plugins.rest.RestTemplateLogEnum; import org.apache.commons.io.FileUtils; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignAutoConfiguration; import org.springframework.context.annotation.Import; import org.springframework.test.context.ActiveProfiles; import org.springframework.web.client.RestTemplate; import java.io.File; import java.io.IOException; import java.util.List; /** * @author guolei.sgl (<EMAIL>) 2019/9/12 12:52 AM **/ @ActiveProfiles("ribbon") @Import({ FeignAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class }) @EnableFeignClients public class TestRestTemplateRibbon extends AbstractTestCloudBase { @Autowired private RestTemplate restTemplate; @Test public void testRestTemplate() throws IOException, InterruptedException { Assert.assertTrue(restTemplate.getInterceptors().size() >= 1); // test for connect error try { restTemplate.getForObject("http://localhost:1234", String.class); } catch (Throwable t) { Assert.assertTrue(t != null); } finally { Thread.sleep(500); //wait for async output List<String> contents = FileUtils.readLines(new File( logDirectoryPath + File.separator + RestTemplateLogEnum.REST_TEMPLATE_DIGEST.getDefaultLogName())); Assert.assertTrue(contents.size() == 1); Assert.assertTrue(contents.get(0).contains("Connection refused")); } String re = restTemplate.getForObject("http://localhost:8890/feign", String.class); Assert.assertTrue(re.equalsIgnoreCase("feign")); Thread.sleep(500); //wait for async output List<String> contents = FileUtils.readLines(new File( logDirectoryPath + File.separator + RestTemplateLogEnum.REST_TEMPLATE_DIGEST.getDefaultLogName())); Assert.assertTrue(contents.size() == 2); } }
1,102
1,573
// Copyright (c) 2019 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_TEST_LCG_H #define BITCOIN_TEST_LCG_H #include <cstdint> // Simple 32-bit linear congruential generator with 64-bit internal state, // often called as "MMIX by Donald Knuth". Knuth attributes the multiplier // to <NAME> and the increment is not crucial (it only need be odd). // <NAME> (1997). Seminumerical Algorithms Vol2. Sec 3.3.4. 3rd Ed. // // Low bits have short period, hence we use high bits which should have // the same period as the entire generator (2^64). class MMIXLinearCongruentialGenerator { uint64_t state; public: MMIXLinearCongruentialGenerator(uint64_t initialstate = 0) : state(initialstate) {} // pseudorandom, except the first value returned is the seed provided // (thus starting with 0, by default) uint32_t next() { uint32_t ret = state >> 32; state = state * 6364136223846793005 + 1442695040888963407; return ret; } }; #endif // BITCOIN_TEST_LCG_H
395
1,682
/* Copyright (c) 2018 LinkedIn Corp. 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.linkedin.r2.transport.common.bridge.common; import java.util.HashMap; import java.util.Map; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTransportResponseImpl { private static final Throwable THROWABLE = new Throwable(); private static final Map<String, String> CASE_SENSITIVE_WIRE_ATTRIBUTES = new HashMap<>(); private static final Object RESPONSE = new Object(); @Test public void testSuccessResponse() { doTestSuccessResponse(TransportResponseImpl.success(RESPONSE)); doTestSuccessResponse(TransportResponseImpl.success(RESPONSE, CASE_SENSITIVE_WIRE_ATTRIBUTES)); } @Test public void testErrorResponse() { doTestErrorResponse(TransportResponseImpl.error(THROWABLE)); doTestErrorResponse(TransportResponseImpl.error(THROWABLE, CASE_SENSITIVE_WIRE_ATTRIBUTES)); } @Test public void testWireAttributeCaseInsensitivity() { doTestCaseInsensitivity(TransportResponseImpl.error(THROWABLE)); doTestCaseInsensitivity(TransportResponseImpl.error(THROWABLE, CASE_SENSITIVE_WIRE_ATTRIBUTES)); doTestCaseInsensitivity(TransportResponseImpl.success(RESPONSE)); doTestCaseInsensitivity(TransportResponseImpl.success(RESPONSE, CASE_SENSITIVE_WIRE_ATTRIBUTES)); } /** * Helper method that verifies the behavior of a successful {@link TransportResponseImpl}. * @param response {@link TransportResponseImpl} to test */ public void doTestSuccessResponse(TransportResponse<Object> response) { assertNotNull(response); assertFalse(response.hasError()); assertSame(response.getResponse(), RESPONSE); assertNull(response.getError()); assertNotNull(response.getWireAttributes()); } /** * Helper method that verifies the behavior of a erroneous {@link TransportResponseImpl}. * @param response {@link TransportResponseImpl} to test */ public void doTestErrorResponse(TransportResponse<Object> response) { assertNotNull(response); assertTrue(response.hasError()); assertNull(response.getResponse()); assertSame(response.getError(), THROWABLE); assertNotNull(response.getWireAttributes()); } /** * Helper method that verifies the wire attributes implementation in a {@link TransportResponseImpl} * is case-insensitive. Asserts if the implementation is not case insensitive. * @param response {@link TransportResponseImpl} to test */ private static void doTestCaseInsensitivity(TransportResponse<Object> response) { Map<String, String> attrs = response.getWireAttributes(); attrs.put("key", "value"); attrs.put("KEY", "value"); assertEquals(attrs.size(), 1); assertTrue(attrs.containsKey("KEY")); assertTrue(attrs.containsKey("Key")); attrs.remove("KEY"); assertEquals(attrs.size(), 0); } }
1,068
843
# Generated by Django 3.2.6 on 2021-09-03 08:50 from django.db import migrations def rm_import_waffle_switch(apps, schema_editor): Switch = apps.get_model('waffle', 'Switch') # drop the waffle switch blocklist_auto_import to avoid confusion Switch.objects.filter(name='blocklist_auto_import').delete() class Migration(migrations.Migration): dependencies = [ ('blocklist', '0023_auto_20201103_1108'), ] operations = [ migrations.DeleteModel( name='LegacyImport', ), migrations.RunPython(rm_import_waffle_switch), ]
231
2,059
/******************************************************************* * File automatically generated by rebuild_wrappers.py (v2.0.0.10) * *******************************************************************/ #ifndef __wrappedlibxcbdri2UNDEFS_H_ #define __wrappedlibxcbdri2UNDEFS_H_ #undef xFEpuu #endif // __wrappedlibxcbdri2UNDEFS_H_
97
1,124
from scipy.io.wavfile import read as wavread import numpy as np import tensorflow as tf import sys def decode_audio(fp, fs=None, num_channels=1, normalize=False, fast_wav=False): """Decodes audio file paths into 32-bit floating point vectors. Args: fp: Audio file path. fs: If specified, resamples decoded audio to this rate. mono: If true, averages channels to mono. fast_wav: Assume fp is a standard WAV file (PCM 16-bit or float 32-bit). Returns: A np.float32 array containing the audio samples at specified sample rate. """ if fast_wav: # Read with scipy wavread (fast). _fs, _wav = wavread(fp) if fs is not None and fs != _fs: raise NotImplementedError('Scipy cannot resample audio.') if _wav.dtype == np.int16: _wav = _wav.astype(np.float32) _wav /= 32768. elif _wav.dtype == np.float32: _wav = np.copy(_wav) else: raise NotImplementedError('Scipy cannot process atypical WAV files.') else: # Decode with librosa load (slow but supports file formats like mp3). import librosa _wav, _fs = librosa.core.load(fp, sr=fs, mono=False) if _wav.ndim == 2: _wav = np.swapaxes(_wav, 0, 1) assert _wav.dtype == np.float32 # At this point, _wav is np.float32 either [nsamps,] or [nsamps, nch]. # We want [nsamps, 1, nch] to mimic 2D shape of spectral feats. if _wav.ndim == 1: nsamps = _wav.shape[0] nch = 1 else: nsamps, nch = _wav.shape _wav = np.reshape(_wav, [nsamps, 1, nch]) # Average (mono) or expand (stereo) channels if nch != num_channels: if num_channels == 1: _wav = np.mean(_wav, 2, keepdims=True) elif nch == 1 and num_channels == 2: _wav = np.concatenate([_wav, _wav], axis=2) else: raise ValueError('Number of audio channels not equal to num specified') if normalize: factor = np.max(np.abs(_wav)) if factor > 0: _wav /= factor return _wav def decode_extract_and_batch( fps, batch_size, slice_len, decode_fs, decode_num_channels, decode_normalize=True, decode_fast_wav=False, decode_parallel_calls=1, slice_randomize_offset=False, slice_first_only=False, slice_overlap_ratio=0, slice_pad_end=False, repeat=False, shuffle=False, shuffle_buffer_size=None, prefetch_size=None, prefetch_gpu_num=None): """Decodes audio file paths into mini-batches of samples. Args: fps: List of audio file paths. batch_size: Number of items in the batch. slice_len: Length of the sliceuences in samples or feature timesteps. decode_fs: (Re-)sample rate for decoded audio files. decode_num_channels: Number of channels for decoded audio files. decode_normalize: If false, do not normalize audio waveforms. decode_fast_wav: If true, uses scipy to decode standard wav files. decode_parallel_calls: Number of parallel decoding threads. slice_randomize_offset: If true, randomize starting position for slice. slice_first_only: If true, only use first slice from each audio file. slice_overlap_ratio: Ratio of overlap between adjacent slices. slice_pad_end: If true, allows zero-padded examples from the end of each audio file. repeat: If true (for training), continuously iterate through the dataset. shuffle: If true (for training), buffer and shuffle the sliceuences. shuffle_buffer_size: Number of examples to queue up before grabbing a batch. prefetch_size: Number of examples to prefetch from the queue. prefetch_gpu_num: If specified, prefetch examples to GPU. Returns: A tuple of np.float32 tensors representing audio waveforms. audio: [batch_size, slice_len, 1, nch] """ # Create dataset of filepaths dataset = tf.data.Dataset.from_tensor_slices(fps) # Shuffle all filepaths every epoch if shuffle: dataset = dataset.shuffle(buffer_size=len(fps)) # Repeat if repeat: dataset = dataset.repeat() def _decode_audio_shaped(fp): _decode_audio_closure = lambda _fp: decode_audio( _fp, fs=decode_fs, num_channels=decode_num_channels, normalize=decode_normalize, fast_wav=decode_fast_wav) audio = tf.py_func( _decode_audio_closure, [fp], tf.float32, stateful=False) audio.set_shape([None, 1, decode_num_channels]) return audio # Decode audio dataset = dataset.map( _decode_audio_shaped, num_parallel_calls=decode_parallel_calls) # Parallel def _slice(audio): # Calculate hop size if slice_overlap_ratio < 0: raise ValueError('Overlap ratio must be greater than 0') slice_hop = int(round(slice_len * (1. - slice_overlap_ratio)) + 1e-4) if slice_hop < 1: raise ValueError('Overlap ratio too high') # Randomize starting phase: if slice_randomize_offset: start = tf.random_uniform([], maxval=slice_len, dtype=tf.int32) audio = audio[start:] # Extract sliceuences audio_slices = tf.contrib.signal.frame( audio, slice_len, slice_hop, pad_end=slice_pad_end, pad_value=0, axis=0) # Only use first slice if requested if slice_first_only: audio_slices = audio_slices[:1] return audio_slices def _slice_dataset_wrapper(audio): audio_slices = _slice(audio) return tf.data.Dataset.from_tensor_slices(audio_slices) # Extract parallel sliceuences from both audio and features dataset = dataset.flat_map(_slice_dataset_wrapper) # Shuffle examples if shuffle: dataset = dataset.shuffle(buffer_size=shuffle_buffer_size) # Make batches dataset = dataset.batch(batch_size, drop_remainder=True) # Prefetch a number of batches if prefetch_size is not None: dataset = dataset.prefetch(prefetch_size) if prefetch_gpu_num is not None and prefetch_gpu_num >= 0: dataset = dataset.apply( tf.data.experimental.prefetch_to_device( '/device:GPU:{}'.format(prefetch_gpu_num))) # Get tensors iterator = dataset.make_one_shot_iterator() return iterator.get_next()
2,368
758
<reponame>Amanda-Barbara/nvcaffe #ifndef CAFFE_CUDNN_POOLING_LAYER_HPP_ #define CAFFE_CUDNN_POOLING_LAYER_HPP_ #include <vector> #include "caffe/blob.hpp" #include "caffe/layer.hpp" #include "caffe/proto/caffe.pb.h" #include "caffe/layers/pooling_layer.hpp" namespace caffe { #ifdef USE_CUDNN /** * @brief cuDNN implementation of PoolingLayer. * Fallback to PoolingLayer for CPU mode. */ template <typename Ftype, typename Btype> class CuDNNPoolingLayer : public PoolingLayer<Ftype, Btype> { public: explicit CuDNNPoolingLayer(const LayerParameter& param) : PoolingLayer<Ftype, Btype>(param), handles_setup_(false) {} virtual void LayerSetUp(const vector<Blob*>& bottom, const vector<Blob*>& top); virtual void Reshape(const vector<Blob*>& bottom, const vector<Blob*>& top); virtual ~CuDNNPoolingLayer(); // Currently, cuDNN does not support the extra top blob. virtual inline int MinTopBlobs() const { return -1; } virtual inline int ExactNumTopBlobs() const { return 1; } protected: virtual void Forward_gpu(const vector<Blob*>& bottom, const vector<Blob*>& top); virtual void Backward_gpu(const vector<Blob*>& top, const vector<bool>& propagate_down, const vector<Blob*>& bottom); bool handles_setup_; cudnnHandle_t handle_; cudnnTensorDescriptor_t fwd_bottom_desc_, fwd_top_desc_; cudnnTensorDescriptor_t bwd_bottom_desc_, bwd_top_desc_; cudnnPoolingDescriptor_t pooling_desc_; cudnnPoolingMode_t mode_; // private top blobs to workaround the inplace max pooling issue // for more, see: https://github.com/BVLC/caffe/issues/2015 // https://github.com/BVLC/caffe/issues/2688 // https://github.com/BVLC/caffe/pull/3574 vector<shared_ptr<Blob> > private_top_; }; #endif } // namespace caffe #endif // CAFFE_CUDNN_POOLING_LAYER_HPP_
769
575
<filename>remoting/host/backoff_timer.cc // Copyright 2015 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 "remoting/host/backoff_timer.h" #include "base/bind.h" #include <memory> #include <utility> namespace remoting { BackoffTimer::BackoffTimer() : timer_(new base::OneShotTimer()) {} BackoffTimer::~BackoffTimer() = default; void BackoffTimer::Start(const base::Location& posted_from, base::TimeDelta delay, base::TimeDelta max_delay, const base::RepeatingClosure& user_task) { backoff_policy_.multiply_factor = 2; backoff_policy_.initial_delay_ms = delay.InMilliseconds(); backoff_policy_.maximum_backoff_ms = max_delay.InMilliseconds(); backoff_policy_.entry_lifetime_ms = -1; backoff_entry_ = std::make_unique<net::BackoffEntry>(&backoff_policy_); posted_from_ = posted_from; user_task_ = user_task; StartTimer(); } void BackoffTimer::Stop() { timer_->Stop(); user_task_.Reset(); backoff_entry_.reset(); } void BackoffTimer::SetTimerForTest(std::unique_ptr<base::OneShotTimer> timer) { timer_ = std::move(timer); } void BackoffTimer::StartTimer() { timer_->Start( posted_from_, backoff_entry_->GetTimeUntilRelease(), base::BindOnce(&BackoffTimer::OnTimerFired, base::Unretained(this))); } void BackoffTimer::OnTimerFired() { DCHECK(IsRunning()); DCHECK(!user_task_.is_null()); backoff_entry_->InformOfRequest(false); StartTimer(); // Running the user task may destroy this object, so don't reference // any fields of this object after running it. base::RepeatingClosure user_task(user_task_); user_task.Run(); } } // namespace remoting
654
945
<gh_stars>100-1000 // This is core/vnl/algo/vnl_solve_qp.h #ifndef vnl_solve_qp_h_ #define vnl_solve_qp_h_ //: // \file // \brief Functions to solve various forms of constrained quadratic programming // \author <NAME> #include <vnl/vnl_vector.h> #include <vnl/vnl_matrix.h> #include <vnl/algo/vnl_algo_export.h> //: Solve quadratic programming problem with linear constraints // Minimise F(x)=0.5x'Hx + g'x subject to Ax=b // \param H Hessian of F(x) - must be symmetric // \retval True if successful bool vnl_solve_qp_with_equality_constraints(const vnl_matrix<double>& H, const vnl_vector<double>& g, const vnl_matrix<double>& A, const vnl_vector<double>& b, vnl_vector<double>& x); //: Solve quadratic programming problem with constraint sum(x)=0 // Minimise F(x)=0.5x'Hx + g'x subject to sum(x)=0 // Special case of quadratic programming (Equality constraint: x.1=0) // \param H Hessian of F(x) - must be symmetric // \retval True if successful bool vnl_solve_qp_zero_sum(const vnl_matrix<double>& H, const vnl_vector<double>& g, vnl_vector<double>& x); //: Find non-negative solution to a constrained quadratic programming problem // Minimise F(x)=0.5x'Hx + g'x subject to Ax=b and x(i)>=0 for all i // // Uses a variant of the active set strategy to solve the problem. // This performs a sequence of unconstrained solutions. If the inequality // constraints are violated, the most violated x(i) is set to zero // and a slightly smaller problem is solved. // \param H Hessian of F(x) - must be symmetric // \param x On input, it must satisfy all constraints (Ax=b, x(i)>=0) // \param con_tol Tolerance for testing constraints: |Ax-b|^2<con_tol // \param verbose When true, output error messages to cerr if failed // \retval True if successful bool VNL_ALGO_EXPORT vnl_solve_qp_with_non_neg_constraints(const vnl_matrix<double>& H, const vnl_vector<double>& g, const vnl_matrix<double>& A, const vnl_vector<double>& b, vnl_vector<double>& x, double con_tol = 1e-8, bool verbose=true); //: Find non-negative solution to a constrained quadratic programming problem // Minimise F(x)=0.5x'Hx + g'x subject to sum(x)=1 and x(i)>=0 for all i // // Uses a variant of the active set strategy to solve the problem. // This performs a sequence of unconstrained solutions. If the inequality // constraints are violated, the most violated x(i) is set to zero // and a slightly smaller problem is solved. // \param H Hessian of F(x) - must be symmetric // \param x On input, it must satisfy all constraints (sum(x)=1, x(i)>=0) // \param verbose When true, output error messages to cerr if failed // \retval True if successful bool VNL_ALGO_EXPORT vnl_solve_qp_non_neg_sum_one(const vnl_matrix<double>& H, const vnl_vector<double>& g, vnl_vector<double>& x, bool verbose=true); #endif // vnl_solve_qp_h_
1,619
335
<filename>examples/32_lora_wan/main/main.cpp #include <lmic.h> #include <hal/hal.h> #include <SPI.h> #include <U8x8lib.h> #define BUILTIN_LED 25 #define SCK 5 // GPIO5 -- SX127x's SCK #define MISO 19 // GPIO19 -- SX127x's MISO #define MOSI 27 // GPIO27 -- SX127x's MOSI #define SS 18 // GPIO18 -- SX127x's CS #define RST 14 // GPIO14 -- SX127x's RESET #define DI0 26 // GPIO26 -- SX127x's IRQ(Interrupt Request) //OLED pins to ESP32 GPIOs via this connecthin: //OLED_SDA — GPIO4 //OLED_SCL — GPIO15 //OLED_RST — GPIO16 // the OLED used U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16); // On the things network you must set Activation Method = ABP // Over-the-Air Activation (OTAA) /* https://www.thethingsnetwork.org/wiki/LoRaWAN/Home Over-the-Air Activation (OTAA) is the preferred and most secure way to connect with The Things Network. Devices perform a join-procedure with the network, during which a dynamic DevAddr is assigned and security keys are negotiated with the device. Activation by Personalization (ABP) In some cases you might need to hardcode the DevAddr as well as the security keys in the device. This means activating a device by personalization (ABP). This strategy might seem simpler, because you skip the join procedure, but it has some downsides related to security. */ //const char *devAddr = "26011526"; //const char *nwkSKey = "E5A9FE42754C83DBE8BF856B46C7EA0F"; //const char *appSKey = "673AE574F2A55DC5007F7AA575DD756A"; // These callbacks are only used in over-the-air activation, // Also consider using // DISABLE_JOIN in config.h, otherwise the linker will complain). // This EUI must be in little-endian format, so least-significant-byte // first. When copying an EUI from ttnctl output, this means to reverse // the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3, 0x70. 70B3D57E D00085BE static const u1_t PROGMEM APPEUI[8] = { 0xBE, 0x85, 0x00, 0xD0, 0x7E, 0xD5, 0xB3, 0x70 }; void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8); } // 1234567812345678 // This should also be in little endian format, see above. //static const u1_t PROGMEM DEVEUI[8] = { 0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12 }; // 0x0780560340120780 u1_t PROGMEM DEVEUI[8] = { 0x80,0x07, 0x12,0x40,0x03,0x56,0x80,0x07 }; void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8); } //static const u4_t DEVADDR = 0x00012345 ; // <-- Change this address for every node! static const u4_t DEVADDR = 0x26011526 ; // <-- Change this address for every node! // This key should be in big endian format (or, since it is not really a // number but a block of memory, endianness does not really apply). In // practice, a key taken from ttnctl can be copied as-is. // <KEY> // The key shown here is the semtech default key. <KEY> //static const u1_t PROGMEM APPKEY[16] = { 0xC3, 0xC3, 0x64, 0x80, 0x98, 0xF7, 0x3E, 0x58, 0xAA, 0xA7, 0x26, 0x0B, 0x8B, 0xD5, 0x51, 0x28 }; //673AE574F2A55DC5007F7AA575DD756A static const u1_t PROGMEM APPKEY[16] = { 0x67 , 0x3A , 0xE5 , 0x74 , 0xF2, 0xA5, 0x5D, 0xC5, 0x00, 0x7F, 0x7A, 0xA5, 0x75, 0xDD, 0x75, 0x6A }; void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16); } // This is the default Semtech key, which is used by the early prototype TTN network. // static const PROGMEM u1_t NWKSKEY[16] = { 0xAA, 0xCE, 0x88, 0x69, 0x05, 0xC6, 0xCE, 0xEF, 0x33, 0xF4, 0x76, 0xDC, 0xDC, 0x77, 0x67, 0x9F }; static const u1_t NWKSKEY[16] = { <KEY> }; static uint8_t mydata[] = "Hi"; static osjob_t sendjob; void do_send(osjob_t* j); // Schedule TX every this many seconds (might become longer due to duty // cycle limitations). const unsigned TX_INTERVAL = 30; // Pin mapping const lmic_pinmap lmic_pins = { .nss = 18, .rxtx = LMIC_UNUSED_PIN, .rst = 14, .dio = {26, 33 /* or 26 again.. 33*/,32 /*32*/}, }; //SX1276 (pin) – ESP32 (pin) //DIO0 (8) – GPIO26 (15) //DIO1 (9) – GPIO33 (13) //DIO2 (10) – GPIO32 (12) void onEvent (ev_t ev) { Serial.print(os_getTime()); u8x8.setCursor(0, 5); u8x8.printf("TIME %u", os_getTime()); Serial.print(": "); u8x8.clearLine(7); switch (ev) { case EV_SCAN_TIMEOUT: Serial.println(F("EV_SCAN_TIMEOUT")); u8x8.drawString(0, 7, "EV_SCAN_TIMEOUT"); break; case EV_BEACON_FOUND: Serial.println(F("EV_BEACON_FOUND")); u8x8.drawString(0, 7, "EV_BEACON_FOUND"); break; case EV_BEACON_MISSED: Serial.println(F("EV_BEACON_MISSED")); u8x8.drawString(0, 7, "EV_BEACON_MISSED"); break; case EV_BEACON_TRACKED: Serial.println(F("EV_BEACON_TRACKED")); u8x8.drawString(0, 7, "EV_BEACON_TRACKED"); break; case EV_JOINING: Serial.println(F("EV_JOINING")); u8x8.drawString(0, 7, "EV_JOINING"); break; case EV_JOINED: Serial.println(F("EV_JOINED")); u8x8.drawString(0, 7, "EV_JOINED "); // Disable link check validation (automatically enabled // during join, but not supported by TTN at this time). LMIC_setLinkCheckMode(0); break; case EV_RFU1: Serial.println(F("EV_RFU1")); u8x8.drawString(0, 7, "EV_RFUI"); break; case EV_JOIN_FAILED: Serial.println(F("EV_JOIN_FAILED")); u8x8.drawString(0, 7, "EV_JOIN_FAILED"); break; case EV_REJOIN_FAILED: Serial.println(F("EV_REJOIN_FAILED")); u8x8.drawString(0, 7, "EV_REJOIN_FAILED"); //break; break; case EV_TXCOMPLETE: Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)")); u8x8.drawString(0, 7, "EV_TXCOMPLETE"); digitalWrite(BUILTIN_LED, LOW); if (LMIC.txrxFlags & TXRX_ACK) { Serial.println(F("Received ack")); u8x8.drawString(0, 7, "Received ACK"); } if (LMIC.dataLen) { Serial.println(F("Received ")); u8x8.drawString(0, 6, "RX "); Serial.println(LMIC.dataLen); u8x8.setCursor(4, 6); u8x8.printf("%i bytes", LMIC.dataLen); Serial.println(F(" bytes of payload")); u8x8.setCursor(0, 7); u8x8.printf("RSSI %d SNR %.1d", LMIC.rssi, LMIC.snr); } // Schedule next transmission os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(TX_INTERVAL), do_send); break; case EV_LOST_TSYNC: Serial.println(F("EV_LOST_TSYNC")); u8x8.drawString(0, 7, "EV_LOST_TSYNC"); break; case EV_RESET: Serial.println(F("EV_RESET")); u8x8.drawString(0, 7, "EV_RESET"); break; case EV_RXCOMPLETE: // data received in ping slot Serial.println(F("EV_RXCOMPLETE")); u8x8.drawString(0, 7, "EV_RXCOMPLETE"); break; case EV_LINK_DEAD: Serial.println(F("EV_LINK_DEAD")); u8x8.drawString(0, 7, "EV_LINK_DEAD"); break; case EV_LINK_ALIVE: Serial.println(F("EV_LINK_ALIVE")); u8x8.drawString(0, 7, "EV_LINK_ALIVE"); break; default: Serial.println(F("Unknown event")); u8x8.setCursor(0, 7); u8x8.printf("UNKNOWN EVENT %d", ev); break; } } void do_send(osjob_t* j) { // Check if there is not a current TX/RX job running if (LMIC.opmode & OP_TXRXPEND) { Serial.println(F("OP_TXRXPEND, not sending")); u8x8.drawString(0, 7, "OP_TXRXPEND, not sent"); } else { // Prepare upstream data transmission at the next possible time. LMIC_setTxData2(1, mydata, sizeof(mydata) , 0); Serial.println(F("Packet queued")); u8x8.drawString(0, 7, "PACKET QUEUED"); digitalWrite(BUILTIN_LED, HIGH); } // Next TX is scheduled after TX_COMPLETE event. } void setup() { Serial.begin(115200); u8x8.begin(); u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.drawString(0, 1, "LoRaWAN LMiC"); SPI.begin(5, 19, 27); // Also done in, hal_spi_init() // LMIC init os_init(); // Reset the MAC state. Session and pending data transfers will be discarded. LMIC_reset(); #if defined(CFG_eu868) LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band #endif // Disable link check validation LMIC_setLinkCheckMode(0); // TTN uses SF9 for its RX2 window. LMIC.dn2Dr = DR_SF9; LMIC_setSession (0x1, DEVADDR, (u1_t *)NWKSKEY, (u1_t *)APPKEY); LMIC_setDrTxpow(DR_SF7,14); // Start job (sending automatically starts OTAA too) do_send(&sendjob); pinMode(BUILTIN_LED, OUTPUT); digitalWrite(BUILTIN_LED, LOW); digitalWrite(BUILTIN_LED, HIGH); } void loop() { os_runloop_once(); }
3,692
1,173
{ "url": "http://www.lefigaro.fr/conjoncture/2013/04/05/20002-20130405ARTFIG00473-montebourg-envisage-des-privatisations-partielles.php", "target_language": "fr", "expected": { "meta_description": "Selon le ministre du Redressement productif interview\u00e9 par le Wall Street Journal, le gouvernement r\u00e9fl\u00e9chit \u00e0 des changements dans les participations d\u00e9tenues par l'\u00c9tat.", "domain": "www.lefigaro.fr", "final_url": "http://www.lefigaro.fr/conjoncture/2013/04/05/20002-20130405ARTFIG00473-montebourg-envisage-des-privatisations-partielles.php", "meta_keywords": "Actualit\u00e9 \u00e9conomique, entreprises, \u00e9conomie, bourse, emploi, imp\u00f4ts, cac 40, creation d'entreprise, chef d'entreprise, grands patrons, consommation, multinationales, privatisation, d\u00e9localisations, concurrence, monopole, crise, bourse, licenciements, union europ\u00e9enne, etats-unis, chine, pmi, pme, tpe, salaires, relance, pib, pnb, aides sociales, japon, r\u00e9cession, \u00e9conomie verte, fmi, reprise, croissance, news, actu", "cleaned_text": "Selon le ministre du Redressement productif interview\u00e9 par le Wall Street Journal, le gouvernement", "tags": [ "EDF", "Privatisation", "<NAME>", "<NAME>", "Participations de l'Etat", "Entreprises publiques", "AREVA" ], "meta_favicon": "http://www.lefigaro.fr/icones/favicon.ico", "meta_lang": null } }
707
1,073
@import templates_top; template<typename T> class Vector; template<typename T> class Vector; template<typename T> class List; template<> class List<bool> { public: void push_back(int); }; namespace N { template<typename T> class Set; } namespace N { template<typename T> class Set { public: void insert(T); }; } constexpr unsigned List<int>::*size_left = &List<int>::size; List<int> list_left = { 0, 8 }; typedef List<int> ListInt_left; template <typename T> void pendingInstantiationEmit(T) {} void triggerPendingInstantiation() { pendingInstantiationEmit(12); pendingInstantiationEmit(42.); } void redeclDefinitionEmit(){} typedef Outer<int>::Inner OuterIntInner_left; int defineListDoubleLeft() { List<double> ld; ld.push_back(0.0); return ld.size; } template<typename T> struct MergePatternDecl; extern template struct ExplicitInstantiation<false, false>; extern template struct ExplicitInstantiation<false, true>; extern template struct ExplicitInstantiation<true, false>; extern template struct ExplicitInstantiation<true, true>; void useExplicitInstantiation() { ExplicitInstantiation<true, false>().f(); ExplicitInstantiation<true, true>().f(); } template<typename> struct DelayUpdates; template<> struct DelayUpdates<int>; template<typename T> struct DelayUpdates<T*>; template<typename T> void testDelayUpdates(DelayUpdates<T> *p = 0) {} void outOfLineInlineUseLeftF(void (OutOfLineInline<int>::*)() = &OutOfLineInline<int>::f); void outOfLineInlineUseLeftG(void (OutOfLineInline<int>::*)() = &OutOfLineInline<int>::g); void outOfLineInlineUseLeftH(void (OutOfLineInline<int>::*)() = &OutOfLineInline<int>::h); namespace EmitDefaultedSpecialMembers { inline void f() { SmallString<256> SS; }; } inline int *getStaticDataMemberLeft() { return WithUndefinedStaticDataMember<int[]>::undefined; }
649
8,657
<filename>deps/mruby/mrbgems/mruby-socket/test/sockettest.c #include <stdio.h> #include <stdlib.h> #include "mruby.h" #include "mruby/error.h" #if defined(_WIN32) || defined(_WIN64) #include <io.h> #ifdef _MSC_VER #include <fcntl.h> #include <sys/stat.h> #define open _open #define close _close #define unlink _unlink static int mkstemp(char *p) { int fd; char* fname = _mktemp(p); if (fname == NULL) return -1; fd = open(fname, O_RDWR | O_CREAT | O_EXCL, _S_IREAD | _S_IWRITE); if (fd >= 0) return fd; return -1; } #endif #else #include <unistd.h> #endif mrb_value mrb_sockettest_tmppath(mrb_state *mrb, mrb_value klass) { char name[] = "mruby-socket.XXXXXXXX"; int fd = mkstemp(name); if (fd == -1) { mrb_sys_fail(mrb, 0); } if (close(fd) == -1) { mrb_sys_fail(mrb, 0); } if (unlink(name) == -1) { mrb_sys_fail(mrb, 0); } return mrb_str_new_cstr(mrb, name); } mrb_value mrb_sockettest_win_p(mrb_state *mrb, mrb_value klass) { #ifdef _WIN32 return mrb_true_value(); #else return mrb_false_value(); #endif } mrb_value mrb_sockettest_cygwin_p(mrb_state *mrb, mrb_value klass) { #if defined(__CYGWIN__) || defined(__CYGWIN32__) return mrb_true_value(); #else return mrb_false_value(); #endif } void mrb_mruby_socket_gem_test(mrb_state* mrb) { struct RClass *c = mrb_define_module(mrb, "SocketTest"); mrb_define_class_method(mrb, c, "tmppath", mrb_sockettest_tmppath, MRB_ARGS_NONE()); mrb_define_class_method(mrb, c, "win?", mrb_sockettest_win_p, MRB_ARGS_NONE()); mrb_define_class_method(mrb, c, "cygwin?", mrb_sockettest_cygwin_p, MRB_ARGS_NONE()); }
791
781
<gh_stars>100-1000 //------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- package run.ace; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.ShapeDrawable; //import android.support.v7.app.ActionBar; //import android.support.v7.app.ActionBarActivity; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.util.TypedValue; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import Windows.UI.Xaml.Controls.*; // This derived from android.widget.Toolbar, but (a) that's not needed // and (b) Toolbar is only for Lollipop or later public class TabBar extends android.widget.LinearLayout implements //ActionBar.TabListener, android.app.ActionBar.TabListener, IHaveProperties, IRecieveCollectionChanges { ObservableCollection _primaryCommands; ObservableCollection _secondaryCommands; int barTintColor; int tintColor; boolean overwriteBarTintColor; boolean overwriteTintColor; public TabBar(Context context) { super(context); } public void setTitle(String title, android.app.Activity activity) { //if (!(activity instanceof ActionBarActivity)) { android.app.ActionBar actionBar = activity.getActionBar(); if (actionBar == null) { throw new RuntimeException( "Cannot set title on the main page in Android unless you set <preference name=\"ShowTitle\" value=\"true\"/> in config.xml."); } actionBar.setTitle(title); //} //else { // ActionBar actionBar = ((ActionBarActivity)activity).getSupportActionBar(); // if (actionBar != null) { // actionBar.setTitle(title); // } //} } public void show(android.app.Activity activity) { //if (!(activity instanceof ActionBarActivity)) { android.app.ActionBar mainActionBar = activity.getActionBar(); if (mainActionBar != null) { mainActionBar.show(); mainActionBar.setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_TABS); if (overwriteBarTintColor) { mainActionBar.setStackedBackgroundDrawable( new ColorDrawable(barTintColor) ); mainActionBar.setBackgroundDrawable( new ColorDrawable(barTintColor) ); Window mainWindow = activity.getWindow(); mainWindow.setStatusBarColor(barTintColor); } if (_primaryCommands != null) { for (int i = 0; i < _primaryCommands.size(); i++) { android.app.ActionBar.Tab tab = mainActionBar.newTab(); AppBarButton abb = (AppBarButton)_primaryCommands.get(i); if (abb.icon != null) { tab.setCustomView(getCustomTabView(abb, mainActionBar.getThemedContext())); tab.setTabListener(this); mainActionBar.addTab(tab, i == 0); final View parent = (View) tab.getCustomView().getParent(); parent.setPadding(0, 0, 0, 0); } else { tab.setText(abb.label); tab.setTabListener(this); mainActionBar.addTab(tab, i == 0); } } } return; } throw new RuntimeException( "Cannot use TabBar on the main page in Android unless you set <preference name=\"ShowTitle\" value=\"true\"/> in config.xml."); //} //else { // ActionBar actionBar = ((ActionBarActivity)activity).getSupportActionBar(); // if (actionBar != null) { // actionBar.show(); // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // for (int i = 0; i < _primaryCommands.size(); i++) { // ActionBar.Tab tab = actionBar.newTab(); // AppBarButton abb = (AppBarButton)_primaryCommands.get(i); // if (abb.icon != null) { // tab.setCustomView(getCustomTabView(abb, actionBar.getThemedContext())); // } // else { // tab.setText(abb.label); // } // tab.setTabListener(this); // actionBar.addTab(tab); // } // return; // } // throw new RuntimeException( // "Unable to get TabBar from the current activity."); //} } public static void remove(android.app.Activity activity) { //if (!(activity instanceof ActionBarActivity)) { android.app.ActionBar mainActionBar = activity.getActionBar(); if (mainActionBar != null) { mainActionBar.hide(); mainActionBar.setTitle(null); mainActionBar.removeAllTabs(); return; } //} //else { // ActionBar actionBar = ((ActionBarActivity)activity).getSupportActionBar(); // if (actionBar != null) { // actionBar.hide(); // actionBar.setTitle(null); // actionBar.removeAllTabs(); // return; // } //} } View getCustomTabView(AppBarButton abb, Context themedContext) { float scaleFactor = Utils.getScaleFactor(themedContext); final int IMAGEHEIGHT = (int)(17 * scaleFactor); final int TEXTSIZE = 12; final int ICON_ONLY_MARGIN = 12; LinearLayout ll = new LinearLayout(themedContext); LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); llp.gravity = Gravity.CENTER_HORIZONTAL; ll.setLayoutParams(llp); ll.setOrientation(LinearLayout.VERTICAL); ll.setPadding(0, 0, 0, 0); if (overwriteBarTintColor) { ll.setBackgroundColor(barTintColor); } if (abb.icon != null) { ImageView iv = new ImageView(themedContext); if (abb.label != null) { LinearLayout.LayoutParams p = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, IMAGEHEIGHT); p.topMargin = (int)(4 * scaleFactor); p.bottomMargin = (int)(3 * scaleFactor); p.gravity = Gravity.CENTER_HORIZONTAL; iv.setLayoutParams(p); } else { LinearLayout.LayoutParams p = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); p.gravity = Gravity.CENTER_HORIZONTAL; float d = themedContext.getResources().getDisplayMetrics().density; int margin = (int)(ICON_ONLY_MARGIN * d); p.topMargin = margin; p.bottomMargin = margin; iv.setLayoutParams(p); } Bitmap bitmap = Utils.getBitmapAsset(themedContext, abb.icon.toString()); iv.setImageDrawable(new android.graphics.drawable.BitmapDrawable(bitmap)); if (overwriteTintColor) { iv.setColorFilter(tintColor); } ll.addView(iv); } if (abb.label != null) { TextView tv = new TextView(themedContext); LinearLayout.LayoutParams tvp = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); tvp.gravity = Gravity.CENTER_HORIZONTAL; tv.setLayoutParams(tvp); tv.setTypeface(null, Typeface.BOLD); tv.setTextSize(TEXTSIZE); tv.setText(abb.label.toUpperCase()); ll.addView(tv); } return ll; } public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction fragmentTransaction) { if (overwriteBarTintColor && overwriteTintColor) { LinearLayout tabLayout = (LinearLayout) tab.getCustomView(); ShapeDrawable background = new ShapeDrawable(); background.getPaint().setColor(tintColor); ShapeDrawable border = new ShapeDrawable(); border.getPaint().setColor(barTintColor); Drawable[] layers = {background, border}; LayerDrawable layerDrawable = new LayerDrawable(layers); layerDrawable.setLayerInset(0, 0, 0, 0, 0); layerDrawable.setLayerInset(1, 0, 0, 0, 5); tabLayout.setBackgroundDrawable(layerDrawable); tab.setCustomView(tabLayout); } int index = tab.getPosition(); OutgoingMessages.raiseEvent("click", _primaryCommands.get(index), null); } public void onTabUnselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction fragmentTransaction) { if (overwriteBarTintColor) { LinearLayout tabLayout = (LinearLayout) tab.getCustomView(); tabLayout.setBackgroundColor(barTintColor); } } public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction fragmentTransaction) { int index = tab.getPosition(); OutgoingMessages.raiseEvent("click", _primaryCommands.get(index), null); } /* public void onTabSelected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) { int index = tab.getPosition(); OutgoingMessages.raiseEvent("click", _primaryCommands.get(index), null); } public void onTabUnselected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) { } public void onTabReselected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) { int index = tab.getPosition(); OutgoingMessages.raiseEvent("click", _primaryCommands.get(index), null); } */ // IHaveProperties.setProperty public void setProperty(String propertyName, Object propertyValue) { if (propertyName.endsWith(".PrimaryCommands") || propertyName.endsWith(".Children")) { if (propertyValue == null && _primaryCommands != null) { _primaryCommands.removeListener(this); _primaryCommands = null; } else { _primaryCommands = (ObservableCollection)propertyValue; // Listen to collection changes _primaryCommands.addListener(this); } } else if (propertyName.endsWith(".SecondaryCommands") || propertyName.endsWith(".Children")) { if (propertyValue == null && _secondaryCommands != null) { _secondaryCommands.removeListener(this); _secondaryCommands = null; } else { _secondaryCommands = (ObservableCollection)propertyValue; // Listen to collection changes _secondaryCommands.addListener(this); } } else if (propertyName.endsWith(".BarTintColor")) { barTintColor = Color.parseColor((String) propertyValue); overwriteBarTintColor = true; } else if (propertyName.endsWith(".TintColor")) { tintColor = Color.parseColor((String) propertyValue); overwriteTintColor = true; } else if (!ViewGroupHelper.setProperty(this, propertyName, propertyValue)) { throw new RuntimeException("Unhandled property for " + this.getClass().getSimpleName() + ": " + propertyName); } } // IRecieveCollectionChanges.add public void add(Object collection, Object item) { if (collection == _primaryCommands) { // TODO: Update items } else if (collection == _secondaryCommands) { // TODO: Update items } } // IRecieveCollectionChanges.removeAt public void removeAt(Object collection, int index) { if (collection == _primaryCommands) { // TODO: Update items } else if (collection == _secondaryCommands) { // TODO: Update items } } }
5,895
852
import FWCore.ParameterSet.Config as cms from DQMOffline.Trigger.topMonitoring_cfi import topMonitoring mssmHbbMonitoring = topMonitoring.clone() mssmHbbMonitoring.FolderName = cms.string('HLT/HIG/default/') mssmHbbMonitoring.histoPSet.lsPSet = cms.PSet( nbins = cms.uint32 ( 250 ), xmin = cms.double( 0.), xmax = cms.double( 2500.), ) mssmHbbMonitoring.histoPSet.metPSet = cms.PSet( nbins = cms.uint32( 30 ), xmin = cms.double( 0 ), xmax = cms.double( 300 ), ) mssmHbbMonitoring.histoPSet.ptPSet = cms.PSet( nbins = cms.uint32( 100 ), #60 xmin = cms.double( 0 ), xmax = cms.double( 1000 ), #300 ) mssmHbbMonitoring.histoPSet.lsPSet = cms.PSet( nbins = cms.uint32( 2500 ), ) mssmHbbMonitoring.histoPSet.phiPSet = cms.PSet( nbins = cms.uint32( 32 ), xmin = cms.double( -3.2 ), xmax = cms.double( 3.2 ), ) mssmHbbMonitoring.histoPSet.etaPSet = cms.PSet( nbins = cms.uint32( 24 ), xmin = cms.double( -2.4 ), xmax = cms.double( 2.4 ), ) mssmHbbMonitoring.histoPSet.htPSet = cms.PSet( nbins = cms.uint32( 100 ), #60 xmin = cms.double( 0 ), xmax = cms.double( 1000 ), #600 ) mssmHbbMonitoring.histoPSet.csvPSet = cms.PSet( nbins = cms.uint32( 50 ), xmin = cms.double( 0.0 ), xmax = cms.double( 1.0 ), ) mssmHbbMonitoring.histoPSet.DRPSet = cms.PSet( nbins = cms.uint32( 60 ), xmin = cms.double( 0.0 ), xmax = cms.double( 6.0 ), ) mssmHbbMonitoring.applyLeptonPVcuts = False mssmHbbMonitoring.leptonPVcuts = cms.PSet( dxy = cms.double( 9999. ), dz = cms.double( 9999. ), ) mssmHbbMonitoring.histoPSet.invMassPSet = cms.PSet( nbins = cms.uint32( 40 ), xmin = cms.double( 0.0 ), xmax = cms.double( 80.0 ), ) mssmHbbMonitoring.histoPSet.MHTPSet = cms.PSet( nbins = cms.uint32( 80 ), xmin = cms.double( 60 ), xmax = cms.double( 300 ), ) #MET and HT binning mssmHbbMonitoring.histoPSet.metBinning = cms.vdouble(0,20,40,60,80,100,125,150,175,200) mssmHbbMonitoring.histoPSet.HTBinning = cms.vdouble(0,20,40,60,80,100,125,150,175,200,300,400,500,700) #Eta binning mssmHbbMonitoring.histoPSet.eleEtaBinning = cms.vdouble(-2.4,-2.1,-1.5,-0.9,-0.3,0.,0.3,0.9,1.5,2.1,2.4) mssmHbbMonitoring.histoPSet.jetEtaBinning = cms.vdouble(-2.4,-2.1,-1.5,-0.9,-0.3,0.,0.3,0.9,1.5,2.1,2.4) mssmHbbMonitoring.histoPSet.muEtaBinning = cms.vdouble(-2.4,-2.1,-1.5,-0.9,-0.3,0.,0.3,0.9,1.5,2.1,2.4) #pt binning #mssmHbbMonitoring.histoPSet.elePtBinning = cms.vdouble(0,5,10,20,30,40,50,70,100,200,400) #mssmHbbMonitoring.histoPSet.jetPtBinning = cms.vdouble(0,5,10,20,30,40,50,70,100,200,400) #mssmHbbMonitoring.histoPSet.muPtBinning = cms.vdouble(0,5,10,20,30,40,50,70,100,200,400) mssmHbbMonitoring.histoPSet.elePtBinning = cms.vdouble(0,3,5,8,15,20,25,30,40,50,60,80,120,200,400,700) mssmHbbMonitoring.histoPSet.jetPtBinning = cms.vdouble(0,3,5,8,15,20,25,30,40,50,70,100,150,200,400,700,1000,1500) mssmHbbMonitoring.histoPSet.muPtBinning = cms.vdouble(0,3,5,7,10,15,20,30,40,50,70,100,150,200,400,700) #Eta binning 2D mssmHbbMonitoring.histoPSet.eleEtaBinning2D = cms.vdouble(-2.5,-1.5,-0.6,0.,0.6,1.5,2.5) mssmHbbMonitoring.histoPSet.jetEtaBinning2D = cms.vdouble(-2.5,-1.5,-0.6,0.,0.6,1.5,2.5) mssmHbbMonitoring.histoPSet.muEtaBinning2D = cms.vdouble(-2.5,-1.5,-0.6,0.,0.6,1.5,2.5) #pt binning 2D #mssmHbbMonitoring.histoPSet.elePtBinning2D = cms.vdouble(0,20,30,50,100,200,400) #mssmHbbMonitoring.histoPSet.jetPtBinning2D = cms.vdouble(0,20,30,50,100,200,400) #mssmHbbMonitoring.histoPSet.muPtBinning2D = cms.vdouble(0,20,30,50,100,200,400) mssmHbbMonitoring.histoPSet.elePtBinning2D = cms.vdouble(0,15,20,30,40,60,80,100,200,400) mssmHbbMonitoring.histoPSet.jetPtBinning2D = cms.vdouble(0,15,20,30,40,60,80,100,200,400) mssmHbbMonitoring.histoPSet.muPtBinning2D = cms.vdouble(0,15,20,30,40,60,80,100,200,400) #HT and phi binning 2D mssmHbbMonitoring.histoPSet.HTBinning2D = cms.vdouble(0,20,40,70,100,150,200,400,700) mssmHbbMonitoring.histoPSet.phiBinning2D = cms.vdouble(-3.1416,-1.8849,-0.6283,0.6283,1.8849,3.1416) mssmHbbMonitoring.met = cms.InputTag("pfMetEI") # pfMet mssmHbbMonitoring.jets = cms.InputTag("ak4PFJetsCHS") # ak4PFJets, ak4PFJetsCHS, pfJetsEI mssmHbbMonitoring.electrons = cms.InputTag("gedGsfElectrons") # while pfIsolatedElectronsEI are reco::PFCandidate ! mssmHbbMonitoring.muons = cms.InputTag("muons") # while pfIsolatedMuonsEI are reco::PFCandidate ! #Suvankar mssmHbbMonitoring.vertices = cms.InputTag("offlinePrimaryVertices") # Marina mssmHbbMonitoring.btagAlgos = ["pfCombinedSecondaryVertexV2BJetTags"] mssmHbbMonitoring.workingpoint = cms.double(0.92) # tight mssmHbbMonitoring.HTdefinition = cms.string('pt>30 & abs(eta)<2.5') #mssmHbbMonitoring.leptJetDeltaRmin = cms.double(0.4) # MuonJet dRcone #always monitor CSV score for one jet if set DeltaRmin = 0.0 and WP to -1 #mssmHbbMonitoring.nbjets = cms.uint32(1) #mssmHbbMonitoring.bjetSelection = cms.string('pt>30 & abs(eta)<2.4') mssmHbbMonitoring.numGenericTriggerEventPSet.andOr = cms.bool( False ) mssmHbbMonitoring.numGenericTriggerEventPSet.andOrHlt = cms.bool(True)# True:=OR; False:=AND mssmHbbMonitoring.numGenericTriggerEventPSet.hltInputTag = cms.InputTag( "TriggerResults::HLT" ) #change to HLT for PR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! mssmHbbMonitoring.numGenericTriggerEventPSet.errorReplyHlt = cms.bool( False ) mssmHbbMonitoring.numGenericTriggerEventPSet.verbosityLevel = cms.uint32(0) mssmHbbMonitoring.denGenericTriggerEventPSet.andOr = cms.bool( False ) mssmHbbMonitoring.denGenericTriggerEventPSet.andOrHlt = cms.bool(True)# True:=OR; False:=AND mssmHbbMonitoring.denGenericTriggerEventPSet.hltInputTag = cms.InputTag( "TriggerResults::HLT" ) #change to HLT for PR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! mssmHbbMonitoring.denGenericTriggerEventPSet.errorReplyHlt = cms.bool( False ) mssmHbbMonitoring.denGenericTriggerEventPSet.dcsInputTag = cms.InputTag( "scalersRawToDigi" ) mssmHbbMonitoring.denGenericTriggerEventPSet.dcsPartitions = cms.vint32 ( 24, 25, 26, 27, 28, 29 ) # 24-27: strip, 28-29: pixel, we should add all other detectors ! mssmHbbMonitoring.denGenericTriggerEventPSet.andOrDcs = cms.bool( False ) mssmHbbMonitoring.denGenericTriggerEventPSet.errorReplyDcs = cms.bool( True ) mssmHbbMonitoring.denGenericTriggerEventPSet.verbosityLevel = cms.uint32(0)
3,090
778
<gh_stars>100-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.apache.pulsar.proxy.server; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import io.netty.resolver.AddressResolver; import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.SucceededFuture; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.concurrent.ExecutionException; import org.apache.curator.shaded.com.google.common.net.InetAddresses; import org.testng.annotations.Test; public class BrokerProxyValidatorTest { @Test public void shouldAllowValidInput() throws Exception { BrokerProxyValidator brokerProxyValidator = new BrokerProxyValidator( createMockedAddressResolver("1.2.3.4"), "myhost" , "1.2.0.0/16" , "6650"); InetSocketAddress inetSocketAddress = brokerProxyValidator.resolveAndCheckTargetAddress("myhost:6650").get(); assertNotNull(inetSocketAddress); assertEquals(inetSocketAddress.getAddress().getHostAddress(), "1.2.3.4"); assertEquals(inetSocketAddress.getPort(), 6650); } @Test(expectedExceptions = ExecutionException.class, expectedExceptionsMessageRegExp = ".*Given host in 'myhost:6650' isn't allowed.") public void shouldPreventInvalidHostName() throws Exception { BrokerProxyValidator brokerProxyValidator = new BrokerProxyValidator( createMockedAddressResolver("1.2.3.4"), "allowedhost" , "1.2.0.0/16" , "6650"); brokerProxyValidator.resolveAndCheckTargetAddress("myhost:6650").get(); } @Test(expectedExceptions = ExecutionException.class, expectedExceptionsMessageRegExp = ".* The IP address of the given host and port 'myhost:6650' isn't allowed.") public void shouldPreventInvalidIPAddress() throws Exception { BrokerProxyValidator brokerProxyValidator = new BrokerProxyValidator( createMockedAddressResolver("1.2.3.4"), "myhost" , "1.3.0.0/16" , "6650"); brokerProxyValidator.resolveAndCheckTargetAddress("myhost:6650").get(); } @Test public void shouldSupportHostNamePattern() throws Exception { BrokerProxyValidator brokerProxyValidator = new BrokerProxyValidator( createMockedAddressResolver("1.2.3.4"), "*.mydomain" , "1.2.0.0/16" , "6650"); brokerProxyValidator.resolveAndCheckTargetAddress("myhost.mydomain:6650").get(); } @Test public void shouldAllowAllWithWildcard() throws Exception { BrokerProxyValidator brokerProxyValidator = new BrokerProxyValidator( createMockedAddressResolver("1.2.3.4"), "*" , "*" , "6650"); brokerProxyValidator.resolveAndCheckTargetAddress("myhost.mydomain:6650").get(); } @Test public void shouldAllowIPv6Address() throws Exception { BrokerProxyValidator brokerProxyValidator = new BrokerProxyValidator( createMockedAddressResolver("fd4d:801b:73fa:abcd:0000:0000:0000:0001"), "*" , "fd4d:801b:73fa:abcd::/64" , "6650"); brokerProxyValidator.resolveAndCheckTargetAddress("myhost.mydomain:6650").get(); } @Test public void shouldAllowIPv6AddressNumeric() throws Exception { BrokerProxyValidator brokerProxyValidator = new BrokerProxyValidator( createMockedAddressResolver("fd4d:801b:73fa:abcd:0000:0000:0000:0001"), "*" , "fd4d:801b:73fa:abcd::/64" , "6650"); brokerProxyValidator.resolveAndCheckTargetAddress("fd4d:801b:73fa:abcd:0000:0000:0000:0001:6650").get(); } private AddressResolver<InetSocketAddress> createMockedAddressResolver(String ipAddressResult) { AddressResolver<InetSocketAddress> inetSocketAddressResolver = mock(AddressResolver.class); when(inetSocketAddressResolver.resolve(any())).then(invocationOnMock -> { InetSocketAddress address = (InetSocketAddress) invocationOnMock.getArgument(0); return new SucceededFuture<SocketAddress>(mock(EventExecutor.class), new InetSocketAddress(InetAddresses.forString(ipAddressResult), address.getPort())); }); return inetSocketAddressResolver; } }
2,148
12,964
<reponame>udaytejam/Algorithms /** Time Complexity ~O(log(a + b)) */ package com.williamfiset.algorithms.math; public class ExtendedEuclideanAlgorithm { // This function performs the extended euclidean algorithm on two numbers a and b. // The function returns the gcd(a,b) as well as the numbers x and y such // that ax + by = gcd(a,b). This calculation is important in number theory // and can be used for several things such as finding modular inverses and // solutions to linear Diophantine equations. public static long[] egcd(long a, long b) { if (b == 0) return new long[] {a, 1, 0}; else { long[] ret = egcd(b, a % b); long tmp = ret[1] - ret[2] * (a / b); ret[1] = ret[2]; ret[2] = tmp; return ret; } } }
284
2,762
<filename>src/box/sql/vdbetrace.c /* * Copyright 2010-2017, Tarantool AUTHORS, please see AUTHORS file. * * 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. * * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``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 * <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. */ /* * * This file contains code used to insert the values of host parameters * (aka "wildcards") into the SQL text output by sql_trace(). * * The Vdbe parse-tree explainer is also found here. */ #include "sqlInt.h" #include "mem.h" #include "vdbeInt.h" /* * zSql is a zero-terminated string of UTF-8 SQL text. Return the number of * bytes in this text up to but excluding the first character in * a host parameter. If the text contains no host parameters, return * the total number of bytes in the text. */ static int findNextHostParameter(const char *zSql, int *pnToken) { int tokenType; int nTotal = 0; int n; bool unused; *pnToken = 0; while (zSql[0]) { n = sql_token(zSql, &tokenType, &unused); assert(n > 0 && tokenType != TK_ILLEGAL); if (tokenType == TK_VARIABLE) { *pnToken = n; break; } nTotal += n; zSql += n; } return nTotal; } /* * This function returns a pointer to a nul-terminated string in memory * obtained from sqlDbMalloc(). If sql.nVdbeExec is 1, then the * string contains a copy of zRawSql but with host parameters expanded to * their current bindings. Or, if sql.nVdbeExec is greater than 1, * then the returned string holds a copy of zRawSql with "-- " prepended * to each line of text. * * The calling function is responsible for making sure the memory returned * is eventually freed. * * ALGORITHM: Scan the input string looking for host parameters in any of * these forms: ?, ?N, $A, @A, :A. Take care to avoid text within * string literals, quoted identifier names, and comments. For text forms, * the host parameter index is found by scanning the prepared * statement for the corresponding OP_Variable opcode. Once the host * parameter index is known, locate the value in p->aVar[]. Then render * the value as a literal in place of the host parameter name. */ char * sqlVdbeExpandSql(Vdbe * p, /* The prepared statement being evaluated */ const char *zRawSql /* Raw text of the SQL statement */ ) { sql *db; /* The database connection */ int idx = 0; /* Index of a host parameter */ int nextIndex = 1; /* Index of next ? host parameter */ int n; /* Length of a token prefix */ int nToken; /* Length of the parameter token */ StrAccum out; /* Accumulate the output here */ char zBase[100]; /* Initial working space */ db = p->db; sqlStrAccumInit(&out, 0, zBase, sizeof(zBase), db->aLimit[SQL_LIMIT_LENGTH]); if (db->nVdbeExec > 1) { while (*zRawSql) { const char *zStart = zRawSql; while (*(zRawSql++) != '\n' && *zRawSql) ; sqlStrAccumAppend(&out, "-- ", 3); assert((zRawSql - zStart) > 0); sqlStrAccumAppend(&out, zStart, (int)(zRawSql - zStart)); } } else if (p->nVar == 0) { sqlStrAccumAppend(&out, zRawSql, sqlStrlen30(zRawSql)); } else { while (zRawSql[0]) { n = findNextHostParameter(zRawSql, &nToken); assert(n > 0); sqlStrAccumAppend(&out, zRawSql, n); zRawSql += n; assert(zRawSql[0] || nToken == 0); if (nToken == 0) break; if (zRawSql[0] == '?') { if (nToken > 1) { assert(sqlIsdigit(zRawSql[1])); sqlGetInt32(&zRawSql[1], &idx); } else { idx = nextIndex; } } else { assert(zRawSql[0] == ':' || zRawSql[0] == '$' || zRawSql[0] == '@' || zRawSql[0] == '#'); testcase(zRawSql[0] == ':'); testcase(zRawSql[0] == '$'); testcase(zRawSql[0] == '@'); testcase(zRawSql[0] == '#'); idx = sqlVdbeParameterIndex(p, zRawSql, nToken); assert(idx > 0); } zRawSql += nToken; nextIndex = idx + 1; assert(idx > 0 && idx <= p->nVar); const char *value = mem_str(&p->aVar[idx - 1]); sqlStrAccumAppend(&out, value, strlen(value)); } } if (out.accError) sqlStrAccumReset(&out); return sqlStrAccumFinish(&out); }
1,958
544
<filename>AppKit/GTMNSAnimatablePropertyContainerTest.h // // GTMNSAnimatablePropertyContainerTest.h // // Copyright (c) 2010 Google Inc. 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. // #import "GTMSenTestCase.h" #import <AppKit/AppKit.h> #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 @class GTMUnitTestingBooleanRunLoopContext; @interface GTMNSAnimatablePropertyContainerWindow : NSWindow @end @interface GTMNSAnimatablePropertyContainerWindowBox : NSBox - (void)set:(NSInteger)value; @end @interface GTMNSAnimatablePropertyContainerWindowController : NSWindowController { @private IBOutlet NSBox *nonLayerBox_; IBOutlet NSBox *layerBox_; } @property (readonly, retain, nonatomic) NSBox *nonLayerBox; @property (readonly, retain, nonatomic) NSBox *layerBox; @end @interface GTMNSAnimatablePropertyContainerTest : GTMTestCase { @private GTMNSAnimatablePropertyContainerWindowController *windowController_; GTMUnitTestingBooleanRunLoopContext *timerCalled_; } @end #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
499
399
<filename>athena-federation-sdk/src/main/java/com/amazonaws/athena/connector/lambda/serde/DelegatingSerializer.java /*- * #%L * Amazon Athena Query Federation SDK * %% * Copyright (C) 2019 - 2020 Amazon Web Services * %% * 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. * #L% */ package com.amazonaws.athena.connector.lambda.serde; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.google.common.collect.ImmutableMap; import java.io.IOException; import java.util.Map; import java.util.Set; public class DelegatingSerializer<T> extends BaseSerializer<T> { private final Map<String, TypedSerializer<T>> delegateSerDeMap; public DelegatingSerializer(Class<T> clazz, Set<TypedSerializer<T>> serDes) { super(clazz); ImmutableMap.Builder<String, TypedSerializer<T>> delegateSerDeMapBuilder = ImmutableMap.builder(); for (TypedSerializer<T> serDe : serDes) { delegateSerDeMapBuilder.put(serDe.getSubType().getSimpleName(), serDe); } delegateSerDeMap = delegateSerDeMapBuilder.build(); } @Override public void doSerialize(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException { String type = value.getClass().getSimpleName(); TypedSerializer<T> delegateSerDe = delegateSerDeMap.get(type); if (delegateSerDe != null) { delegateSerDe.doSerialize(value, jgen, provider); } else { throw new IllegalStateException("No SerDe configured for " + type); } } public Map<String, TypedSerializer<T>> getDelegateSerDeMap() { return delegateSerDeMap; } }
796
373
<gh_stars>100-1000 /** @file This file defines the PPI for notifying PlatformInitPreMem of temporary memory being disabled. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef _PLATFORM_INIT_TEMP_RAM_EXIT_PPI_H_ #define _PLATFORM_INIT_TEMP_RAM_EXIT_PPI_H_ #include <PiPei.h> // // Forward declaration for the PLATFORM_INIT_TEMP_RAM_EXIT_PPI. // typedef struct _PLATFORM_INIT_TEMP_RAM_EXIT_PPI PLATFORM_INIT_TEMP_RAM_EXIT_PPI; /** A hook for platform-specific initialization prior to disabling temporary RAM. @retval EFI_SUCCESS The platform initialization was successful. @retval EFI_NOT_READY The platform has not been detected yet. **/ typedef EFI_STATUS (EFIAPI *PLATFORM_INIT_BEFORE_TEMP_RAM_EXIT) ( VOID ); /** A hook for platform-specific initialization after disabling temporary RAM. @retval EFI_SUCCESS The platform initialization was successful. @retval EFI_NOT_READY The platform has not been detected yet. **/ typedef EFI_STATUS (EFIAPI *PLATFORM_INIT_AFTER_TEMP_RAM_EXIT) ( VOID ); /// /// This PPI provides functions for notifying PlatformInitPreMem /// of temporary memory being disabled. /// struct _PLATFORM_INIT_TEMP_RAM_EXIT_PPI { PLATFORM_INIT_BEFORE_TEMP_RAM_EXIT PlatformInitBeforeTempRamExit; PLATFORM_INIT_AFTER_TEMP_RAM_EXIT PlatformInitAfterTempRamExit; }; extern EFI_GUID gPlatformInitTempRamExitPpiGuid; #endif // _PLATFORM_INIT_TEMP_RAM_EXIT_PPI_H_
623
6,580
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 AlgorithmImports import * from System.Globalization import * ### <summary> ### Live Trading Functionality Demonstration algorithm including SMS, Email and Web hook notifications. ### </summary> ### <meta name="tag" content="live trading" /> ### <meta name="tag" content="alerts" /> ### <meta name="tag" content="sms alerts" /> ### <meta name="tag" content="web hooks" /> ### <meta name="tag" content="email alerts" /> ### <meta name="tag" content="runtime statistics" /> class LiveTradingFeaturesAlgorithm(QCAlgorithm): ### Initialize the Algorithm and Prepare Required Data def Initialize(self): self.SetStartDate(2013, 10, 7) self.SetEndDate(2013, 10, 11) self.SetCash(25000) ##Equity Data for US Markets self.AddSecurity(SecurityType.Equity, 'IBM', Resolution.Second) ##FOREX Data for Weekends: 24/6 self.AddSecurity(SecurityType.Forex, 'EURUSD', Resolution.Minute) ##Custom/Bitcoin Live Data: 24/7 self.AddData(Bitcoin, 'BTC', Resolution.Second, TimeZones.Utc) ### New Bitcoin Data Event def OnData(Bitcoin, data): if self.LiveMode: self.SetRuntimeStatistic('BTC', str(data.Close)) if not self.Portfolio.HoldStock: self.MarketOrder('BTC', 100) ##Send a notification email/SMS/web request on events: self.Notify.Email("<EMAIL>", "Test", "Test Body", "test attachment") self.Notify.Sms("+11233456789", str(data.Time) + ">> Test message from live BTC server.") self.Notify.Web("http://api.quantconnect.com", str(data.Time) + ">> Test data packet posted from live BTC server.") ### Raises the data event def OnData(self, data): if (not self.Portfolio['IBM'].HoldStock) and data.ContainsKey('IBM'): quantity = int(np.floor(self.Portfolio.MarginRemaining / data['IBM'].Close)) self.MarketOrder('IBM',quantity) self.Debug('Purchased IBM on ' + str(self.Time.strftime("%m/%d/%Y"))) self.Notify.Email("<EMAIL>", "Test", "Test Body", "test attachment") ###Custom Data Type: Bitcoin data from Quandl - http://www.quandl.com/help/api-for-bitcoin-data class Bitcoin(PythonData): def GetSource(self, config, date, isLiveMode): if isLiveMode: return SubscriptionDataSource("https://www.bitstamp.net/api/ticker/", SubscriptionTransportMedium.Rest) return SubscriptionDataSource("https://www.quandl.com/api/v3/datasets/BCHARTS/BITSTAMPUSD.csv?order=asc", SubscriptionTransportMedium.RemoteFile) def Reader(self, config, line, date, isLiveMode): coin = Bitcoin() coin.Symbol = config.Symbol if isLiveMode: # Example Line Format: # {"high": "441.00", "last": "421.86", "timestamp": "1411606877", "bid": "421.96", "vwap": "428.58", "volume": "14120.40683975", "low": "418.83", "ask": "421.99"} try: liveBTC = json.loads(line) # If value is zero, return None value = liveBTC["last"] if value == 0: return None coin.Time = datetime.now() coin.Value = value coin["Open"] = float(liveBTC["open"]) coin["High"] = float(liveBTC["high"]) coin["Low"] = float(liveBTC["low"]) coin["Close"] = float(liveBTC["last"]) coin["Ask"] = float(liveBTC["ask"]) coin["Bid"] = float(liveBTC["bid"]) coin["VolumeBTC"] = float(liveBTC["volume"]) coin["WeightedPrice"] = float(liveBTC["vwap"]) return coin except ValueError: # Do nothing, possible error in json decoding return None # Example Line Format: # Date Open High Low Close Volume (BTC) Volume (Currency) Weighted Price # 2011-09-13 5.8 6.0 5.65 5.97 58.37138238, 346.0973893944 5.929230648356 if not (line.strip() and line[0].isdigit()): return None try: data = line.split(',') coin.Time = datetime.strptime(data[0], "%Y-%m-%d") coin.Value = float(data[4]) coin["Open"] = float(data[1]) coin["High"] = float(data[2]) coin["Low"] = float(data[3]) coin["Close"] = float(data[4]) coin["VolumeBTC"] = float(data[5]) coin["VolumeUSD"] = float(data[6]) coin["WeightedPrice"] = float(data[7]) return coin except ValueError: # Do nothing, possible error in json decoding return None
2,275
306
<gh_stars>100-1000 package com.dueeeke.videoplayer.util; import android.util.Log; /** * 日志类 * Created by Devlin_n on 2017/6/5. */ public class L { private static final String TAG = "DKPlayer"; public static void d(String msg) { Log.d(TAG, msg); } public static void e(String msg) { Log.e(TAG, msg); } }
154
311
<gh_stars>100-1000 import deal @deal.reason(ZeroDivisionError, lambda a, b: b == 0) @deal.reason(ValueError, lambda a, b: a == b, message='a is equal to b') @deal.raises(ValueError, IndexError, ZeroDivisionError) @deal.pre(lambda a, b: b != 0) @deal.pre(lambda a, b: b != 0, message='b is not zero') @deal.ensure(lambda a, b, result: b != result) @deal.post(lambda res: res != .13) @deal.has('database', 'network') @deal.example(lambda: example(6, 2) == 3) def example(a: int, b: int) -> float: """Example function. :return: The description for return value. """ return a / b
223
938
package slimeknights.tconstruct.tools.modifiers.ability.armor; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingFallEvent; import slimeknights.tconstruct.TConstruct; import slimeknights.tconstruct.common.Sounds; import slimeknights.tconstruct.library.modifiers.impl.TotalArmorLevelModifier; import slimeknights.tconstruct.library.tools.capability.TinkerDataCapability.TinkerDataKey; import slimeknights.tconstruct.library.tools.helper.ModifierUtil; import slimeknights.tconstruct.library.utils.SlimeBounceHandler; public class BouncyModifier extends TotalArmorLevelModifier { private static final TinkerDataKey<Integer> BOUNCY = TConstruct.createKey("bouncy"); public BouncyModifier() { super(0x27C6C6, BOUNCY, true); MinecraftForge.EVENT_BUS.addListener(BouncyModifier::onFall); } /** Called when an entity lands to handle the event */ private static void onFall(LivingFallEvent event) { LivingEntity living = event.getEntityLiving(); // using fall distance as the event distance could be reduced by jump boost if (living == null || living.fallDistance <= 2f) { return; } // can the entity bounce? if (ModifierUtil.getTotalModifierLevel(living, BOUNCY) == 0) { return; } // reduced fall damage when crouching if (living.isSuppressingBounce()) { event.setDamageMultiplier(0.5f); return; } else { event.setDamageMultiplier(0.0f); } // server players behave differently than non-server players, they have no velocity during the event, so we need to reverse engineer it Vector3d motion = living.getMotion(); if (living instanceof ServerPlayerEntity) { // velocity is lost on server players, but we dont have to defer the bounce double gravity = living.getAttributeValue(ForgeMod.ENTITY_GRAVITY.get()); double time = Math.sqrt(living.fallDistance / gravity); double velocity = gravity * time; living.setMotion(motion.x / 0.95f, velocity, motion.z / 0.95f); living.velocityChanged = true; // preserve momentum SlimeBounceHandler.addBounceHandler(living); } else { // for non-players, need to defer the bounce // only slow down half as much when bouncing living.setMotion(motion.x / 0.95f, motion.y * -0.9, motion.z / 0.95f); SlimeBounceHandler.addBounceHandler(living, living.getMotion().y); } // update airborn status event.setDistance(0.0F); if (!living.world.isRemote) { living.isAirBorne = true; event.setCanceled(true); living.setOnGround(false); // need to be on ground for server to process this event } living.playSound(Sounds.SLIMY_BOUNCE.getSound(), 1f, 1f); } }
993
1,996
import html import sweetviz.sv_html as sv_html from sweetviz.sv_types import NumWithPercent, FeatureToProcess def do_detail_text(to_process: FeatureToProcess, updated_dict: dict): updated_dict["detail"] = dict() detail = updated_dict["detail"] # Compute COUNT stats (i.e. below graph) # ---------------------------------------------------------------------------------------------- detail["full_count"] = [] num_values = updated_dict["base_stats"]["num_values"].number if to_process.compare_counts is not None: num_values_compare = updated_dict["compare"]["base_stats"]["num_values"].number # Iterate through ALL VALUES and get stats for item in to_process.source_counts["value_counts_without_nan"].iteritems(): row = dict() row["name"] = html.escape(str(item[0])) row["count"] = NumWithPercent(item[1], num_values) # Defaults to no comparison or target row["count_compare"] = None row["target_stats"] = None row["target_stats_compare"] = None if to_process.compare_counts is not None: # HAS COMPARE... if row["name"] in to_process.compare_counts["value_counts_without_nan"].index: # ...and value exists in COMPARE matching = to_process.compare_counts["value_counts_without_nan"][row["name"]] row["count_compare"] = NumWithPercent(matching, num_values_compare) detail["full_count"].append(row) return def analyze(to_process: FeatureToProcess, feature_dict: dict): compare_dict = feature_dict.get("compare") feature_dict["stats"] = dict() if compare_dict: compare_dict["stats"] = dict() do_detail_text(to_process, feature_dict) if to_process.is_target(): raise ValueError else: feature_dict["html_summary"] = sv_html.generate_html_summary_text(feature_dict, compare_dict)
738
439
package com.haskforce.settings; import com.haskforce.utils.NotificationUtil; import com.intellij.ide.util.PropertiesComponent; import com.intellij.notification.NotificationType; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * String wrapper to ensure that we don't accidentally pass an invalid key to the PropertiesComponent. * These are set as property keys in HaskellToolsConfigurable. */ public class ToolKey { private static Logger LOG = Logger.getInstance(ToolKey.class); public static final ToolKey STYLISH_HASKELL_KEY = new ToolKey("stylishHaskell", "stylish-haskell"); public static final ToolKey HLINT_KEY = new ToolKey("hlint", "hlint"); public static final ToolKey GHC_MOD_KEY = new ToolKey("ghcMod", "ghc-mod"); public static final ToolKey GHC_MODI_KEY = new ToolKey("ghcModi", "ghc-modi"); public static final ToolKey HINDENT_KEY = new ToolKey("hindent", "hindent"); public static final String GHC_MODI_RESPONSE_TIMEOUT_LEGACY_KEY = "ghcModiTimeout"; public static final String GHC_MODI_RESPONSE_TIMEOUT_KEY = "ghcModiTimeout"; public static final long GHC_MODI_RESPONSE_TIMEOUT_DEFAULT = 5000; // 5 seconds public static final String GHC_MODI_KILL_IDLE_TIMEOUT_KEY = "ghcModiKillIdleTimeout"; public static final long GHC_MODI_KILL_IDLE_TIMEOUT_DEFAULT = 600000; // 10 minutes private static String getGhcModiResponseTimeoutString(@NotNull Project project) { String timeout; for (String k : new String[]{GHC_MODI_RESPONSE_TIMEOUT_KEY, GHC_MODI_RESPONSE_TIMEOUT_LEGACY_KEY}) { timeout = PropertiesComponent.getInstance(project).getValue(k); if (timeout != null && !timeout.isEmpty()) return timeout; } return null; } public static long getGhcModiResponseTimeout(@NotNull Project project) { String timeout = getGhcModiResponseTimeoutString(project); if (timeout == null) return GHC_MODI_RESPONSE_TIMEOUT_DEFAULT; try { return Long.parseLong(timeout); } catch (NumberFormatException e) { String message = "Invalid " + GHC_MODI_RESPONSE_TIMEOUT_KEY + " value '" + timeout + "'" + "; defaulting to " + GHC_MODI_RESPONSE_TIMEOUT_DEFAULT; LOG.warn(message); NotificationUtil.displaySimpleNotification(NotificationType.WARNING, project, "Configuration", message); return GHC_MODI_RESPONSE_TIMEOUT_DEFAULT; } } public static long getGhcModiKillIdleTimeout(@NotNull Project project) { final String timeout = PropertiesComponent.getInstance(project).getValue(GHC_MODI_KILL_IDLE_TIMEOUT_KEY); if (timeout == null || timeout.isEmpty()) return GHC_MODI_KILL_IDLE_TIMEOUT_DEFAULT; try { return Long.parseLong(timeout); } catch (NumberFormatException e) { String message = "Invalid " + GHC_MODI_KILL_IDLE_TIMEOUT_KEY + " value '" + timeout + "'" + "; default to " + GHC_MODI_KILL_IDLE_TIMEOUT_DEFAULT; LOG.warn(message); NotificationUtil.displaySimpleNotification(NotificationType.WARNING, project, "Configuration", message); return GHC_MODI_KILL_IDLE_TIMEOUT_DEFAULT; } } public final String prettyName; public final String pathKey; public final String flagsKey; public ToolKey(String name, String prettyName) { this.prettyName = prettyName; this.pathKey = name + "Path"; this.flagsKey = name + "Flags"; } @Nullable public String getPath(@NotNull Project project) { final String path = PropertiesComponent.getInstance(project).getValue(pathKey); return path == null || path.isEmpty() ? null : path; } @NotNull public String getFlags(@NotNull Project project) { final String flags = PropertiesComponent.getInstance(project).getValue(flagsKey); return flags == null ? "" : flags; } @Override public String toString() { return "ToolKey(" + prettyName + ")"; } }
1,601
918
/* * 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.gobblin.source.extractor.filebased; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; import org.testng.Assert; import org.testng.annotations.Test; import com.google.common.base.Joiner; /** * Test for {@link TokenizedFileDownloader}. */ public class TokenizedFileDownloaderTest { @Test public void testRecordIterator() throws UnsupportedEncodingException { String charset = "UTF-8"; String delimiter = "\n\r"; String record1 = "record1"; String record2 = "record2\n"; String record3 = "record3\r"; InputStream inputStream = new ByteArrayInputStream(Joiner.on(delimiter).join(record1, record2, record3).getBytes(charset)); TokenizedFileDownloader.RecordIterator recordIterator = new TokenizedFileDownloader.RecordIterator(inputStream, delimiter, charset); Assert.assertTrue(recordIterator.hasNext()); Assert.assertEquals(recordIterator.next(), record1); Assert.assertTrue(recordIterator.hasNext()); Assert.assertEquals(recordIterator.next(), record2); Assert.assertTrue(recordIterator.hasNext()); Assert.assertEquals(recordIterator.next(), record3); Assert.assertFalse(recordIterator.hasNext()); } }
617
341
<gh_stars>100-1000 import pytest from stellar_sdk import xdr as stellar_xdr from stellar_sdk.exceptions import ValueError from stellar_sdk.muxed_account import MuxedAccount from stellar_sdk.strkey import StrKey class TestMuxedAccount: def test_init_with_account_id_id(self): account_id = "<KEY>" account_id_id = 1234 account_id_muxed = ( "<KEY>" ) med25519 = stellar_xdr.MuxedAccountMed25519( id=stellar_xdr.Uint64(account_id_id), ed25519=stellar_xdr.Uint256(StrKey.decode_ed25519_public_key(account_id)), ) muxed_account_xdr = stellar_xdr.MuxedAccount( type=stellar_xdr.CryptoKeyType.KEY_TYPE_MUXED_ED25519, med25519=med25519 ) muxed_account = MuxedAccount(account_id, account_id_id) assert muxed_account.account_muxed == account_id_muxed assert muxed_account.to_xdr_object().to_xdr() == muxed_account_xdr.to_xdr() assert MuxedAccount.from_xdr_object(muxed_account_xdr) == muxed_account def test_init_without_account_id_id(self): account_id = "<KEY>" account_id_id = None muxed_account_xdr = stellar_xdr.MuxedAccount( type=stellar_xdr.CryptoKeyType.KEY_TYPE_ED25519, ed25519=stellar_xdr.Uint256(StrKey.decode_ed25519_public_key(account_id)), ) muxed_account = MuxedAccount(account_id, account_id_id) assert muxed_account.to_xdr_object().to_xdr() == muxed_account_xdr.to_xdr() assert MuxedAccount.from_xdr_object(muxed_account_xdr) == muxed_account assert muxed_account.account_muxed is None def test_from_account_muxed_account(self): account_id = "<KEY>" account_id_id = 1234 account_id_muxed = ( "<KEY>" ) muxed_account = MuxedAccount.from_account(account_id_muxed) assert muxed_account.account_id == account_id assert muxed_account.account_muxed_id == account_id_id def test_from_account_ed25519_account(self): account_id = "<KEY>" account_id_id = None muxed_account = MuxedAccount.from_account(account_id) assert muxed_account.account_id == account_id assert muxed_account.account_muxed_id == account_id_id def test_from_account_invalid_account_raise(self): invalid_account = "A" * 100 with pytest.raises(ValueError, match="This is not a valid account."): MuxedAccount.from_account(invalid_account)
1,167
312
/* dla.c Contributed by <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 3 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, see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */ // This is the HOST side of the e_dla example. #include <stdlib.h> #include <stdio.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <unistd.h> #include <inttypes.h> #include <fcntl.h> #include <linux/fb.h> #include <stdlib.h> #include <math.h> #include <termios.h> #include "coprthr.h" #include "coprthr_cc.h" #include "coprthr_thread.h" #include "coprthr_mpi.h" #include "shared.h" #define FB "/dev/fb0" #define ERROR(...) do{fprintf(stderr,__VA_ARGS__); exit(-1);}while(0) #define N 2000 static int fb; static struct fb_fix_screeninfo fix; static struct fb_var_screeninfo var; int main(int argc, char *argv[]) { unsigned row, col, core; int all_done, core_done; int i, x, y; int res; int keyVal; int numPerCore; int j, n, ix, iy, ixnew, iynew; int found; int R = 100; int counter = 0; int numprocs, rank; int seq = 1; int process; int offset; double theta, d; int *fp; int dd, nCores; char color; coprthr_program_t prg; float angle; process = atoi(argv[1]); fb = open(FB, O_RDWR); if (fb == -1) { perror("Unable to open fb " FB); return 1; } res = ioctl(fb, FBIOGET_FSCREENINFO, &fix); if (res != 0) { perror("getscreeninfo failed"); close(fb); return 1; } //printf("framebuffer size %d @ %08x\n", fix.smem_len, fix.smem_start); res = ioctl(fb, FBIOGET_VSCREENINFO, &var); if (res != 0) { perror("getscreeninfo failed"); close(fb); return 1; } offset = 0; if(process == 1){ offset = -1 * (var.xres_virtual / 4); } else if(process == 2){ offset = var.xres_virtual / 4; } nCores = atoi(argv[2]); color = *argv[3]; numPerCore = atoi(argv[4]); if(numPerCore == 0){ numPerCore = N; } //printf("size %dx%d @ %d bits per pixel\n", var.xres_virtual, var.yres_virtual, var.bits_per_pixel); fp = mmap(NULL, fix.smem_len, O_RDWR, MAP_SHARED, fb, 0); if (fp == (void *) -1) { perror("mmap failed"); close(fb); return 1; } //printf("virtual @ %p\n", fp); int stride = var.xres_virtual; dd = coprthr_dopen(COPRTHR_DEVICE_E32,COPRTHR_O_THREAD); if (dd<0) ERROR("device open failed\n"); prg = coprthr_cc_read_bin("./e_dla.cbin.3.e32", 0); coprthr_sym_t thr = coprthr_getsym(prg,"dla_thread"); my_args_t args; args.n = numPerCore; args.offset = offset; args.color = color; args.fbinfo.smem_start = fix.smem_start; args.fbinfo.smem_len = fix.smem_len; args.fbinfo.line_length = fix.line_length; args.fbinfo.xres = var.xres; args.fbinfo.yres = var.yres; args.fbinfo.xres_virtual = var.xres_virtual; args.fbinfo.yres_virtual = var.yres_virtual; args.fbinfo.xoffset = var.xoffset; args.fbinfo.yoffset = var.yoffset; args.fbinfo.bits_per_pixel = var.bits_per_pixel; args.fbinfo.emptyPixVal = fp[0]; coprthr_mem_t p_mem_switch; system("clear"); coprthr_mpiexec(dd, nCores, thr, &args, sizeof(args),0); coprthr_dclose(dd); //MPI_Finalize(); return 0; }
1,560
5,169
{ "name": "GoodsTitleAttr", "version": "0.0.1", "summary": "A TestDemo", "homepage": "https://github.com/liushouxun/Test", "license": "MIT", "authors": { "liusx": "<EMAIL>" }, "source": { "git": "https://github.com/liushouxun/Test.git", "tag": "0.0.1" }, "source_files": "GoodsTitleAttr/*.{h,m}", "requires_arc": true, "platforms": { "ios": "9.0" } }
187
30,023
"""Tests for the RTSPtoWebRTC integration."""
15
333
#ifndef IRODS_TICKET_ADMIN_H #define IRODS_TICKET_ADMIN_H #include "objInfo.h" struct RcComm; typedef struct TicketAdminInput { char *arg1; char *arg2; char *arg3; char *arg4; char *arg5; char *arg6; struct KeyValPair condInput; } ticketAdminInp_t; #define ticketAdminInp_PI "str *arg1; str *arg2; str *arg3; str *arg4; str *arg5; str *arg6; struct KeyValPair_PI;" #ifdef __cplusplus extern "C" #endif int rcTicketAdmin(struct RcComm* conn, struct TicketAdminInput* ticketAdminInp); #endif // IRODS_TICKET_ADMIN_H
242
422
<gh_stars>100-1000 from sqlobject import * from sqlobject.col import validators from sqlobject.tests.dbtest import * ######################################## ## Enum test ######################################## class Enum1(SQLObject): l = EnumCol(enumValues=['a', 'bcd', 'e']) def testBad(): setupClass(Enum1) for l in ['a', 'bcd', 'a', 'e']: Enum1(l=l) raises( (Enum1._connection.module.IntegrityError, Enum1._connection.module.ProgrammingError, validators.Invalid), Enum1, l='b') class EnumWithNone(SQLObject): l = EnumCol(enumValues=['a', 'bcd', 'e', None]) def testNone(): setupClass(EnumWithNone) for l in [None, 'a', 'bcd', 'a', 'e', None]: e = EnumWithNone(l=l) assert e.l == l class EnumWithDefaultNone(SQLObject): l = EnumCol(enumValues=['a', 'bcd', 'e', None], default=None) def testDefaultNone(): setupClass(EnumWithDefaultNone) e = EnumWithDefaultNone() assert e.l == None class EnumWithDefaultOther(SQLObject): l = EnumCol(enumValues=['a', 'bcd', 'e', None], default='a') def testDefaultOther(): setupClass(EnumWithDefaultOther) e = EnumWithDefaultOther() assert e.l == 'a' class EnumUnicode(SQLObject): n = UnicodeCol() l = EnumCol(enumValues=['a', 'b']) def testUnicode(): setupClass(EnumUnicode) EnumUnicode(n=u'a', l='a') EnumUnicode(n=u'b', l=u'b') EnumUnicode(n=u'\u201c', l='a') EnumUnicode(n=u'\u201c', l=u'b')
645
3,782
<gh_stars>1000+ import numpy as np def get_distribution(GC_fraction): from simdna.util import DiscreteDistribution return DiscreteDistribution({ 'A': (1 - GC_fraction) / 2, 'C': GC_fraction / 2, 'G': GC_fraction / 2, 'T': (1 - GC_fraction) / 2 }) def simple_motif_embedding(motif_name, seq_length, num_seqs, GC_fraction): """ Simulates sequences with a motif embedded anywhere in the sequence. Parameters ---------- motif_name : str encode motif name seq_length : int length of sequence num_seqs: int number of sequences GC_fraction : float GC basepair fraction in background sequence Returns ------- sequence_arr : 1darray Array with sequence strings. embedding_arr: 1darray Array of embedding objects. """ import simdna from simdna import synthetic if motif_name is None: embedders = [] else: loaded_motifs = synthetic.LoadedEncodeMotifs( simdna.ENCODE_MOTIFS_PATH, pseudocountProb=0.001) substring_generator = synthetic.PwmSamplerFromLoadedMotifs( loaded_motifs, motif_name) embedders = [ synthetic.SubstringEmbedder( synthetic.ReverseComplementWrapper(substring_generator)) ] embed_in_background = synthetic.EmbedInABackground( synthetic.ZeroOrderBackgroundGenerator( seq_length, discreteDistribution=get_distribution(GC_fraction)), embedders) generated_sequences = tuple( synthetic.GenerateSequenceNTimes(embed_in_background, num_seqs).generateSequences()) sequence_arr = np.array( [generated_seq.seq for generated_seq in generated_sequences]) embedding_arr = [ generated_seq.embeddings for generated_seq in generated_sequences ] return sequence_arr, embedding_arr def motif_density(motif_name, seq_length, num_seqs, min_counts, max_counts, GC_fraction, central_bp=None): """ Returns sequences with motif density, along with embeddings array. """ import simdna from simdna import synthetic loaded_motifs = synthetic.LoadedEncodeMotifs( simdna.ENCODE_MOTIFS_PATH, pseudocountProb=0.001) substring_generator = synthetic.PwmSamplerFromLoadedMotifs( loaded_motifs, motif_name) if central_bp is not None: position_generator = synthetic.InsideCentralBp(central_bp) else: position_generator = synthetic.UniformPositionGenerator() quantity_generator = synthetic.UniformIntegerGenerator(min_counts, max_counts) embedders = [ synthetic.RepeatedEmbedder( synthetic.SubstringEmbedder( synthetic.ReverseComplementWrapper(substring_generator), position_generator), quantity_generator) ] embed_in_background = synthetic.EmbedInABackground( synthetic.ZeroOrderBackgroundGenerator( seq_length, discreteDistribution=get_distribution(GC_fraction)), embedders) generated_sequences = tuple( synthetic.GenerateSequenceNTimes(embed_in_background, num_seqs).generateSequences()) sequence_arr = np.array( [generated_seq.seq for generated_seq in generated_sequences]) embedding_arr = [ generated_seq.embeddings for generated_seq in generated_sequences ] return sequence_arr, embedding_arr def simulate_single_motif_detection(motif_name, seq_length, num_pos, num_neg, GC_fraction): """ Simulates two classes of seqeuences: - Positive class sequence with a motif embedded anywhere in the sequence - Negative class sequence without the motif Parameters ---------- motif_name : str encode motif name seq_length : int length of sequence num_pos : int number of positive class sequences num_neg : int number of negative class sequences GC_fraction : float GC fraction in background sequence Returns ------- sequence_arr : 1darray Array with sequence strings. y : 1darray Array with positive/negative class labels. embedding_arr: 1darray Array of embedding objects. """ motif_sequence_arr, positive_embedding_arr = simple_motif_embedding( motif_name, seq_length, num_pos, GC_fraction) random_sequence_arr, negative_embedding_arr = simple_motif_embedding( None, seq_length, num_neg, GC_fraction) sequence_arr = np.concatenate((motif_sequence_arr, random_sequence_arr)) y = np.array([[True]] * num_pos + [[False]] * num_neg) embedding_arr = positive_embedding_arr + negative_embedding_arr return sequence_arr, y, embedding_arr def simulate_motif_counting(motif_name, seq_length, pos_counts, neg_counts, num_pos, num_neg, GC_fraction): """ Generates data for motif counting task. Parameters ---------- motif_name : str seq_length : int pos_counts : list (min_counts, max_counts) for positive set. neg_counts : list (min_counts, max_counts) for negative set. num_pos : int num_neg : int GC_fraction : float Returns ------- sequence_arr : 1darray Contains sequence strings. y : 1darray Contains labels. embedding_arr: 1darray Array of embedding objects. """ pos_count_sequence_array, positive_embedding_arr = motif_density( motif_name, seq_length, num_pos, pos_counts[0], pos_counts[1], GC_fraction) neg_count_sequence_array, negative_embedding_arr = motif_density( motif_name, seq_length, num_pos, neg_counts[0], neg_counts[1], GC_fraction) sequence_arr = np.concatenate((pos_count_sequence_array, neg_count_sequence_array)) y = np.array([[True]] * num_pos + [[False]] * num_neg) embedding_arr = positive_embedding_arr + negative_embedding_arr return sequence_arr, y, embedding_arr def simulate_motif_density_localization(motif_name, seq_length, center_size, min_motif_counts, max_motif_counts, num_pos, num_neg, GC_fraction): """ Simulates two classes of seqeuences: - Positive class sequences with multiple motif instances in center of the sequence. - Negative class sequences with multiple motif instances anywhere in the sequence. The number of motif instances is uniformly sampled between minimum and maximum motif counts. Parameters ---------- motif_name : str encode motif name seq_length : int length of sequence center_size : int length of central part of the sequence where motifs can be positioned min_motif_counts : int minimum number of motif instances max_motif_counts : int maximum number of motif instances num_pos : int number of positive class sequences num_neg : int number of negative class sequences GC_fraction : float GC fraction in background sequence Returns ------- sequence_arr : 1darray Contains sequence strings. y : 1darray Contains labels. embedding_arr: 1darray Array of embedding objects. """ localized_density_sequence_array, positive_embedding_arr = motif_density( motif_name, seq_length, num_pos, min_motif_counts, max_motif_counts, GC_fraction, center_size) unlocalized_density_sequence_array, negative_embedding_arr = motif_density( motif_name, seq_length, num_neg, min_motif_counts, max_motif_counts, GC_fraction) sequence_arr = np.concatenate((localized_density_sequence_array, unlocalized_density_sequence_array)) y = np.array([[True]] * num_pos + [[False]] * num_neg) embedding_arr = positive_embedding_arr + negative_embedding_arr return sequence_arr, y, embedding_arr def simulate_multi_motif_embedding(motif_names, seq_length, min_num_motifs, max_num_motifs, num_seqs, GC_fraction): """ Generates data for multi motif recognition task. Parameters ---------- motif_names : list List of strings. seq_length : int min_num_motifs : int max_num_motifs : int num_seqs : int GC_fraction : float Returns ------- sequence_arr : 1darray Contains sequence strings. y : ndarray Contains labels for each motif. embedding_arr: 1darray Array of embedding objects. """ import simdna from simdna import synthetic loaded_motifs = synthetic.LoadedEncodeMotifs( simdna.ENCODE_MOTIFS_PATH, pseudocountProb=0.001) def get_embedder(motif_name): substring_generator = synthetic.PwmSamplerFromLoadedMotifs( loaded_motifs, motif_name) return synthetic.SubstringEmbedder( synthetic.ReverseComplementWrapper(substring_generator), name=motif_name) embedders = [get_embedder(motif_name) for motif_name in motif_names] quantity_generator = synthetic.UniformIntegerGenerator( min_num_motifs, max_num_motifs) combined_embedder = [ synthetic.RandomSubsetOfEmbedders(quantity_generator, embedders) ] embed_in_background = synthetic.EmbedInABackground( synthetic.ZeroOrderBackgroundGenerator( seq_length, discreteDistribution=get_distribution(GC_fraction)), combined_embedder) generated_sequences = tuple( synthetic.GenerateSequenceNTimes(embed_in_background, num_seqs).generateSequences()) sequence_arr = np.array( [generated_seq.seq for generated_seq in generated_sequences]) label_generator = synthetic.IsInTraceLabelGenerator(np.asarray(motif_names)) y = np.array( [ label_generator.generateLabels(generated_seq) for generated_seq in generated_sequences ], dtype=bool) embedding_arr = [ generated_seq.embeddings for generated_seq in generated_sequences ] return sequence_arr, y, embedding_arr def simulate_differential_accessibility( pos_motif_names, neg_motif_names, seq_length, min_num_motifs, max_num_motifs, num_pos, num_neg, GC_fraction): """ Generates data for differential accessibility task. Parameters ---------- pos_motif_names : list List of strings. neg_motif_names : list List of strings. seq_length : int min_num_motifs : int max_num_motifs : int num_pos : int num_neg : int GC_fraction : float Returns ------- sequence_arr : 1darray Contains sequence strings. y : 1darray Contains labels. embedding_arr: 1darray Array of embedding objects. """ pos_motif_sequence_arr, _, positive_embedding_arr = simulate_multi_motif_embedding( pos_motif_names, seq_length, min_num_motifs, max_num_motifs, num_pos, GC_fraction) neg_motif_sequence_arr, _, negative_embedding_arr = simulate_multi_motif_embedding( neg_motif_names, seq_length, min_num_motifs, max_num_motifs, num_neg, GC_fraction) sequence_arr = np.concatenate((pos_motif_sequence_arr, neg_motif_sequence_arr)) y = np.array([[True]] * num_pos + [[False]] * num_neg) embedding_arr = positive_embedding_arr + negative_embedding_arr return sequence_arr, y, embedding_arr def simulate_heterodimer_grammar(motif1, motif2, seq_length, min_spacing, max_spacing, num_pos, num_neg, GC_fraction): """ Simulates two classes of sequences with motif1 and motif2: - Positive class sequences with motif1 and motif2 positioned min_spacing and max_spacing - Negative class sequences with independent motif1 and motif2 positioned anywhere in the sequence, not as a heterodimer grammar Parameters ---------- seq_length : int, length of sequence GC_fraction : float, GC fraction in background sequence num_pos : int, number of positive class sequences num_neg : int, number of negatice class sequences motif1 : str, encode motif name motif2 : str, encode motif name min_spacing : int, minimum inter motif spacing max_spacing : int, maximum inter motif spacing Returns ------- sequence_arr : 1darray Array with sequence strings. y : 1darray Array with positive/negative class labels. embedding_arr: list List of embedding objects. """ import simdna from simdna import synthetic loaded_motifs = synthetic.LoadedEncodeMotifs( simdna.ENCODE_MOTIFS_PATH, pseudocountProb=0.001) motif1_generator = synthetic.ReverseComplementWrapper( synthetic.PwmSamplerFromLoadedMotifs(loaded_motifs, motif1)) motif2_generator = synthetic.ReverseComplementWrapper( synthetic.PwmSamplerFromLoadedMotifs(loaded_motifs, motif2)) separation_generator = synthetic.UniformIntegerGenerator( min_spacing, max_spacing) embedder = synthetic.EmbeddableEmbedder( synthetic.PairEmbeddableGenerator(motif1_generator, motif2_generator, separation_generator)) embed_in_background = synthetic.EmbedInABackground( synthetic.ZeroOrderBackgroundGenerator( seq_length, discreteDistribution=get_distribution(GC_fraction)), [embedder]) generated_sequences = tuple( synthetic.GenerateSequenceNTimes(embed_in_background, num_pos).generateSequences()) grammar_sequence_arr = np.array( [generated_seq.seq for generated_seq in generated_sequences]) positive_embedding_arr = [ generated_seq.embeddings for generated_seq in generated_sequences ] nongrammar_sequence_arr, _, negative_embedding_arr = simulate_multi_motif_embedding( [motif1, motif2], seq_length, 2, 2, num_neg, GC_fraction) sequence_arr = np.concatenate((grammar_sequence_arr, nongrammar_sequence_arr)) y = np.array([[True]] * num_pos + [[False]] * num_neg) embedding_arr = positive_embedding_arr + negative_embedding_arr return sequence_arr, y, embedding_arr
5,519
556
from unittest import TestCase import numpy as np import matplotlib.pyplot as plt import time from phi import math from phi import field from phi.geom import Box from phi.math import spatial from phi.physics._boundaries import Domain, PERIODIC from .numpy_reference import HW, Namespace from .phi_version import step_gradient_2d, rk4_step, get_domain_phi STEPS = 20 with math.precision(64): def plot_list(image_arrays): N = len(image_arrays) fig, axarr = plt.subplots(1, N, figsize=(3.5 * N, 4)) for i in range(N): c = axarr[i].imshow(image_arrays[i]) plt.colorbar(c, ax=axarr[i]) return fig def plot_dict(plot_dic): n = len(plot_dic.values()) fig, axarr = plt.subplots(1, n, figsize=(n * 4, 4)) for i, it in enumerate(plot_dic.items()): label, field = it c = axarr[i].imshow(field) plt.colorbar(c, ax=axarr[i]) axarr[i].set_title(label) return fig def plot(data, title=""): if isinstance(data, list): fig = plot_list(data) elif isinstance(data, dict): fig = plot_dict(data) else: raise if len(title): fig.suptitle(title) plt.show() def get_2d_sine(grid_size, L): indices = np.array(np.meshgrid(*list(map(range, grid_size)))) phys_coord = indices.T * L / grid_size[0] # between [0, L) x, y = phys_coord.T d = np.sin(x + 1) * np.sin(y + 1) return d def debug(element): attr_list = ["dtype", "shape"] output = str(type(element)) output += " " + " ".join( [ str(getattr(element, attr)) for attr in attr_list if hasattr(element, attr) ] ) print(output) class TestHW2D(TestCase): def test_demo_vs_numpy(self): dt = 0.1 # Physical parameters L = 4 * 2 * np.pi # 2 * np.pi / 0.15 # 4*2*np.pi#/0.15 c1 = 5 # 0.01 # Numerical Parameters grid_pts = 64 nu = 0 # 1e-8 N = 0 # 3 arakawa_coeff = 0 kappa_coeff = 0 # Derived Parameters dx = L / grid_pts k0 = 2 * np.pi / L # Get input data rnd_noise = np.random.rand(grid_pts * grid_pts).reshape(grid_pts, grid_pts) sine = get_2d_sine((grid_pts, grid_pts), L) init_values = sine / 1000 density_coeff = 1 omega_coeff = -1 / 2 phi_coeff = -1 / 2 x = grid_pts y = grid_pts params = dict( c1=c1, nu=nu, N=N, arakawa_coeff=arakawa_coeff, kappa_coeff=kappa_coeff ) # NumPy reference hw = HW( c1=c1, nu=nu, N=N, arakawa_coeff=arakawa_coeff, kappa_coeff=kappa_coeff, debug=False, ) hw_state_numpy = Namespace( density=init_values * density_coeff, omega=init_values * omega_coeff, phi=init_values * phi_coeff, age=0, dx=dx, ) # Phi version domain = Domain(x=x, y=y, boundaries=PERIODIC, bounds=Box[0:L, 0:L]) hw_state_phi = Namespace( density=domain.grid( math.tensor(init_values * density_coeff, spatial('x, y')) ), omega=domain.grid( math.tensor(init_values * omega_coeff, spatial('x, y')) ), phi=domain.grid(math.tensor(init_values * phi_coeff, spatial('x, y'))), # domain=domain, age=0, dx=dx, ) from functools import partial get_phi = partial(get_domain_phi, domain=domain) rk4_step2 = partial(rk4_step, params=params, get_phi=get_phi) # Run def compare(iterable): for k in iterable[0].keys(): compare = [] for state in iterable: if isinstance(state[k], field._grid.Grid): val = state[k].values.numpy(order="x,y,z")[0] else: val = state[k] compare.append(val) assert len(compare) == 2 print( f" {k:<7}:" + f" {np.max(np.abs(compare[0]-compare[1])):.7f}" + f" {np.array_equal(*compare)}" + f" {np.max(np.abs(compare[0]-compare[1])):.2g}" ) return True np_times = [] phi_times = [] for i in range(0, STEPS + 1): print(f"step {i:>3} {i*dt:>12.7f}") # Numpy t0 = time.time() hw_state_numpy = hw.rk4_step(hw_state_numpy, dt=dt) np_time = time.time() - t0 np_times.append(np_time) # Phi t0 = time.time() hw_state_phi = rk4_step2(dt=dt, **hw_state_phi) phi_time = time.time() - t0 phi_times.append(phi_time) compare([hw_state_numpy, hw_state_phi]) # if i % 100 == 0: # plot({'numpy': hw_state_numpy.density, # 'phi': hw_state_phi.density.values.numpy(order='zyx')[0], # 'diff': hw_state_numpy.density - hw_state_phi.density.values.numpy(order='zyx')[0]}, # title=f"step: {i}") # assert np.allclose(hw_state_numpy.density, hw_state_phi.density.values.numpy(order='zyx')[0]) print(f"Comparison | NumPy | PhiFlow") def get_str(name, func, vals): return " | ".join( [ f"{name:<10}", f"{func(vals[0]):<10.4f}", f"{func(vals[1]):<10.4f}", ] ) print(get_str("Mean (s)", np.mean, (np_times, phi_times))) print(get_str("Median (s)", np.median, (np_times, phi_times))) print(get_str("Min (s)", np.min, (np_times, phi_times))) print(get_str("Max (s)", np.max, (np_times, phi_times)))
3,950
14,668
// Copyright 2020 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 "chromecast/media/cma/backend/proxy/audio_decoder_pipeline_node.h" #include "chromecast/media/api/decoder_buffer_base.h" #include "chromecast/public/media/decoder_config.h" #include "chromecast/public/media/media_pipeline_device_params.h" namespace chromecast { namespace media { AudioDecoderPipelineNode::AudioDecoderPipelineNode( CmaBackend::AudioDecoder* delegated_decoder) : delegated_decoder_(delegated_decoder) { DCHECK(delegated_decoder_); } AudioDecoderPipelineNode::~AudioDecoderPipelineNode() = default; void AudioDecoderPipelineNode::SetDelegate( CmaBackend::Decoder::Delegate* delegate) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); delegated_decoder_delegate_ = delegate; delegated_decoder_->SetDelegate(this); } CmaBackend::Decoder::BufferStatus AudioDecoderPipelineNode::PushBuffer( scoped_refptr<DecoderBufferBase> buffer) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return delegated_decoder_->PushBuffer(std::move(buffer)); } bool AudioDecoderPipelineNode::SetConfig(const AudioConfig& config) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return delegated_decoder_->SetConfig(config); } bool AudioDecoderPipelineNode::SetVolume(float multiplier) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return delegated_decoder_->SetVolume(multiplier); } CmaBackend::AudioDecoder::RenderingDelay AudioDecoderPipelineNode::GetRenderingDelay() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return delegated_decoder_->GetRenderingDelay(); } void AudioDecoderPipelineNode::GetStatistics( CmaBackend::AudioDecoder::Statistics* statistics) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return delegated_decoder_->GetStatistics(statistics); } bool AudioDecoderPipelineNode::RequiresDecryption() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return delegated_decoder_->RequiresDecryption(); } void AudioDecoderPipelineNode::SetObserver( CmaBackend::AudioDecoder::Observer* observer) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); delegated_decoder_->SetObserver(observer); } void AudioDecoderPipelineNode::SetOwnedDecoder( std::unique_ptr<AudioDecoderPipelineNode> delegated_decoder) { DCHECK_EQ(delegated_decoder.get(), delegated_decoder_); owned_delegated_decoder_ = std::move(delegated_decoder); } void AudioDecoderPipelineNode::OnPushBufferComplete( CmaBackend::Decoder::BufferStatus status) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(delegated_decoder_delegate_); delegated_decoder_delegate_->OnPushBufferComplete(status); } void AudioDecoderPipelineNode::OnEndOfStream() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(delegated_decoder_delegate_); delegated_decoder_delegate_->OnEndOfStream(); } void AudioDecoderPipelineNode::OnDecoderError() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(delegated_decoder_delegate_); delegated_decoder_delegate_->OnDecoderError(); } void AudioDecoderPipelineNode::OnKeyStatusChanged(const std::string& key_id, CastKeyStatus key_status, uint32_t system_code) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(delegated_decoder_delegate_); delegated_decoder_delegate_->OnKeyStatusChanged(key_id, key_status, system_code); } void AudioDecoderPipelineNode::OnVideoResolutionChanged(const Size& size) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(delegated_decoder_delegate_); delegated_decoder_delegate_->OnVideoResolutionChanged(size); } } // namespace media } // namespace chromecast
1,484
7,857
#include "QtCore/QSettings/qsettings_wrap.h" #include "Extras/Utils/nutils.h" #include "QtCore/QVariant/qvariant_wrap.h" Napi::FunctionReference QSettingsWrap::constructor; Napi::Object QSettingsWrap::init(Napi::Env env, Napi::Object exports) { Napi::HandleScope scope(env); char CLASSNAME[] = "QSettings"; Napi::Function func = DefineClass(env, CLASSNAME, {InstanceMethod("sync", &QSettingsWrap::sync), InstanceMethod("setValue", &QSettingsWrap::setValue), InstanceMethod("value", &QSettingsWrap::value), COMPONENT_WRAPPED_METHODS_EXPORT_DEFINE(QSettingsWrap)}); constructor = Napi::Persistent(func); exports.Set(CLASSNAME, func); return exports; } QSettingsWrap::QSettingsWrap(const Napi::CallbackInfo& info) : Napi::ObjectWrap<QSettingsWrap>(info) { Napi::Env env = info.Env(); QString organization = QString::fromUtf8(info[0].As<Napi::String>().Utf8Value().c_str()); QString application = QString::fromUtf8(info[1].As<Napi::String>().Utf8Value().c_str()); this->instance = std::make_unique<QSettings>(organization, application); this->rawData = extrautils::configureQObject(this->getInternalInstance()); } Napi::Value QSettingsWrap::setValue(const Napi::CallbackInfo& info) { Napi::Env env = info.Env(); QString key = QString::fromUtf8(info[0].As<Napi::String>().Utf8Value().c_str()); Napi::Value value = info[1]; QVariant* valueVariant = extrautils::convertToQVariant(env, value); this->instance.get()->setValue(key, *valueVariant); delete valueVariant; return env.Null(); } Napi::Value QSettingsWrap::value(const Napi::CallbackInfo& info) { Napi::Env env = info.Env(); QString key = QString::fromUtf8(info[0].As<Napi::String>().Utf8Value().c_str()); QVariant value = this->instance.get()->value(key); auto instance = QVariantWrap::constructor.New( {Napi::External<QVariant>::New(env, new QVariant(value))}); return instance; } Napi::Value QSettingsWrap::sync(const Napi::CallbackInfo& info) { Napi::Env env = info.Env(); this->instance.get()->sync(); return env.Null(); } QSettings* QSettingsWrap::getInternalInstance() { return this->instance.get(); } QSettingsWrap::~QSettingsWrap() { this->instance.reset(); }
892
553
<gh_stars>100-1000 package com.muses.base.search.biz; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.highlight.*; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; import java.io.IOException; import java.io.StringReader; import java.nio.file.Paths; /** * <pre> * Lucene全局搜索服务类 * </pre> * * @author nicky * @version 1.00.00 * * <pre> * 修改记录 * 修改后版本: 修改人: 修改日期:2018年04月18日 修改内容: * </pre> */ public class SearchBuilder { public static void doSearch(String indexDir , String queryStr) throws IOException, ParseException, InvalidTokenOffsetsException { Directory directory = FSDirectory.open(Paths.get(indexDir)); DirectoryReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); Analyzer analyzer = new SmartChineseAnalyzer(); QueryParser parser = new QueryParser("tcontent",analyzer); Query query = parser.parse(queryStr); long startTime = System.currentTimeMillis(); TopDocs docs = searcher.search(query,10); System.out.println("查找"+queryStr+"所用时间:"+(System.currentTimeMillis()-startTime)); System.out.println("查询到"+docs.totalHits+"条记录"); //加入高亮显示的 SimpleHTMLFormatter simpleHTMLFormatter = new SimpleHTMLFormatter("<b><font color=red>","</font></b>"); QueryScorer scorer = new QueryScorer(query);//计算查询结果最高的得分 Fragmenter fragmenter = new SimpleSpanFragmenter(scorer);//根据得分算出一个片段 Highlighter highlighter = new Highlighter(simpleHTMLFormatter,scorer); highlighter.setTextFragmenter(fragmenter);//设置显示高亮的片段 //遍历查询结果 for(ScoreDoc scoreDoc : docs.scoreDocs){ Document doc = searcher.doc(scoreDoc.doc); System.out.println(doc.get("title")); System.out.println(doc.get("tcontent")); String tcontent = doc.get("tcontent"); if(tcontent != null){ TokenStream tokenStream = analyzer.tokenStream("tcontent", new StringReader(tcontent)); String summary = highlighter.getBestFragment(tokenStream, tcontent); System.out.println(summary); } } reader.close(); } public static void main(String[] args){ String indexDir = "D:\\lucene"; String q = "内容1"; //查询这个字符串 try { doSearch(indexDir, q); } catch (Exception e) { e.printStackTrace(); } } }
1,411
1,091
/* * Copyright 2018-present Open Networking Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onosproject.openstackvtap.codec; import com.fasterxml.jackson.databind.JsonNode; import org.hamcrest.Description; import org.hamcrest.TypeSafeDiagnosingMatcher; import org.onosproject.openstackvtap.api.OpenstackVtapNetwork; import java.util.Objects; /** * Hamcrest matcher for openstack vtap network. */ public final class OpenstackVtapNetworkJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> { private final OpenstackVtapNetwork vtapNetwork; private static final String MODE = "mode"; private static final String NETWORK_ID = "networkId"; private static final String SERVER_IP = "serverIp"; private OpenstackVtapNetworkJsonMatcher(OpenstackVtapNetwork vtapNetwork) { this.vtapNetwork = vtapNetwork; } @Override protected boolean matchesSafely(JsonNode jsonNode, Description description) { // check mode String jsonMode = jsonNode.get(MODE).asText(); String mode = String.valueOf(vtapNetwork.mode()); if (!Objects.equals(jsonMode, mode)) { description.appendText("mode was " + jsonMode); return false; } // check network id int jsonNetworkId = jsonNode.get(NETWORK_ID).asInt(); int networkId = vtapNetwork.networkId(); if (jsonNetworkId != networkId) { description.appendText("network id was " + jsonNetworkId); return false; } // check server IP String jsonServerIp = jsonNode.get(SERVER_IP).asText(); String serverIp = vtapNetwork.serverIp().toString(); if (!jsonServerIp.equals(serverIp)) { description.appendText("Server IP was " + jsonServerIp); return false; } return true; } @Override public void describeTo(Description description) { description.appendText(vtapNetwork.toString()); } /** * Factory to allocate an openstack vtap network matcher. * * @param vtapNetwork openstack vtap network object we are looking for * @return matcher */ public static OpenstackVtapNetworkJsonMatcher matchesVtapNetwork(OpenstackVtapNetwork vtapNetwork) { return new OpenstackVtapNetworkJsonMatcher(vtapNetwork); } }
1,006
348
<reponame>chamberone/Leaflet.PixiOverlay<gh_stars>100-1000 {"nom":"Morthomiers","circ":"2ème circonscription","dpt":"Cher","inscrits":494,"abs":263,"votants":231,"blancs":11,"nuls":6,"exp":214,"res":[{"nuance":"MDM","nom":"<NAME>","voix":111},{"nuance":"COM","nom":"<NAME>","voix":103}]}
117
1,682
/* Copyright (c) 2020 LinkedIn Corp. 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.linkedin.d2.balancer.strategies.framework; /** * The interface to manage the number of requests sent in each interval */ interface RequestCountManager { /** * Provide the total request count for a given interval * @param intervalIndex The index of the current interval * @return The total call count that the test will send in the interval */ int getRequestCount(int intervalIndex); }
270
678
<reponame>RockerHX/FishChat // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // #import "ReaderMessageViewModel.h" @class NSString; @interface VideoReaderMessageViewModel : ReaderMessageViewModel { _Bool m_isTitleMultiRow; } + (_Bool)canCreateMessageViewModelWithMessageWrap:(id)arg1; @property(readonly, nonatomic) _Bool isTitleLabelMultiRow; @property(readonly, nonatomic) NSString *titleText; @property(readonly, nonatomic) NSString *timeText; @property(readonly, nonatomic) NSString *coverImageURL; @property(readonly, nonatomic) unsigned long long titleLabelFontSize; @property(readonly, nonatomic) unsigned long long titleLabelWidth; @property(readonly, nonatomic) unsigned long long messageNodeViewBottomMargin; @property(readonly, nonatomic) unsigned long long messageNodeViewHeight; @property(readonly, nonatomic) unsigned long long messageNodeViewWidth; - (struct CGSize)measureContentViewSize:(struct CGSize)arg1; - (id)cellViewClassName; @end
332
1,350
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.storage.models; import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.storage.fluent.models.ImmutabilityPolicyProperty; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** The properties of an ImmutabilityPolicy of a blob container. */ @Fluent public final class ImmutabilityPolicyProperties { @JsonIgnore private final ClientLogger logger = new ClientLogger(ImmutabilityPolicyProperties.class); /* * The properties of an ImmutabilityPolicy of a blob container. */ @JsonProperty(value = "properties") private ImmutabilityPolicyProperty innerProperties; /* * ImmutabilityPolicy Etag. */ @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) private String etag; /* * The ImmutabilityPolicy update history of the blob container. */ @JsonProperty(value = "updateHistory", access = JsonProperty.Access.WRITE_ONLY) private List<UpdateHistoryProperty> updateHistory; /** * Get the innerProperties property: The properties of an ImmutabilityPolicy of a blob container. * * @return the innerProperties value. */ private ImmutabilityPolicyProperty innerProperties() { return this.innerProperties; } /** * Get the etag property: ImmutabilityPolicy Etag. * * @return the etag value. */ public String etag() { return this.etag; } /** * Get the updateHistory property: The ImmutabilityPolicy update history of the blob container. * * @return the updateHistory value. */ public List<UpdateHistoryProperty> updateHistory() { return this.updateHistory; } /** * Get the immutabilityPeriodSinceCreationInDays property: The immutability period for the blobs in the container * since the policy creation, in days. * * @return the immutabilityPeriodSinceCreationInDays value. */ public Integer immutabilityPeriodSinceCreationInDays() { return this.innerProperties() == null ? null : this.innerProperties().immutabilityPeriodSinceCreationInDays(); } /** * Set the immutabilityPeriodSinceCreationInDays property: The immutability period for the blobs in the container * since the policy creation, in days. * * @param immutabilityPeriodSinceCreationInDays the immutabilityPeriodSinceCreationInDays value to set. * @return the ImmutabilityPolicyProperties object itself. */ public ImmutabilityPolicyProperties withImmutabilityPeriodSinceCreationInDays( Integer immutabilityPeriodSinceCreationInDays) { if (this.innerProperties() == null) { this.innerProperties = new ImmutabilityPolicyProperty(); } this.innerProperties().withImmutabilityPeriodSinceCreationInDays(immutabilityPeriodSinceCreationInDays); return this; } /** * Get the state property: The ImmutabilityPolicy state of a blob container, possible values include: Locked and * Unlocked. * * @return the state value. */ public ImmutabilityPolicyState state() { return this.innerProperties() == null ? null : this.innerProperties().state(); } /** * Get the allowProtectedAppendWrites property: This property can only be changed for unlocked time-based retention * policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and * compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property * cannot be changed with ExtendImmutabilityPolicy API. * * @return the allowProtectedAppendWrites value. */ public Boolean allowProtectedAppendWrites() { return this.innerProperties() == null ? null : this.innerProperties().allowProtectedAppendWrites(); } /** * Set the allowProtectedAppendWrites property: This property can only be changed for unlocked time-based retention * policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and * compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property * cannot be changed with ExtendImmutabilityPolicy API. * * @param allowProtectedAppendWrites the allowProtectedAppendWrites value to set. * @return the ImmutabilityPolicyProperties object itself. */ public ImmutabilityPolicyProperties withAllowProtectedAppendWrites(Boolean allowProtectedAppendWrites) { if (this.innerProperties() == null) { this.innerProperties = new ImmutabilityPolicyProperty(); } this.innerProperties().withAllowProtectedAppendWrites(allowProtectedAppendWrites); return this; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } if (updateHistory() != null) { updateHistory().forEach(e -> e.validate()); } } }
1,828
872
<gh_stars>100-1000 #!/usr/bin/python3 """ Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i]. Return any permutation of A that maximizes its advantage with respect to B. Example 1: Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15] Example 2: Input: A = [12,24,8,32], B = [13,25,32,11] Output: [24,32,8,12] Note: 1 <= A.length = B.length <= 10000 0 <= A[i] <= 10^9 0 <= B[i] <= 10^9 """ from typing import List from collections import defaultdict class Solution: def advantageCount(self, A: List[int], B: List[int]) -> List[int]: """ Gready select the smallest larger number Then we need sort A Iterate B and do a bisect on A? Hard to remove the chosen element on A unless using a balanced BST How about we sort B also? Like a merge sort, compare both sorted A and sorted B But we need to record the position of B's element since sorting break the position Keep a reverse index mapping is not enough, since duplicate in B then keep a list """ idxes = defaultdict(list) for i, b in enumerate(B): idxes[b].append(i) n = len(A) A.sort() B.sort() ret = [None for _ in range(n)] not_used = [] j = 0 for a in A: if a > B[j]: i = idxes[B[j]].pop() ret[i] = a j += 1 else: not_used.append(a) for i in range(n): if ret[i] is None: ret[i] = not_used.pop() return ret if __name__ == "__main__": assert Solution().advantageCount([2,7,11,15], [1,10,4,11]) == [2,11,7,15]
827
611
<reponame>theredled/idea-php-symfony2-plugin<filename>src/main/java/fr/adrienbrault/idea/symfony2plugin/twig/annotation/TemplateAnnotationReferences.java package fr.adrienbrault.idea.symfony2plugin.twig.annotation; import com.intellij.psi.PsiReference; import com.jetbrains.php.lang.psi.elements.StringLiteralExpression; import de.espend.idea.php.annotation.extension.PhpAnnotationReferenceProvider; import de.espend.idea.php.annotation.extension.parameter.AnnotationPropertyParameter; import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; import fr.adrienbrault.idea.symfony2plugin.Symfony2ProjectComponent; import fr.adrienbrault.idea.symfony2plugin.templating.TemplateReference; import fr.adrienbrault.idea.symfony2plugin.templating.util.TwigUtil; import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil; import org.jetbrains.annotations.Nullable; /** * @author <NAME> <<EMAIL>> */ public class TemplateAnnotationReferences implements PhpAnnotationReferenceProvider { @Nullable @Override public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) { if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression) || !PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), TwigUtil.TEMPLATE_ANNOTATION_CLASS)) { return new PsiReference[0]; } if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.DEFAULT) { // @Foo("template.html.twig") return new PsiReference[]{ new TemplateReference((StringLiteralExpression) annotationPropertyParameter.getElement()) }; } else if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE || "template".equals(annotationPropertyParameter.getPropertyName())) { // @Foo(template="template.html.twig") return new PsiReference[]{ new TemplateReference((StringLiteralExpression) annotationPropertyParameter.getElement()) }; } return new PsiReference[0]; } }
763
5,279
<filename>sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/OnTimerInvokerFactory.java /* * 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.beam.sdk.transforms.reflect; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.transforms.DoFn.OnTimer; import org.apache.beam.sdk.transforms.DoFn.TimerId; /** * Provides {@link OnTimerInvoker} instances for invoking a particular {@link TimerId} on a * particular {@link DoFn}. */ interface OnTimerInvokerFactory { /** * Returns an invoker that will call the given {@link DoFn DoFn's} {@link OnTimer @OnTimer} method * for the given {@code timerId}. */ <InputT, OutputT> OnTimerInvoker<InputT, OutputT> forTimer( DoFn<InputT, OutputT> fn, String timerId); }
459
819
<filename>seurat/ingest/proto_view_group_loader.cc<gh_stars>100-1000 /* Copyright 2017 Google Inc. 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. */ #include "seurat/ingest/proto_view_group_loader.h" #include <memory> #include "ion/math/transformutils.h" #include "absl/strings/str_cat.h" #include "seurat/base/camera_util.h" #include "seurat/base/math_util.h" #include "seurat/base/parallel.h" #include "seurat/base/status_util.h" #include "seurat/base/util.h" namespace seurat { namespace ingest { namespace { // Returns the filename(s) referenced in the |ldi_proto| in a string. This is // useful to compose error messages. std::string GetLdiFilenames(const api::proto::Ldi& ldi_proto) { switch (ldi_proto.ldi_case()) { case api::proto::Ldi::LdiCase::LDI_NOT_SET: return "unspecified file"; case api::proto::Ldi::LdiCase::kLdiFile: return ldi_proto.ldi_file().path(); case api::proto::Ldi::LdiCase::kDepthImageFile: return ldi_proto.depth_image_file().color().path() + " and " + ldi_proto.depth_image_file().color().path(); } } } // namespace ProtoViewGroupLoader::ProtoViewGroupLoader( const api::proto::Capture& capture, int thread_count, std::unique_ptr<LdiLoader> ldi_loader, std::shared_ptr<base::FileSystem> file_system) : capture_(capture), thread_count_(thread_count), ldi_loader_(std::move(ldi_loader)), file_system_(std::move(file_system)) {} int ProtoViewGroupLoader::GetNumViewGroups() const { return capture_.view_groups_size(); } base::Status ProtoViewGroupLoader::LoadViewGroup( int view_group_index, std::vector<std::shared_ptr<base::Camera>>* cameras, std::vector<image::Ldi4f>* ldis) const { if (view_group_index >= GetNumViewGroups()) { return base::OutOfRangeError(absl::StrCat( "view_group_index ", view_group_index, " out of range. Number of view groups is ", GetNumViewGroups())); } api::proto::ViewGroup view_group = capture_.view_groups(view_group_index); if (ldis != nullptr) { ldis->clear(); ldis->resize(view_group.views_size()); } if (cameras != nullptr) { cameras->clear(); cameras->resize(view_group.views_size()); } std::vector<base::Status> per_view_status(view_group.views_size()); // Note, protobuf supports multiple reader threads, provided there are no // writers. base::ParallelFor( thread_count_, view_group.views_size(), [&](int view_index) { api::proto::View view = view_group.views(view_index); std::unique_ptr<base::Camera> camera; if (capture_.has_headbox_center()) { const ion::math::Vector3f translation = ion::math::Point3f::Zero() - base::Point3fFromProto(capture_.headbox_center()); camera = base::TranslateCamera(translation, base::CameraFromProto(view.camera())); } else { camera = base::CameraFromProto(view.camera()); } ion::math::Vector2i image_size = camera->GetImageSize(); if (cameras != nullptr) { (*cameras)[view_index] = std::move(camera); } if (ldis != nullptr) { api::proto::Ldi ldi_proto = view.ldi(); // Try loading the ldi. Set status and early out if it fails. image::Ldi4f ldi; per_view_status[view_index] = ldi_loader_->Load(ldi_proto, file_system_.get(), &ldi); if (!per_view_status[view_index].ok()) { return; } // Verify that the size of the LDI matches the image size specified in // the proto. Set status and early out if they don't match. ion::math::Vector2i ldi_size = ldi.GetSize(); if (ldi_size != image_size) { per_view_status[view_index] = base::InvalidArgumentError( absl::StrCat("Actual image size ", ldi_size[0], "x", ldi_size[1], " of ", GetLdiFilenames(ldi_proto), " does not match image size ", image_size[0], "x", image_size[1], " specified in manifest file.")); return; } // Store the LDI only if there were no errors. if (per_view_status[view_index].ok()) { ldis->at(view_index) = std::move(ldi); } } }); // If an error occurred, return only the status from the first thread that // failed. for (auto const& view_status : per_view_status) { SEURAT_RETURN_IF_ERROR(view_status); } return base::OkStatus(); } } // namespace ingest } // namespace seurat
2,120
476
<gh_stars>100-1000 #include "planes.h" #include "../glx/hardext.h" #include "loader.h" #include "matrix.h" #include "matvec.h" void APIENTRY_GL4ES gl4es_glClipPlanef(GLenum plane, const GLfloat *equation) { /* When glClipPlane is called, equation is transformed by the inverse of the modelview matrix and stored in the resulting eye coordinates. Subsequent changes to the modelview matrix have no effect on the stored plane-equation components. If the dot product of the eye coordinates of a vertex with the stored plane equation components is positive or zero, the vertex is in with respect to that clipping plane. Otherwise, it is out. */ PUSH_IF_COMPILING(glClipPlanef); //TODO: fix that, equation is an array and should be copied before beeing put in the stack if((plane<GL_CLIP_PLANE0) || (plane>=GL_CLIP_PLANE0+hardext.maxplanes)) { errorShim(GL_INVALID_ENUM); return; } if(hardext.esversion==1) { LOAD_GLES2(glClipPlanef); errorGL(); gles_glClipPlanef(plane, equation); } else { // TODO: should fist compute the clipplane and compare to stored one before sending to hardware int p = plane-GL_CLIP_PLANE0; matrix_vector(getInvMVMat(), equation, glstate->planes[p]); //Tested, seems ok noerrorShim(); } } AliasExport(void,glClipPlanef,,(GLenum pname, const GLfloat* params));
548
852
/**\class CSCToAFEB * * CSC layer, wire vs AFEB channel map. * * \author <NAME>, CMU */ #include <OnlineDB/CSCCondDB/interface/CSCToAFEB.h> #include <iostream> using namespace std; /// return AFEB channel number int CSCToAFEB::getAfebCh(int layer, int wiregroup) const { int wire = wiregroup - 8 * ((wiregroup - 1) / 8); int channel = layer_wire_to_channel_[layer - 1][wire - 1]; return channel; } /// return AFEB position number int CSCToAFEB::getAfebPos(int layer, int wiregroup) const { int col = (wiregroup - 1) / 8 + 1; int wire = wiregroup - 8 * ((wiregroup - 1) / 8); int afeb = (col - 1) * 3 + layer_wire_to_board_[layer - 1][wire - 1]; return afeb; } /// return layer number int CSCToAFEB::getLayer(int afeb, int channel) const { int col = (afeb - 1) / 3 + 1; int pos_in_col = afeb - (col - 1) * 3; int layer = pos_in_col * 2 - 1; if (channel < 5 || (channel > 8 && channel < 13)) layer++; return layer; } /// return wiregroup number int CSCToAFEB::getWireGroup(int afeb, int channel) const { int col = (afeb - 1) / 3 + 1; int wire = (col - 1) * 8 + 1; if (channel < 5) wire = wire + (channel - 1); if (channel > 4 && channel < 9) wire = wire + (channel - 5); if (channel > 8 && channel < 13) wire = wire + (channel - 5); if (channel > 12) wire = wire + (channel - 9); return wire; } /// return max. number of AFEBs int CSCToAFEB::getMaxAfeb(int station, int ring) const { return station_ring_to_nmxafeb_[station - 1][ring - 1]; } /// return max. number of wiregroups per plane int CSCToAFEB::getMaxWire(int station, int ring) const { return station_ring_to_nmxwire_[station - 1][ring - 1]; }
626
396
package com.yeungeek.monkeyandroid.ui.main; import com.yeungeek.monkeyandroid.data.DataManager; import com.yeungeek.monkeyandroid.data.model.User; import com.yeungeek.monkeyandroid.rxbus.event.BusEvent; import com.yeungeek.monkeyandroid.rxbus.event.SignInEvent; import com.yeungeek.monkeyandroid.ui.base.presenter.MvpLceRxPresenter; import com.yeungeek.mvp.common.MvpPresenter; import javax.inject.Inject; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; import rx.schedulers.Schedulers; import rx.subscriptions.CompositeSubscription; import timber.log.Timber; /** * Created by yeungeek on 2016/3/12. */ public class MainPresenter extends MvpLceRxPresenter<MainMvpView, User> implements MvpPresenter<MainMvpView> { private final DataManager dataManager; private CompositeSubscription mSubscriptions; @Inject public MainPresenter(final DataManager dataManager) { this.dataManager = dataManager; } @Override public void attachView(MainMvpView view) { super.attachView(view); mSubscriptions = new CompositeSubscription(); mSubscriptions.add(dataManager.getRxBus().toObservable() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<Object>() { @Override public void call(Object o) { if (o instanceof SignInEvent) { SignInEvent event = (SignInEvent) o; if (null != event.getUri().getQueryParameter("code")) { String code = event.getUri().getQueryParameter("code"); Timber.d("### receive event code: %s", code); getAccessToken(code); } } else if (o instanceof BusEvent.AuthenticationError) { dataManager.clearWebCache(); getView().unauthorized(); } } })); } @Override public void detachView(boolean retainInstance) { super.detachView(retainInstance); mSubscriptions.unsubscribe(); } public void getAccessToken(String code) { subscribe(dataManager.getAccessToken(code), false); } public void checkUserStatus() { User user = null; if (null != dataManager.getPreferencesHelper().getAccessToken()) { //if token is exist, user is exist user = new User(); user.setLogin(dataManager.getPreferencesHelper().getUserLogin()); user.setEmail(dataManager.getPreferencesHelper().getUserEmail()); user.setAvatar_url(dataManager.getPreferencesHelper().getUserAvatar()); } getView().setData(user); } }
1,333
1,272
<reponame>immortalkrazy/avs-device-sdk /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0/ * * or in the "license" file accompanying this file. This file 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 ACSDKAUTHORIZATION_LWA_LWAAUTHORIZATIONADAPTER_H_ #define ACSDKAUTHORIZATION_LWA_LWAAUTHORIZATIONADAPTER_H_ #include <condition_variable> #include <thread> #include <acsdkAuthorization/LWA/LWAAuthorizationConfiguration.h> #include <acsdkAuthorizationInterfaces/AuthorizationAdapterInterface.h> #include <acsdkAuthorizationInterfaces/LWA/LWAAuthorizationInterface.h> #include <acsdkAuthorizationInterfaces/LWA/LWAAuthorizationStorageInterface.h> #include <AVSCommon/Utils/Configuration/ConfigurationNode.h> #include <AVSCommon/Utils/DeviceInfo.h> #include <AVSCommon/Utils/LibcurlUtils/HttpGetInterface.h> #include <AVSCommon/Utils/LibcurlUtils/HttpPostInterface.h> #include <AVSCommon/Utils/Optional.h> #include <AVSCommon/Utils/RetryTimer.h> namespace alexaClientSDK { namespace acsdkAuthorization { namespace lwa { /** * This class provides functionality for the application to authorize using LWA methods. * * The class does not currently support reauthorization. If authorization has occurred, then * the application should call logout before authorizing. * * @attention It is the responsibility of the application to acquire the appropriate customer consent. Please * refer to @c LWAAuthorizationInterface for more details. */ class LWAAuthorizationAdapter : public acsdkAuthorizationInterfaces::lwa::LWAAuthorizationInterface , public acsdkAuthorizationInterfaces::AuthorizationAdapterInterface , public std::enable_shared_from_this<LWAAuthorizationAdapter> { public: /// Destructor ~LWAAuthorizationAdapter(); /** * Creates an instance of LWAAuthorizationAdapter. * * @param configuration The configuration node. * @param httpPost An object for making HTTPPost requests. * @param deviceInfo Device info. * @param storage Persisted storage. * @param httpGet An object for making HTTPGet requests. * @param adapterId Allows for specifying an alternate adapterId to the default. * @return An instance if successful or null. */ static std::shared_ptr<LWAAuthorizationAdapter> create( const std::shared_ptr<avsCommon::utils::configuration::ConfigurationNode>& configuration, std::unique_ptr<avsCommon::utils::libcurlUtils::HttpPostInterface> httpPost, const std::shared_ptr<avsCommon::utils::DeviceInfo>& deviceInfo, const std::shared_ptr<acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface>& storage, std::unique_ptr<avsCommon::utils::libcurlUtils::HttpGetInterface> httpGet = nullptr, const std::string& adapterId = ""); /// @name LWAAuthorizationInterface /// @{ bool authorizeUsingCBL( const std::shared_ptr<acsdkAuthorizationInterfaces::lwa::CBLAuthorizationObserverInterface>& observer) override; bool authorizeUsingCBLWithCustomerProfile( const std::shared_ptr<acsdkAuthorizationInterfaces::lwa::CBLAuthorizationObserverInterface>& observer) override; /// @} /// @name AuthorizationInterface /// @{ std::string getId() override; /// @} /// @name AuthorizationAdapterInterface /// @{ std::string getAuthToken() override; void reset() override; void onAuthFailure(const std::string& authToken) override; avsCommon::sdkInterfaces::AuthObserverInterface::FullState getState() override; std::shared_ptr<acsdkAuthorizationInterfaces::AuthorizationInterface> getAuthorizationInterface() override; avsCommon::sdkInterfaces::AuthObserverInterface::FullState onAuthorizationManagerReady( const std::shared_ptr<acsdkAuthorizationInterfaces::AuthorizationManagerInterface>& manager) override; /// @} private: /// An enum for different token exchange types. enum class TokenExchangeMethod { /** * No active Token Exchange Method. Note: In cases where the refreshToken is retrieved * from persisted storage, this will be applicable. */ NONE, /// Using the Code Based Linking method. CBL }; /** * Contains information from a Refresh Token response. */ struct RefreshTokenResponse { /// The refresh token. std::string refreshToken; /// The access token. std::string accessToken; /// The time the refresh request was made. std::chrono::steady_clock::time_point requestTime; /// The expiration duration.. std::chrono::seconds expiration; /** * Whether or not this refresh token has been exchanged for an access token and verified. * Initial responses from LWA will have this set to false. */ bool isRefreshTokenVerified; /// Constructor. RefreshTokenResponse() : refreshToken{""}, accessToken{""}, requestTime{std::chrono::steady_clock::now()}, expiration{std::chrono::seconds::zero()}, isRefreshTokenVerified{true} { } /** * Returns the a timepoint representing when the token will expire. * * @return The expiration time. */ std::chrono::steady_clock::time_point getExpirationTime() const { return requestTime + expiration; } }; /** * An enum to track the current state of the @c LWAAuthorizationAdapter. */ enum class FlowState { /** * Currently waiting for an authorization request. */ IDLE, /** * No valid refresh token, restart the authorization process by requesting a token from @c LWA. * This can take various forms. * * For CBL: * Request a code pair from @c LWA, retrying if required until a valid one is received. * Once a valid code pair is acquired, ask the user to authorize by browsing * to a verification URL (supplied by LWA with the code pair) and entering the user_code from the * code pair. * * Once a refresh token is obtained, transition to REFFRESHING_TOKEN. */ REQUESTING_TOKEN, /** * Have a refresh token, and may have a valid access token. Periodically refresh (or acquire) an * access token so that if possible, a valid access token is always available. */ REFRESHING_TOKEN, /** * Transition to this state as a cleanup after a reset() call and the data has been cleared. Transition back to * IDLE. */ CLEARING_DATA, /** * Either a shutdown has been triggered or an unrecoverable error has been encountered. Stop * the adapter and prepare for exit. */ STOPPING }; /// Constructor. LWAAuthorizationAdapter( const std::string& adapterId, std::unique_ptr<avsCommon::utils::libcurlUtils::HttpPostInterface> httpPost, const std::shared_ptr<acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface>& storage, std::unique_ptr<avsCommon::utils::libcurlUtils::HttpGetInterface> httpGet); /** * Initializes. * * @param configuration The configuration node object. * @param devceInfo The devce info object. * @return Whether initialization was successful. */ bool init( const avsCommon::utils::configuration::ConfigurationNode& configuration, const std::shared_ptr<avsCommon::utils::DeviceInfo>& deviceInfo); /** * Loads persisted data to determine the initialization state. * * @return The state to start at. */ FlowState retrievePersistedData(); /** * Use a refresh token to request a new access token. * * @return The response to the request. */ avsCommon::utils::libcurlUtils::HTTPResponse requestRefresh(std::chrono::steady_clock::time_point* requestTime); /** * Handles the IDLE state as described above. * * @return The next state to transition to. */ FlowState handleIdle(); /** * Handles the REQUESTING_TOKEN state as described above. * * @return The next state to transition to. */ FlowState handleRequestingToken(); /** * Handles the REFRESHING_TOKEN state as described above. * * @return The next state to transition to. */ FlowState handleRefreshingToken(); /** * Handles the CLEARING_DATA state as described above. * * @return The next state to transition to. */ FlowState handleClearingData(); /** * Handles the STOPPING state as described above. * * @return The next state to transition to. */ FlowState handleStopping(); /** * Method run in its own thread to handle the authorization flow. * * @param state The starting state. */ void handleAuthorizationFlow(FlowState state); /// @name CBL Methods /// @{ bool authorizeUsingCBLHelper( const std::shared_ptr<acsdkAuthorizationInterfaces::lwa::CBLAuthorizationObserverInterface>& observer, bool requestCustomerProfile); /** * Requests a Code Pair from LWA. This will retry. On success, this will notify the * CBLAuthorizationObserverInterface of the verification URI and user code. * * @return The error associated with the request. An empty Optional indicates the request was cancelled due to * logout or shutdown. Error::SUCCESS indicates a successful request. Else, the appropriate error will be added. */ avsCommon::utils::Optional<avsCommon::sdkInterfaces::AuthObserverInterface::Error> requestCodePair(); /** * Request a @c device_code, @c user_code pair from @c LWA. Besides alexa::all, if @c m_requestCustomerProfile is * false, this will request the userId portion. Otherwise, it will request additionally name and email. This does * NOT request postal code. * * @return The response to the request. */ avsCommon::utils::libcurlUtils::HTTPResponse sendCodePairRequest(); /** * Handle receiving the response to a code pair request. * * @param response The response to handle. * @return The resulting status. */ avsCommon::sdkInterfaces::AuthObserverInterface::Error receiveCodePairResponse( const avsCommon::utils::libcurlUtils::HTTPResponse& response); /** * Makes a request to LWA with the device code and user code received in @c handleRequestingCodePair and waits for a * response. On success, LWA will send down a refresh token, access token, expiration, and token type. * * @return The error associated with the request. An empty Optional indicates the request was cancelled due to * logout or shutdown. Error::SUCCESS indicates a successful request. Else, the appropriate error will be added. */ avsCommon::utils::Optional<avsCommon::sdkInterfaces::AuthObserverInterface::Error> exchangeToken( RefreshTokenResponse* tokenResponse); /** * Requests the token from LWA. * * @param[out] The time the request was made. * @return The HTTPResponse. */ avsCommon::utils::libcurlUtils::HTTPResponse sendTokenRequest(std::chrono::steady_clock::time_point* requestTime); /// @} /** * Parses the LWA response and retrieves the refresh token, access token, token type, and expiration. * * @param response The response. * @param expiresImmediately Forces the returned tokenResponse to expire immediately. * @param[out] tokenResponse The token response. * @return Whether an error occurred. */ avsCommon::sdkInterfaces::AuthObserverInterface::Error receiveTokenResponse( const avsCommon::utils::libcurlUtils::HTTPResponse& response, bool expiresImmediately, struct RefreshTokenResponse* tokenResponse); /** * A wrapper function that acquires the lock before caling @c shouldStopRetryingLocked(); * * @return If retry loops should stop. */ bool shouldStopRetrying(); /** * Checks if various stages should continue to retry. This will return true * if a reset() to clear data or if shutdown is ongoing. The lock must be held before calling this. * * @return If retry loops should stop. */ bool shouldStopRetryingLocked(); /** * Checks if the adapter is shutting down. * * @return If the adapter is shutting down. */ bool isShuttingDown(); /** * Stop the adapter. */ void stop(); /** * A wrapper function that acquires the mutex and then calls @c setRefreshTokenResponseLocked(). * * @param response The response to cache. * @param persist Whether to persist the refreshToken. */ void setRefreshTokenResponse(const RefreshTokenResponse& response, bool persist = true); /** * Cache the refreshToken response and set it as the currently active and valid one. This will contain a valid * access token. m_mutex must be held before calling this. * * @param response The response to cache. * @param persist Whether to persist the refreshToken. */ void setRefreshTokenResponseLocked(const RefreshTokenResponse& response, bool persist = true); /** * Updates the state and reports to @c AuthorizationManagerInterface the new state. * * @param state The state. * @param error The error. */ void updateStateAndNotifyManager( avsCommon::sdkInterfaces::AuthObserverInterface::State state, avsCommon::sdkInterfaces::AuthObserverInterface::Error error); /** * A function that gets customer profile information. One reason for failure is that the access token was not * generated with the appropriate scopes. * * @param getCustomerProfile Whether to request the full user profile. * @return Whether this was successful. */ bool getCustomerProfile(const std::string& accessToken); /// Mutex used to serialize access to various data members. std::mutex m_mutex; /** * HTTP/POST client with which to make @c LWA requests. * Access is not synchronized because it is only accessed by @c m_authorizationFlowThread. */ std::unique_ptr<avsCommon::utils::libcurlUtils::HttpPostInterface> m_httpPost; /** * HTTP/GET client with which to make @c LWA requests. * Access is not synchronized because it is only accessed by @c m_authorizationFlowThread. */ std::unique_ptr<avsCommon::utils::libcurlUtils::HttpGetInterface> m_httpGet; /// The storage instance used to persist information. std::shared_ptr<acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface> m_storage; /// Configuration parameters std::unique_ptr<LWAAuthorizationConfiguration> m_configuration; /// The current auth state. avsCommon::sdkInterfaces::AuthObserverInterface::State m_authState; /// The current error state. avsCommon::sdkInterfaces::AuthObserverInterface::Error m_authError; /// UserId. std::string m_userId; /// Condition variable used to wake waits on @c m_authorizationFlowThread. std::condition_variable m_wake; /// The main thread that this operates on. std::thread m_authorizationFlowThread; /// @ name CBL /// @{ /// The code expiration time. std::chrono::steady_clock::time_point m_codePairExpirationTime; /// device-code value returned from a successful code pair request. std::string m_deviceCode; /// user-code value returned from a successful code pair request. std::string m_userCode; /// The interval to make token requests to LWA. std::chrono::seconds m_tokenRequestInterval; /// The observer that will respond to CBL related callbacks. std::shared_ptr<acsdkAuthorizationInterfaces::lwa::CBLAuthorizationObserverInterface> m_cblRequester; /// Whether to request extended customer profile information such as name and email. bool m_requestCustomerProfile; /// @} /// True if an authorization failure was reported for the current value of m_accessToken. bool m_authFailureReported; /// The current authorization method that is used. TokenExchangeMethod m_authMethod; /// The active refresh token state associated. RefreshTokenResponse m_refreshTokenResponse; /// The instance of @c AuthorizationManagerInterface. std::shared_ptr<acsdkAuthorizationInterfaces::AuthorizationManagerInterface> m_manager; /// Whether the adapter is shutting down. bool m_isShuttingDown; /// Whether the adapter is reset and clearing data. bool m_isClearingData; /// The adapter id. const std::string m_adapterId; }; } // namespace lwa } // namespace acsdkAuthorization } // namespace alexaClientSDK #endif // ACSDKAUTHORIZATION_LWA_LWAAUTHORIZATIONADAPTER_H_
5,942
359
/* * Copyright (C) 2021 Xilinx, Inc * SPDX-License-Identifier: Apache-2.0 */ /**************************************************************** Kernel to kernel streaming example consisting of three compute units in a linear hardware pipeline. 1) Adder kernel that adds two input vectors from global memory and streams result to output stream 2) Streaming kernel that increments input stream with a scalar adder and streams result to output 3) Multiplier kernel that multiplies a global memory vector with the stream output of the streaming kernel and writes result into global memory. _____________ |add |<----- in1 (global memory) | in1 + in2 |<----- in2 (global memory) |_____________|------+ _____________ | (s1) AXI4 Stream |incr |<-----+ | s1 + adder1 |<----- adder1 (scalar) | + adder2 |<----- adder2 (scalar) |_____________|----->+ _____________ | (s2) AXI4 Stream |mult |<-----+ | s2 * in3 |<----- in3 (global memory) |_____________|-----> out (global memory) out = [in1 + in2 + adder1 + adder2] * in3 The incr kernel is built as an AP_CTRL_CHAIN kernel with mailbox and restart counter using: config_interface -s_axilite_mailbox both config_interface -s_axilite_auto_restart_counter 1 The test harness allows the user to specify how many times the pipeline should be iterated. The scalar adders to the 'incr' kernel are incremented and decremented in lock step in each iteration. The final output is validated against its expected value and if different exists with error. This example illustrates running the above pipeline *without* using the mailbox and restart counter feature of the incr kernel, essentially the 'incr' kernel is started in iteration just like the 'add' and 'mult' kernel are started. While the 'incr' kernel is compiled with mailbox and restart counter, the xclbin contains no meta data to reflect mailbox and counter. As a POC work-around, xrt.ini is used to specify which kernels have what features. % cat xrt.ini [Runtime] mailbox_kernels="/krnl_stream_vdatamover/" auto_restart_kernels="/krnl_stream_vdatamover/" Syntax being "/kname1/kname2/.../" where knameN is the name of the kernel (not the name of a compute unit). Undefined behavior if this convention is not followed or if the provided kernel names identifies kernels without the specified features. ****************************************************************/ // % g++ -g -std=c++14 -I$XILINX_XRT/include -L$XILINX_XRT/lib -o no_mailbox.exe no_mailbox.cpp -lxrt_coreutil -luuid -pthread // % mailbox.exe -k <xclbin> [--iter <iterations>] // The incr kernel scalar 'adder' argument is incremented by 1 in each iteration. // See xclbin.mk for building xclbin for desired platform #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <vector> #include "xrt/xrt_kernel.h" #include "experimental/xrt_ip.h" #include "experimental/xrt_ini.h" #include "experimental/xrt_mailbox.h" #ifdef _WIN32 # pragma warning( disable : 4996 ) #endif using value_type = std::uint32_t; static size_t data_size = 8 * 1024 * 1024; static size_t data_size_bytes = sizeof(int) * data_size; static void usage() { std::cout << "usage: %s [options] \n\n"; std::cout << " -k <bitstream>\n"; std::cout << " -d <bdf | device_index>\n"; std::cout << ""; std::cout << " [--iter <number>]: number of counted restarts of streaming kernel\n"; std::cout << ""; std::cout << "* Program runs the pipeline [add]-[incr]-[mult] specified number of times\n"; } static bool is_hw_emulation() { static auto xem = std::getenv("XCL_EMULATION_MODE"); static bool hwem = xem ? std::strcmp(xem,"hw_emu")==0 : false; return hwem; } static bool is_sw_emulation() { static auto xem = std::getenv("XCL_EMULATION_MODE"); static bool swem = xem ? std::strcmp(xem,"sw_emu")==0 : false; return swem; } static void adjust_for_emulation() { if (!is_hw_emulation() && !is_sw_emulation()) return; data_size = 4096; data_size_bytes = data_size * sizeof(int); } static void run(const xrt::device& device, const xrt::uuid& uuid, unsigned int iter) { // add(in1, in2, nullptr, data_size) xrt::kernel add(device, uuid, "krnl_stream_vadd"); xrt::bo in1(device, data_size_bytes, add.group_id(0)); auto in1_data = in1.map<int*>(); xrt::bo in2(device, data_size_bytes, add.group_id(1)); auto in2_data = in2.map<int*>(); // mult(in3, nullptr, out, data_size) xrt::kernel mult(device, uuid, "krnl_stream_vmult"); xrt::bo in3(device, data_size_bytes, mult.group_id(0)); auto in3_data = in3.map<int*>(); xrt::bo out(device, data_size_bytes, mult.group_id(2)); auto out_data = out.map<int*>(); // incr(nullptr, nullptr, adder1, adder2) xrt::kernel incr(device, uuid, "krnl_stream_vdatamover"); int adder1 = 20; // arbitrarily chosen to be different from 0 int adder2 = 10; // arbitrarily chosen to be different from 0 // create run objects for re-use in loop xrt::run add_run(add); xrt::run mult_run(mult); xrt::run incr_run(incr); // computed expected result std::vector<int> sw_out_data(data_size); bool error = false; // indicates error in any of the iterations for (unsigned int cnt = 0; cnt < iter; ++cnt) { std::cout << "iteration: " << cnt << " (adder1,adder2): " << adder1 << ',' << adder2 << ")\n"; // create the test data and software result for(size_t i = 0; i < data_size; ++i) { in1_data[i] = static_cast<int>(i); in2_data[i] = 2 * static_cast<int>(i); in3_data[i] = static_cast<int>(i); out_data[i] = 0; sw_out_data[i] = (in1_data[i] + in2_data[i] + adder1 + adder2) * in3_data[i]; } // sync test data to kernel in1.sync(XCL_BO_SYNC_BO_TO_DEVICE); in2.sync(XCL_BO_SYNC_BO_TO_DEVICE); in3.sync(XCL_BO_SYNC_BO_TO_DEVICE); // start the pipeline add_run(in1, in2, nullptr, data_size); incr_run(nullptr, nullptr, adder1++, adder2--); mult_run(in3, nullptr, out, data_size); // wait for all stages to complete add_run.wait(); incr_run.wait(); mult_run.wait(); // sync result from device to host out.sync(XCL_BO_SYNC_BO_FROM_DEVICE); // compare with expected scalar adder for (size_t i = 0 ; i < data_size; i++) { if (out_data[i] != sw_out_data[i]) { std::cout << "error in iteration = " << cnt << " expected output = " << sw_out_data[i] << " observed output = " << out_data[i] << " adder1 = " << adder1 - 1 << " adder2 = " << adder2 + 1 << '\n'; throw std::runtime_error("result mismatch"); } } } } static void run(int argc, char** argv) { std::vector<std::string> args(argv+1,argv+argc); std::string xclbin_fnm; std::string device_id = "0"; unsigned int iter = 1; std::string cur; for (auto& arg : args) { if (arg == "-h") { usage(); return; } if (arg[0] == '-') { cur = arg; continue; } if (cur == "-d") device_id = arg; else if (cur == "-k") xclbin_fnm = arg; else if (cur == "--iter") iter = std::stoul(arg); else throw std::runtime_error("bad argument '" + cur + " " + arg + "'"); } adjust_for_emulation(); // Disable ert to avoid scheduler arming interrupts on the xrt::ip controlled xrt::ini::set("Runtime.ert", false); xrt::xclbin xclbin{xclbin_fnm}; xrt::device device{device_id}; auto uuid = device.load_xclbin(xclbin); run(device, uuid, iter); } int main(int argc, char* argv[]) { try { run(argc,argv); std::cout << "TEST PASSED\n"; return 0; } catch (const std::exception& ex) { std::cout << "TEST FAILED: " << ex.what() << "\n"; } catch (...) { std::cout << "TEST FAILED\n"; } return 1; }
3,097
772
{ "no-NO": { "data": { "bubble_choice_description": { "courseD_bee_nestedLoops8_2021": "Samle inn all nektaren fra hver blomst og lag honning i alle bikubene. Bruk løkke i løkke." } } } }
110
648
<reponame>kiyoon/Video-Swin-Transformer import numpy as np from mmcv.utils import assert_dict_has_keys from numpy.testing import assert_array_equal from mmaction.datasets.pipelines import ColorJitter class TestColor: @staticmethod def test_color_jitter(): imgs = list( np.random.randint(0, 255, size=(3, 112, 112, 3), dtype=np.uint8)) results = dict(imgs=imgs) eig_val = np.array([55.46, 4.794, 1.148], dtype=np.float32) eig_vec = np.array([[-0.5675, 0.7192, 0.4009], [-0.5808, -0.0045, -0.8140], [-0.5836, -0.6948, 0.4203]], dtype=np.float32) color_jitter = ColorJitter() assert_array_equal(color_jitter.eig_val, eig_val) assert_array_equal(color_jitter.eig_vec, eig_vec) assert color_jitter.alpha_std == 0.1 assert color_jitter.color_space_aug is False color_jitter_results = color_jitter(results) target_keys = [ 'imgs', 'eig_val', 'eig_vec', 'alpha_std', 'color_space_aug' ] assert assert_dict_has_keys(color_jitter_results, target_keys) assert np.shape(color_jitter_results['imgs']) == (3, 112, 112, 3) assert_array_equal(color_jitter_results['eig_val'], eig_val) assert_array_equal(color_jitter_results['eig_vec'], eig_vec) assert color_jitter_results['alpha_std'] == 0.1 assert color_jitter_results['color_space_aug'] is False custom_eig_val = np.ones(3, ) custom_eig_vec = np.ones((3, 3)) imgs = list( np.random.randint(0, 255, size=(3, 64, 80, 3), dtype=np.uint8)) results = dict(imgs=imgs) custom_color_jitter = ColorJitter(True, 0.5, custom_eig_val, custom_eig_vec) assert_array_equal(color_jitter.eig_val, eig_val) assert_array_equal(color_jitter.eig_vec, eig_vec) assert custom_color_jitter.alpha_std == 0.5 assert custom_color_jitter.color_space_aug is True custom_color_jitter_results = custom_color_jitter(results) assert np.shape(custom_color_jitter_results['imgs']) == (3, 64, 80, 3) assert_array_equal(custom_color_jitter_results['eig_val'], custom_eig_val) assert_array_equal(custom_color_jitter_results['eig_vec'], custom_eig_vec) assert custom_color_jitter_results['alpha_std'] == 0.5 assert custom_color_jitter_results['color_space_aug'] is True color_jitter = ColorJitter() assert repr(color_jitter) == (f'{color_jitter.__class__.__name__}(' f'color_space_aug={False}, ' f'alpha_std={0.1}, ' f'eig_val={eig_val}, ' f'eig_vec={eig_vec})')
1,530
8,451
<gh_stars>1000+ /******************************************************************************* * ___ _ ____ ____ * / _ \ _ _ ___ ___| |_| _ \| __ ) * | | | | | | |/ _ \/ __| __| | | | _ \ * | |_| | |_| | __/\__ \ |_| |_| | |_) | * \__\_\\__,_|\___||___/\__|____/|____/ * * Copyright (c) 2014-2019 Appsicle * Copyright (c) 2019-2020 QuestDB * * 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.questdb.griffin.model; import io.questdb.std.Mutable; import io.questdb.std.ObjectFactory; import io.questdb.std.Sinkable; import io.questdb.std.str.CharSink; public class CopyModel implements ExecutionModel, Mutable, Sinkable { public static final ObjectFactory<CopyModel> FACTORY = CopyModel::new; private ExpressionNode tableName; private ExpressionNode fileName; private boolean header; @Override public void clear() { } public ExpressionNode getFileName() { return fileName; } public void setFileName(ExpressionNode fileName) { this.fileName = fileName; } @Override public int getModelType() { return ExecutionModel.COPY; } public ExpressionNode getTableName() { return tableName; } public void setTableName(ExpressionNode tableName) { this.tableName = tableName; } public boolean isHeader() { return header; } public void setHeader(boolean header) { this.header = header; } @Override public void toSink(CharSink sink) { } }
748
348
<reponame>chamberone/Leaflet.PixiOverlay<gh_stars>100-1000 {"nom":"Cessey","circ":"1ère circonscription","dpt":"Doubs","inscrits":301,"abs":172,"votants":129,"blancs":12,"nuls":4,"exp":113,"res":[{"nuance":"SOC","nom":"Mme <NAME>","voix":65},{"nuance":"REM","nom":"Mme <NAME>","voix":48}]}
119
322
<filename>torch_ipex/csrc/verbose.cpp #include "verbose.hpp" #include "cpu/mkldnn/MKLDNNCommon.h" namespace torch_ipex { namespace verbose { int _mkldnn_set_verbose(int level) { return torch_ipex::cpu::mkldnn_set_verbose(level); } } // namespace verbose } // namespace torch_ipex
115
1,821
<reponame>hangqiu/pixie /* * Copyright 2018- The Pixie 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. * * SPDX-License-Identifier: Apache-2.0 */ #include "src/stirling/source_connectors/socket_tracer/protocols/redis/stitcher.h" #include <string> #include "src/common/testing/testing.h" namespace px { namespace stirling { namespace protocols { using ::testing::AllOf; using ::testing::ElementsAre; using ::testing::Field; using ::testing::IsEmpty; using ::testing::StrEq; redis::Message CreateMsg(uint64_t ts_ns, std::string payload, std::string_view command) { redis::Message msg; msg.timestamp_ns = ts_ns; msg.payload = std::move(payload); msg.command = command; return msg; } redis::Message CreatePubMsg(uint64_t ts_ns, std::string payload, std::string_view command) { redis::Message msg = CreateMsg(ts_ns, payload, command); msg.is_published_message = true; return msg; } auto EqualsRecord(const std::string& req_cmd, const std::string& req_payload, const std::string& resp_payload) { return AllOf(Field(&redis::Record::req, // command field is std::string_view, we don't know how to cast Field() to // std::string, and has to reply on the default == operator. The error message // is very difficult to read. AllOf(Field(&redis::Message::command, req_cmd), Field(&redis::Message::payload, req_payload))), Field(&redis::Record::resp, Field(&redis::Message::payload, StrEq(resp_payload)))); } // Tests that the published messages are exported correctly. TEST(StitchFramesTest, PubMessagesExported) { std::deque<redis::Message> reqs; std::deque<redis::Message> resps; resps.push_back(CreatePubMsg(0, R"(["message", "foo", "test1"])", "MESSAGE")); resps.push_back(CreatePubMsg(1, R"(["message", "foo", "test2"])", "MESSAGE")); NoState no_state; RecordsWithErrorCount<redis::Record> res = StitchFrames<redis::Record>(&reqs, &resps, &no_state); EXPECT_EQ(res.error_count, 0); EXPECT_THAT(res.records, ElementsAre(EqualsRecord(R"(PUSH PUB)", "", R"(["message", "foo", "test1"])"), EqualsRecord(R"(PUSH PUB)", "", R"(["message", "foo", "test2"])"))); EXPECT_THAT(resps, IsEmpty()); } // Tests that the command message in responses are exported directly. TEST(StitchFramesTest, ReplConfAckAndMutationCommands) { std::deque<redis::Message> reqs = { CreateMsg(1, "repl_ack_payload_0", "REPLCONF ACK"), CreateMsg(3, "repl_ack_payload_1", "REPLCONF ACK"), CreateMsg(4, "", "PING"), }; std::deque<redis::Message> resps = { CreateMsg(0, "hset_payload_0", "HSET"), CreateMsg(5, "PONG", ""), }; NoState no_state; RecordsWithErrorCount<redis::Record> res = StitchFrames<redis::Record>(&reqs, &resps, &no_state); EXPECT_EQ(res.error_count, 0); EXPECT_THAT(res.records, ElementsAre(EqualsRecord("HSET", "hset_payload_0", ""), EqualsRecord("REPLCONF ACK", "repl_ack_payload_0", ""), EqualsRecord("REPLCONF ACK", "repl_ack_payload_1", ""), EqualsRecord("PING", "", "PONG"))); EXPECT_THAT(reqs, IsEmpty()); EXPECT_THAT(resps, IsEmpty()); } } // namespace protocols } // namespace stirling } // namespace px
1,576