text
stringlengths
2
100k
meta
dict
<%@ page import='java.util.*,com.doublechaintech.retailscm.*,com.doublechaintech.retailscm.employeeskill.EmployeeSkill'%> <%@ page language="java" contentType="text/plain; charset=utf-8"%> <%@ page isELIgnored="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="sky" tagdir="/tags"%> <fmt:setLocale value="zh_CN"/> <c:set var="ignoreListAccessControl" value="${true}"/> <!DOCTYPE html> <html lang="en" slick-uniqueid="3"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <base href="${baseURL}/" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <title> ${userContext.localeMap['@system_name']} </title> <!-- Bootstrap core CSS --> <link href="./bootstrap/bootstrap.min.css" rel="stylesheet"> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <link href="./bootstrap/ie10-viewport-bug-workaround.css" rel="stylesheet"> <link href="./bootstrap/jquery-ui.css" rel="stylesheet"> <!-- Custom styles for this template --> <link href="./bootstrap/dashboard.css" rel="stylesheet"> <link href="./bootstrap/font-awesome.min.css" rel="stylesheet"> <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <script src="./bootstrap/ie-emulation-modes-warning.js"></script> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> <style type="text/css">* { text-shadow: transparent 0px 0px 0px, rgba(0,0,0,0.68) 0px 0px 0px !important; } </style> </head> <body > <div class="container-fluid"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 main"> <div class="table-responsive" id="content"> <!-- real content --> <c:set var="ownerBeanName" value="employeeSkill" scope="request"/> <c:set var="ownerClassName" value="EmployeeSkill" scope="request"/> <div id="msg"></div> <div class="row"> <div class="col-xs-12 col-md-12"> <c:if test="${not empty result.errorMessageList}" > <ul> <c:forEach var="item" items="${result.errorMessageList}"> <div class="alert alert-success"> ${item.sourcePosition} ${item.body} </div> </c:forEach> </ul> </c:if> </div> </div> <!--<div class="row">--> <div class="row"> </div> <div class="row"> <div class="col-xs-12 col-md-12"> <ul class="nav nav-tabs" id="navi-tabs"> <li class="active"><a data-toggle="tab" href="#summary" class="disabled"><i class="fa fa-home"></i> ${userContext.localeMap['@summary']}</a></li> <% EmployeeSkill result = (EmployeeSkill)request.getAttribute("result"); %> </ul> </div> </div> <div class="tab-content" id='tab-content'> <div id="summary" class="tab-pane fade in active"> <div class="row"> <div class="col-xs-12 col-md-12"> </div> </div> <div class="row" desc="show parent objects"> <c:set var="employeeSkill" value="${ result}" scope="request" /> <sky:include page="com/doublechaintech/retailscm/employeeskill/EmployeeSkill$Summary.jsp" /> </div> <div class="row"> <c:set var="employee" value="${ result.employee}" scope="request" /> <c:set var="referName" value="" scope="request" /> <sky:include page="com/doublechaintech/retailscm/employee/Employee$Info.jsp" /> <c:set var="skillType" value="${ result.skillType}" scope="request" /> <c:set var="referName" value="" scope="request" /> <sky:include page="com/doublechaintech/retailscm/skilltype/SkillType$Info.jsp" /> </div> </div><!-- end of <div id="summary" class="tab-pane fade in active">--> </div><!--<div class="tab-content" style="padding-top: 10px">--> <!-- /real content --> </div> </div><!-- <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> --> </div><!-- <div class="row"> --> </div> <div id="footer"> <div class="col-xs-12 navbar-inverse navbar-fixed-bottom"> <div class="row" id="bottomNav"> <div class="col-xs-3 text-center"> <a href="./secUserManager/home/"><i class="glyphicon glyphicon-home"></i><br/>${userContext.localeMap['@home_page']}</a> </div> <div class="col-xs-3 text-center"> <a href="./secUserManager/home/"><i class="glyphicon glyphicon-envelope"></i><br>${userContext.localeMap['@message']}</a> </div> <div class="col-xs-3 text-center"> <a href="./secUserManager/home/"><i class="glyphicon glyphicon-envelope"></i><br>${userContext.localeMap['@message']}</a> </div> <div class="col-xs-3 text-center"> <a href="./secUserManager/showlogin/"> <i class="glyphicon glyphicon-user"></i><br>${userContext.localeMap['@log_out']}</a> </div> </div> </div> </div> <!-- --><!-- /.footer --> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="./bootstrap/jquery.min.js"></script> <script src="./bootstrap/jquery-ui.min.js"></script> <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script> <script src="./bootstrap/bootstrap.min.js"></script> <!-- Just to make our placeholder images work. Don't actually copy the next line! --> <script src="./bootstrap/holder.min.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="./bootstrap/ie10-viewport-bug-workaround.js"></script> <script src="./scripts/qrcode.js" type="text/javascript"></script> <script> var qrLocaleLabel = "${userContext.localeMap['@qr_code']}"; var scanQRTips = "${userContext.localeMap['@qr_scan_to_continue']}"; $("a[data-toggle='tab']").removeClass("disabled"); </script> <script src="./scripts/common.js" type="text/javascript"></script> <script src="./bootstrap/bootstrap3-typeahead.js" type="text/javascript"></script> </body></html>
{ "pile_set_name": "Github" }
# flake8: noqa """A Python library for controlling YeeLight RGB bulbs.""" from yeelight.main import Bulb, BulbType, BulbException, discover_bulbs from yeelight.flow import Flow, HSVTransition, RGBTransition, TemperatureTransition, SleepTransition from yeelight.version import __version__
{ "pile_set_name": "Github" }
second
{ "pile_set_name": "Github" }
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/checkData.R \name{checkData} \alias{checkData} \title{check input data type and format and coerce to the desired output type} \usage{ checkData( x, method = c("xts", "zoo", "data.frame", "matrix", "vector"), na.rm = TRUE, quiet = TRUE, ... ) } \arguments{ \item{x}{a vector, matrix, data.frame, xts, timeSeries or zoo object to be checked and coerced} \item{method}{type of coerced data object to return, one of c("xts", "zoo", "data.frame", "matrix", "vector"), default "xts"} \item{na.rm}{TRUE/FALSE Remove NA's from the data? used only with 'vector'} \item{quiet}{TRUE/FALSE if false, it will throw warnings when errors are noticed, default TRUE} \item{\dots}{any other passthru parameters} } \description{ This function was created to make the different kinds of data classes at least \emph{seem} more fungible. It allows the user to pass in a data object without being concerned that the function requires a matrix, data.frame, vector, xts, or timeSeries object. By using \code{checkData}, the function "knows" what data format it has to work with. } \examples{ data(edhec) x = checkData(edhec) class(x) head(x) tail(x) # Note that passing in a single column loses the row and column names x = checkData(edhec[,1]) class(x) head(x) # Include the "drop" attribute to keep row and column names x = checkData(edhec[,1,drop=FALSE]) class(x) head(x) x = checkData(edhec, method = "matrix") class(x) head(x) x = checkData(edhec[,1], method = "vector") class(x) head(x) } \author{ Peter Carl }
{ "pile_set_name": "Github" }
// Copyright 2015 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/v8.h" #if V8_TARGET_ARCH_S390 #include "src/ic/access-compiler.h" namespace v8 { namespace internal { #define __ ACCESS_MASM(masm) void PropertyAccessCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { __ Jump(code, RelocInfo::CODE_TARGET); } void PropertyAccessCompiler::InitializePlatformSpecific( AccessCompilerData* data) { Register receiver = LoadDescriptor::ReceiverRegister(); Register name = LoadDescriptor::NameRegister(); // Load calling convention. // receiver, name, scratch1, scratch2, scratch3. Register load_registers[] = {receiver, name, r5, r2, r6}; // Store calling convention. // receiver, name, scratch1, scratch2. Register store_registers[] = {receiver, name, r5, r6}; data->Initialize(arraysize(load_registers), load_registers, arraysize(store_registers), store_registers); } #undef __ } // namespace internal } // namespace v8 #endif // V8_TARGET_ARCH_S390
{ "pile_set_name": "Github" }
/* Copyright 2017 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 cleaner implements an automated cleaner that does garbage collection // on CSRs that meet specific criteria. With automated CSR requests and // automated approvals, the volume of CSRs only increases over time, at a rapid // rate if the certificate duration is short. package cleaner import ( "context" "crypto/x509" "encoding/pem" "fmt" "time" "k8s.io/klog/v2" capi "k8s.io/api/certificates/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" certificatesinformers "k8s.io/client-go/informers/certificates/v1" csrclient "k8s.io/client-go/kubernetes/typed/certificates/v1" certificateslisters "k8s.io/client-go/listers/certificates/v1" ) const ( // The interval to list all CSRs and check each one against the criteria to // automatically clean it up. pollingInterval = 1 * time.Hour // The time periods after which these different CSR statuses should be // cleaned up. approvedExpiration = 1 * time.Hour deniedExpiration = 1 * time.Hour failedExpiration = 1 * time.Hour pendingExpiration = 24 * time.Hour ) // CSRCleanerController is a controller that garbage collects old certificate // signing requests (CSRs). Since there are mechanisms that automatically // create CSRs, and mechanisms that automatically approve CSRs, in order to // prevent a build up of CSRs over time, it is necessary to GC them. CSRs will // be removed if they meet one of the following criteria: the CSR is Approved // with a certificate and is old enough to be past the GC issued deadline, the // CSR is denied and is old enough to be past the GC denied deadline, the CSR // is Pending and is old enough to be past the GC pending deadline, the CSR is // approved with a certificate and the certificate is expired. type CSRCleanerController struct { csrClient csrclient.CertificateSigningRequestInterface csrLister certificateslisters.CertificateSigningRequestLister } // NewCSRCleanerController creates a new CSRCleanerController. func NewCSRCleanerController( csrClient csrclient.CertificateSigningRequestInterface, csrInformer certificatesinformers.CertificateSigningRequestInformer, ) *CSRCleanerController { return &CSRCleanerController{ csrClient: csrClient, csrLister: csrInformer.Lister(), } } // Run the main goroutine responsible for watching and syncing jobs. func (ccc *CSRCleanerController) Run(workers int, stopCh <-chan struct{}) { defer utilruntime.HandleCrash() klog.Infof("Starting CSR cleaner controller") defer klog.Infof("Shutting down CSR cleaner controller") for i := 0; i < workers; i++ { go wait.Until(ccc.worker, pollingInterval, stopCh) } <-stopCh } // worker runs a thread that dequeues CSRs, handles them, and marks them done. func (ccc *CSRCleanerController) worker() { csrs, err := ccc.csrLister.List(labels.Everything()) if err != nil { klog.Errorf("Unable to list CSRs: %v", err) return } for _, csr := range csrs { if err := ccc.handle(csr); err != nil { klog.Errorf("Error while attempting to clean CSR %q: %v", csr.Name, err) } } } func (ccc *CSRCleanerController) handle(csr *capi.CertificateSigningRequest) error { isIssuedExpired, err := isIssuedExpired(csr) if err != nil { return err } if isIssuedPastDeadline(csr) || isDeniedPastDeadline(csr) || isFailedPastDeadline(csr) || isPendingPastDeadline(csr) || isIssuedExpired { if err := ccc.csrClient.Delete(context.TODO(), csr.Name, metav1.DeleteOptions{}); err != nil { return fmt.Errorf("unable to delete CSR %q: %v", csr.Name, err) } } return nil } // isIssuedExpired checks if the CSR has been issued a certificate and if the // expiration of the certificate (the NotAfter value) has passed. func isIssuedExpired(csr *capi.CertificateSigningRequest) (bool, error) { isExpired, err := isExpired(csr) if err != nil { return false, err } for _, c := range csr.Status.Conditions { if c.Type == capi.CertificateApproved && isIssued(csr) && isExpired { klog.Infof("Cleaning CSR %q as the associated certificate is expired.", csr.Name) return true, nil } } return false, nil } // isPendingPastDeadline checks if the certificate has a Pending status and the // creation time of the CSR is passed the deadline that pending requests are // maintained for. func isPendingPastDeadline(csr *capi.CertificateSigningRequest) bool { // If there are no Conditions on the status, the CSR will appear via // `kubectl` as `Pending`. if len(csr.Status.Conditions) == 0 && isOlderThan(csr.CreationTimestamp, pendingExpiration) { klog.Infof("Cleaning CSR %q as it is more than %v old and unhandled.", csr.Name, pendingExpiration) return true } return false } // isDeniedPastDeadline checks if the certificate has a Denied status and the // creation time of the CSR is passed the deadline that denied requests are // maintained for. func isDeniedPastDeadline(csr *capi.CertificateSigningRequest) bool { for _, c := range csr.Status.Conditions { if c.Type == capi.CertificateDenied && isOlderThan(c.LastUpdateTime, deniedExpiration) { klog.Infof("Cleaning CSR %q as it is more than %v old and denied.", csr.Name, deniedExpiration) return true } } return false } // isFailedPastDeadline checks if the certificate has a Failed status and the // creation time of the CSR is passed the deadline that pending requests are // maintained for. func isFailedPastDeadline(csr *capi.CertificateSigningRequest) bool { for _, c := range csr.Status.Conditions { if c.Type == capi.CertificateFailed && isOlderThan(c.LastUpdateTime, deniedExpiration) { klog.Infof("Cleaning CSR %q as it is more than %v old and failed.", csr.Name, deniedExpiration) return true } } return false } // isIssuedPastDeadline checks if the certificate has an Issued status and the // creation time of the CSR is passed the deadline that issued requests are // maintained for. func isIssuedPastDeadline(csr *capi.CertificateSigningRequest) bool { for _, c := range csr.Status.Conditions { if c.Type == capi.CertificateApproved && isIssued(csr) && isOlderThan(c.LastUpdateTime, approvedExpiration) { klog.Infof("Cleaning CSR %q as it is more than %v old and approved.", csr.Name, approvedExpiration) return true } } return false } // isOlderThan checks that t is a non-zero time after time.Now() + d. func isOlderThan(t metav1.Time, d time.Duration) bool { return !t.IsZero() && t.Sub(time.Now()) < -1*d } // isIssued checks if the CSR has `Issued` status. There is no explicit // 'Issued' status. Implicitly, if there is a certificate associated with the // CSR, the CSR statuses that are visible via `kubectl` will include 'Issued'. func isIssued(csr *capi.CertificateSigningRequest) bool { return len(csr.Status.Certificate) > 0 } // isExpired checks if the CSR has a certificate and the date in the `NotAfter` // field has gone by. func isExpired(csr *capi.CertificateSigningRequest) (bool, error) { if len(csr.Status.Certificate) == 0 { return false, nil } block, _ := pem.Decode(csr.Status.Certificate) if block == nil { return false, fmt.Errorf("expected the certificate associated with the CSR to be PEM encoded") } certs, err := x509.ParseCertificates(block.Bytes) if err != nil { return false, fmt.Errorf("unable to parse certificate data: %v", err) } if len(certs) == 0 { return false, fmt.Errorf("no certificates found") } return time.Now().After(certs[0].NotAfter), nil }
{ "pile_set_name": "Github" }
#[doc = "Reader of register PIDR3"] pub type R = crate::R<u32, super::PIDR3>; impl R {}
{ "pile_set_name": "Github" }
-- boundary2.test -- -- db eval { -- SELECT a FROM t1 WHERE r <= 72057594037927935 ORDER BY x -- } SELECT a FROM t1 WHERE r <= 72057594037927935 ORDER BY x
{ "pile_set_name": "Github" }
/******************************************************************************* * Copyright (c) 2015, 2016 Pivotal, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v10.html * * Contributors: * Pivotal, Inc. - initial API and implementation *******************************************************************************/ package org.springframework.ide.eclipse.editor.support.reconcile; import org.eclipse.core.resources.IProject; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.IDocument; import org.springframework.ide.eclipse.editor.support.util.UserInteractions; /** * Provides access to additional context info and objects that quickfixes might * need in order to be able to apply themselves. * * @author Kris De Volder */ public interface QuickfixContext { IProject getProject(); IPreferenceStore getWorkspacePreferences(); IPreferenceStore getProjectPreferences(); IJavaProject getJavaProject(); UserInteractions getUI(); IDocument getDocument(); }
{ "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 lister-gen. DO NOT EDIT. package v1 // ControllerRevisionListerExpansion allows custom methods to be added to // ControllerRevisionLister. type ControllerRevisionListerExpansion interface{} // ControllerRevisionNamespaceListerExpansion allows custom methods to be added to // ControllerRevisionNamespaceLister. type ControllerRevisionNamespaceListerExpansion interface{}
{ "pile_set_name": "Github" }
namespace N2.Addons.Wiki.UI.Views { public partial class Version : WikiTemplatePage { protected Items.WikiArticle CurrentVersion { get { int versionID = int.Parse(CurrentArguments); return Engine.Persister.Get<Items.WikiArticle>(versionID); } } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Source Files"> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> <UniqueIdentifier>{56F9A5EA-1486-4EE7-8BA0-B1BF57D0E43C}</UniqueIdentifier> </Filter> <Filter Include="Header Files"> <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> <UniqueIdentifier>{CD736472-4C15-48A4-AA49-E7504430AB74}</UniqueIdentifier> </Filter> <Filter Include="Resource Files"> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> <UniqueIdentifier>{81231740-0300-4CC2-8D01-AA32FB32CFA6}</UniqueIdentifier> </Filter> <Filter Include="Driver Files"> <Extensions>inf;inv;inx;mof;mc;</Extensions> <UniqueIdentifier>{B76F6C65-12C8-4CA2-9BFE-4EE31CADE60D}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\adapter.c"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\ctrlpath.c"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\datapath.c"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\miniport.c"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\mphal.c"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\tcbrcb.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ResourceCompile Include="netvmini60.rc"> <Filter>Resource Files</Filter> </ResourceCompile> </ItemGroup> </Project>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> <object class="GtkApplicationWindow" id="window1"> <property name="title" translatable="yes">Builder Basics</property> <property name="default_width">320</property> <property name="default_height">240</property> <child> <object class="GtkButton" id="button1"> <property name="label" translatable="yes">Big Useless Button</property> </object> </child> </object> <object class="GtkMessageDialog" id="messagedialog1"> <property name="can_focus">False</property> <property name="type_hint">dialog</property> <property name="transient_for">window1</property> <child internal-child="vbox"> <object class="GtkBox" id="messagedialog-vbox1"> <property name="name">msgdialog</property> <property name="width_request">300</property> <property name="can_focus">False</property> <property name="tooltip_markup" translatable="yes">Thank you for trying this example</property> <property name="resize_mode">immediate</property> <property name="orientation">vertical</property> <property name="spacing">2</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area1"> <property name="can_focus">False</property> <property name="layout_style">end</property> <child> <placeholder/> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">end</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">You have pressed the button</property> <property name="ellipsize">end</property> <property name="width_chars">40</property> <property name="lines">1</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> </packing> </child> </object> </child> </object> </interface>
{ "pile_set_name": "Github" }
# Copyright 2013 the V8 project authors. All rights reserved. # Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Tests that the CompareEq optimization for the case where one side is predicted final object and the other side is predicted either final object or other (i.e. null or undefined) doesn't assert when both sides are also proven final object. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS foo({f:42}, null) threw exception TypeError: Cannot read property 'f' of null. PASS foo(o, o) is [42, 42, true] PASS successfullyParsed is true TEST COMPLETE
{ "pile_set_name": "Github" }
#!/usr/bin/env python # 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. # # Recovers Greenplum segment instances that are marked as invalid, if # mirroring is configured and operational # # # THIS IMPORT MUST COME FIRST # # import mainUtils FIRST to get python version check from gppylib.mainUtils import * from gppylib.programs.clsSystemState import * #------------------------------------------------------------------------- if __name__ == '__main__': options = {} options["programNameOverride"] = "gpstate" # for now since we are invoked from the real gpstate options["suppressStartupLogMessage"] = False # since we are called from another program it's funny to print what we were called with simple_main( GpSystemStateProgram.createParser, GpSystemStateProgram.createProgram, options)
{ "pile_set_name": "Github" }
@testable import struct MongoSwift.ReadPreference import MongoSwiftSync extension MongoDatabaseOptions: Decodable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let readConcern = try container.decodeIfPresent(ReadConcern.self, forKey: .readConcern) let readPreference = try container.decodeIfPresent(ReadPreference.self, forKey: .readPreference) let writeConcern = try container.decodeIfPresent(WriteConcern.self, forKey: .writeConcern) self.init(readConcern: readConcern, readPreference: readPreference, writeConcern: writeConcern) } private enum CodingKeys: CodingKey { case readConcern, readPreference, writeConcern } } extension MongoCollectionOptions: Decodable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let readConcern = try container.decodeIfPresent(ReadConcern.self, forKey: .readConcern) let writeConcern = try container.decodeIfPresent(WriteConcern.self, forKey: .writeConcern) self.init(readConcern: readConcern, writeConcern: writeConcern) } private enum CodingKeys: CodingKey { case readConcern, writeConcern } } extension ClientSessionOptions: Decodable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let causalConsistency = try container.decodeIfPresent(Bool.self, forKey: .causalConsistency) let defaultTransactionOptions = try container.decodeIfPresent( TransactionOptions.self, forKey: .defaultTransactionOptions ) self.init(causalConsistency: causalConsistency, defaultTransactionOptions: defaultTransactionOptions) } private enum CodingKeys: CodingKey { case causalConsistency, defaultTransactionOptions } } extension TransactionOptions: Decodable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let maxCommitTimeMS = try container.decodeIfPresent(Int.self, forKey: .maxCommitTimeMS) let readConcern = try container.decodeIfPresent(ReadConcern.self, forKey: .readConcern) let readPreference = try container.decodeIfPresent(ReadPreference.self, forKey: .readPreference) let writeConcern = try container.decodeIfPresent(WriteConcern.self, forKey: .writeConcern) self.init( maxCommitTimeMS: maxCommitTimeMS, readConcern: readConcern, readPreference: readPreference, writeConcern: writeConcern ) } private enum CodingKeys: CodingKey { case maxCommitTimeMS, readConcern, readPreference, writeConcern } } extension ReadPreference.Mode: Decodable { public init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer() var string = try container.decode(String.self) // spec tests capitalize first letter of mode, so need to account for that. string = string.prefix(1).lowercased() + string.dropFirst() guard let mode = Self(rawValue: string) else { throw DecodingError.dataCorruptedError( in: container, debugDescription: "can't parse ReadPreference mode from \(string)" ) } self = mode } } extension ReadPreference: Decodable { private enum CodingKeys: String, CodingKey { case mode } public init(from decoder: Decoder) throws { if let container = try? decoder.container(keyedBy: CodingKeys.self) { let mode = try container.decode(Mode.self, forKey: .mode) self.init(mode) } else { // sometimes the spec tests only specify the mode as a string let container = try decoder.singleValueContainer() let mode = try container.decode(ReadPreference.Mode.self) self.init(mode) } } } extension MongoClientOptions: Decodable { private enum CodingKeys: String, CodingKey { case retryReads, retryWrites, w, readConcernLevel, readPreference, heartbeatFrequencyMS } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let readConcern = try? ReadConcern.other(container.decode(String.self, forKey: .readConcernLevel)) let readPreference = try container.decodeIfPresent(ReadPreference.self, forKey: .readPreference) let retryReads = try container.decodeIfPresent(Bool.self, forKey: .retryReads) let retryWrites = try container.decodeIfPresent(Bool.self, forKey: .retryWrites) let writeConcern = try? WriteConcern(w: container.decode(WriteConcern.W.self, forKey: .w)) let heartbeatFrequencyMS = try container.decodeIfPresent(Int.self, forKey: .heartbeatFrequencyMS) self.init( heartbeatFrequencyMS: heartbeatFrequencyMS, readConcern: readConcern, readPreference: readPreference, retryReads: retryReads, retryWrites: retryWrites, writeConcern: writeConcern ) } }
{ "pile_set_name": "Github" }
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Note: the file data_test.go that is generated should not be checked in. //go:generate go run maketables.go triegen.go //go:generate go test -tags test // Package norm contains types and functions for normalizing Unicode strings. package norm // import "golang.org/x/text/unicode/norm" import ( "unicode/utf8" "golang.org/x/text/transform" ) // A Form denotes a canonical representation of Unicode code points. // The Unicode-defined normalization and equivalence forms are: // // NFC Unicode Normalization Form C // NFD Unicode Normalization Form D // NFKC Unicode Normalization Form KC // NFKD Unicode Normalization Form KD // // For a Form f, this documentation uses the notation f(x) to mean // the bytes or string x converted to the given form. // A position n in x is called a boundary if conversion to the form can // proceed independently on both sides: // f(x) == append(f(x[0:n]), f(x[n:])...) // // References: http://unicode.org/reports/tr15/ and // http://unicode.org/notes/tn5/. type Form int const ( NFC Form = iota NFD NFKC NFKD ) // Bytes returns f(b). May return b if f(b) = b. func (f Form) Bytes(b []byte) []byte { src := inputBytes(b) ft := formTable[f] n, ok := ft.quickSpan(src, 0, len(b), true) if ok { return b } out := make([]byte, n, len(b)) copy(out, b[0:n]) rb := reorderBuffer{f: *ft, src: src, nsrc: len(b), out: out, flushF: appendFlush} return doAppendInner(&rb, n) } // String returns f(s). func (f Form) String(s string) string { src := inputString(s) ft := formTable[f] n, ok := ft.quickSpan(src, 0, len(s), true) if ok { return s } out := make([]byte, n, len(s)) copy(out, s[0:n]) rb := reorderBuffer{f: *ft, src: src, nsrc: len(s), out: out, flushF: appendFlush} return string(doAppendInner(&rb, n)) } // IsNormal returns true if b == f(b). func (f Form) IsNormal(b []byte) bool { src := inputBytes(b) ft := formTable[f] bp, ok := ft.quickSpan(src, 0, len(b), true) if ok { return true } rb := reorderBuffer{f: *ft, src: src, nsrc: len(b)} rb.setFlusher(nil, cmpNormalBytes) for bp < len(b) { rb.out = b[bp:] if bp = decomposeSegment(&rb, bp, true); bp < 0 { return false } bp, _ = rb.f.quickSpan(rb.src, bp, len(b), true) } return true } func cmpNormalBytes(rb *reorderBuffer) bool { b := rb.out for i := 0; i < rb.nrune; i++ { info := rb.rune[i] if int(info.size) > len(b) { return false } p := info.pos pe := p + info.size for ; p < pe; p++ { if b[0] != rb.byte[p] { return false } b = b[1:] } } return true } // IsNormalString returns true if s == f(s). func (f Form) IsNormalString(s string) bool { src := inputString(s) ft := formTable[f] bp, ok := ft.quickSpan(src, 0, len(s), true) if ok { return true } rb := reorderBuffer{f: *ft, src: src, nsrc: len(s)} rb.setFlusher(nil, func(rb *reorderBuffer) bool { for i := 0; i < rb.nrune; i++ { info := rb.rune[i] if bp+int(info.size) > len(s) { return false } p := info.pos pe := p + info.size for ; p < pe; p++ { if s[bp] != rb.byte[p] { return false } bp++ } } return true }) for bp < len(s) { if bp = decomposeSegment(&rb, bp, true); bp < 0 { return false } bp, _ = rb.f.quickSpan(rb.src, bp, len(s), true) } return true } // patchTail fixes a case where a rune may be incorrectly normalized // if it is followed by illegal continuation bytes. It returns the // patched buffer and whether the decomposition is still in progress. func patchTail(rb *reorderBuffer) bool { info, p := lastRuneStart(&rb.f, rb.out) if p == -1 || info.size == 0 { return true } end := p + int(info.size) extra := len(rb.out) - end if extra > 0 { // Potentially allocating memory. However, this only // happens with ill-formed UTF-8. x := make([]byte, 0) x = append(x, rb.out[len(rb.out)-extra:]...) rb.out = rb.out[:end] decomposeToLastBoundary(rb) rb.doFlush() rb.out = append(rb.out, x...) return false } buf := rb.out[p:] rb.out = rb.out[:p] decomposeToLastBoundary(rb) if s := rb.ss.next(info); s == ssStarter { rb.doFlush() rb.ss.first(info) } else if s == ssOverflow { rb.doFlush() rb.insertCGJ() rb.ss = 0 } rb.insertUnsafe(inputBytes(buf), 0, info) return true } func appendQuick(rb *reorderBuffer, i int) int { if rb.nsrc == i { return i } end, _ := rb.f.quickSpan(rb.src, i, rb.nsrc, true) rb.out = rb.src.appendSlice(rb.out, i, end) return end } // Append returns f(append(out, b...)). // The buffer out must be nil, empty, or equal to f(out). func (f Form) Append(out []byte, src ...byte) []byte { return f.doAppend(out, inputBytes(src), len(src)) } func (f Form) doAppend(out []byte, src input, n int) []byte { if n == 0 { return out } ft := formTable[f] // Attempt to do a quickSpan first so we can avoid initializing the reorderBuffer. if len(out) == 0 { p, _ := ft.quickSpan(src, 0, n, true) out = src.appendSlice(out, 0, p) if p == n { return out } rb := reorderBuffer{f: *ft, src: src, nsrc: n, out: out, flushF: appendFlush} return doAppendInner(&rb, p) } rb := reorderBuffer{f: *ft, src: src, nsrc: n} return doAppend(&rb, out, 0) } func doAppend(rb *reorderBuffer, out []byte, p int) []byte { rb.setFlusher(out, appendFlush) src, n := rb.src, rb.nsrc doMerge := len(out) > 0 if q := src.skipContinuationBytes(p); q > p { // Move leading non-starters to destination. rb.out = src.appendSlice(rb.out, p, q) p = q doMerge = patchTail(rb) } fd := &rb.f if doMerge { var info Properties if p < n { info = fd.info(src, p) if !info.BoundaryBefore() || info.nLeadingNonStarters() > 0 { if p == 0 { decomposeToLastBoundary(rb) } p = decomposeSegment(rb, p, true) } } if info.size == 0 { rb.doFlush() // Append incomplete UTF-8 encoding. return src.appendSlice(rb.out, p, n) } if rb.nrune > 0 { return doAppendInner(rb, p) } } p = appendQuick(rb, p) return doAppendInner(rb, p) } func doAppendInner(rb *reorderBuffer, p int) []byte { for n := rb.nsrc; p < n; { p = decomposeSegment(rb, p, true) p = appendQuick(rb, p) } return rb.out } // AppendString returns f(append(out, []byte(s))). // The buffer out must be nil, empty, or equal to f(out). func (f Form) AppendString(out []byte, src string) []byte { return f.doAppend(out, inputString(src), len(src)) } // QuickSpan returns a boundary n such that b[0:n] == f(b[0:n]). // It is not guaranteed to return the largest such n. func (f Form) QuickSpan(b []byte) int { n, _ := formTable[f].quickSpan(inputBytes(b), 0, len(b), true) return n } // Span implements transform.SpanningTransformer. It returns a boundary n such // that b[0:n] == f(b[0:n]). It is not guaranteed to return the largest such n. func (f Form) Span(b []byte, atEOF bool) (n int, err error) { n, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), atEOF) if n < len(b) { if !ok { err = transform.ErrEndOfSpan } else { err = transform.ErrShortSrc } } return n, err } // SpanString returns a boundary n such that s[0:n] == f(s[0:n]). // It is not guaranteed to return the largest such n. func (f Form) SpanString(s string, atEOF bool) (n int, err error) { n, ok := formTable[f].quickSpan(inputString(s), 0, len(s), atEOF) if n < len(s) { if !ok { err = transform.ErrEndOfSpan } else { err = transform.ErrShortSrc } } return n, err } // quickSpan returns a boundary n such that src[0:n] == f(src[0:n]) and // whether any non-normalized parts were found. If atEOF is false, n will // not point past the last segment if this segment might be become // non-normalized by appending other runes. func (f *formInfo) quickSpan(src input, i, end int, atEOF bool) (n int, ok bool) { var lastCC uint8 ss := streamSafe(0) lastSegStart := i for n = end; i < n; { if j := src.skipASCII(i, n); i != j { i = j lastSegStart = i - 1 lastCC = 0 ss = 0 continue } info := f.info(src, i) if info.size == 0 { if atEOF { // include incomplete runes return n, true } return lastSegStart, true } // This block needs to be before the next, because it is possible to // have an overflow for runes that are starters (e.g. with U+FF9E). switch ss.next(info) { case ssStarter: lastSegStart = i case ssOverflow: return lastSegStart, false case ssSuccess: if lastCC > info.ccc { return lastSegStart, false } } if f.composing { if !info.isYesC() { break } } else { if !info.isYesD() { break } } lastCC = info.ccc i += int(info.size) } if i == n { if !atEOF { n = lastSegStart } return n, true } return lastSegStart, false } // QuickSpanString returns a boundary n such that s[0:n] == f(s[0:n]). // It is not guaranteed to return the largest such n. func (f Form) QuickSpanString(s string) int { n, _ := formTable[f].quickSpan(inputString(s), 0, len(s), true) return n } // FirstBoundary returns the position i of the first boundary in b // or -1 if b contains no boundary. func (f Form) FirstBoundary(b []byte) int { return f.firstBoundary(inputBytes(b), len(b)) } func (f Form) firstBoundary(src input, nsrc int) int { i := src.skipContinuationBytes(0) if i >= nsrc { return -1 } fd := formTable[f] ss := streamSafe(0) // We should call ss.first here, but we can't as the first rune is // skipped already. This means FirstBoundary can't really determine // CGJ insertion points correctly. Luckily it doesn't have to. for { info := fd.info(src, i) if info.size == 0 { return -1 } if s := ss.next(info); s != ssSuccess { return i } i += int(info.size) if i >= nsrc { if !info.BoundaryAfter() && !ss.isMax() { return -1 } return nsrc } } } // FirstBoundaryInString returns the position i of the first boundary in s // or -1 if s contains no boundary. func (f Form) FirstBoundaryInString(s string) int { return f.firstBoundary(inputString(s), len(s)) } // NextBoundary reports the index of the boundary between the first and next // segment in b or -1 if atEOF is false and there are not enough bytes to // determine this boundary. func (f Form) NextBoundary(b []byte, atEOF bool) int { return f.nextBoundary(inputBytes(b), len(b), atEOF) } // NextBoundaryInString reports the index of the boundary between the first and // next segment in b or -1 if atEOF is false and there are not enough bytes to // determine this boundary. func (f Form) NextBoundaryInString(s string, atEOF bool) int { return f.nextBoundary(inputString(s), len(s), atEOF) } func (f Form) nextBoundary(src input, nsrc int, atEOF bool) int { if nsrc == 0 { if atEOF { return 0 } return -1 } fd := formTable[f] info := fd.info(src, 0) if info.size == 0 { if atEOF { return 1 } return -1 } ss := streamSafe(0) ss.first(info) for i := int(info.size); i < nsrc; i += int(info.size) { info = fd.info(src, i) if info.size == 0 { if atEOF { return i } return -1 } // TODO: Using streamSafe to determine the boundary isn't the same as // using BoundaryBefore. Determine which should be used. if s := ss.next(info); s != ssSuccess { return i } } if !atEOF && !info.BoundaryAfter() && !ss.isMax() { return -1 } return nsrc } // LastBoundary returns the position i of the last boundary in b // or -1 if b contains no boundary. func (f Form) LastBoundary(b []byte) int { return lastBoundary(formTable[f], b) } func lastBoundary(fd *formInfo, b []byte) int { i := len(b) info, p := lastRuneStart(fd, b) if p == -1 { return -1 } if info.size == 0 { // ends with incomplete rune if p == 0 { // starts with incomplete rune return -1 } i = p info, p = lastRuneStart(fd, b[:i]) if p == -1 { // incomplete UTF-8 encoding or non-starter bytes without a starter return i } } if p+int(info.size) != i { // trailing non-starter bytes: illegal UTF-8 return i } if info.BoundaryAfter() { return i } ss := streamSafe(0) v := ss.backwards(info) for i = p; i >= 0 && v != ssStarter; i = p { info, p = lastRuneStart(fd, b[:i]) if v = ss.backwards(info); v == ssOverflow { break } if p+int(info.size) != i { if p == -1 { // no boundary found return -1 } return i // boundary after an illegal UTF-8 encoding } } return i } // decomposeSegment scans the first segment in src into rb. It inserts 0x034f // (Grapheme Joiner) when it encounters a sequence of more than 30 non-starters // and returns the number of bytes consumed from src or iShortDst or iShortSrc. func decomposeSegment(rb *reorderBuffer, sp int, atEOF bool) int { // Force one character to be consumed. info := rb.f.info(rb.src, sp) if info.size == 0 { return 0 } if s := rb.ss.next(info); s == ssStarter { // TODO: this could be removed if we don't support merging. if rb.nrune > 0 { goto end } } else if s == ssOverflow { rb.insertCGJ() goto end } if err := rb.insertFlush(rb.src, sp, info); err != iSuccess { return int(err) } for { sp += int(info.size) if sp >= rb.nsrc { if !atEOF && !info.BoundaryAfter() { return int(iShortSrc) } break } info = rb.f.info(rb.src, sp) if info.size == 0 { if !atEOF { return int(iShortSrc) } break } if s := rb.ss.next(info); s == ssStarter { break } else if s == ssOverflow { rb.insertCGJ() break } if err := rb.insertFlush(rb.src, sp, info); err != iSuccess { return int(err) } } end: if !rb.doFlush() { return int(iShortDst) } return sp } // lastRuneStart returns the runeInfo and position of the last // rune in buf or the zero runeInfo and -1 if no rune was found. func lastRuneStart(fd *formInfo, buf []byte) (Properties, int) { p := len(buf) - 1 for ; p >= 0 && !utf8.RuneStart(buf[p]); p-- { } if p < 0 { return Properties{}, -1 } return fd.info(inputBytes(buf), p), p } // decomposeToLastBoundary finds an open segment at the end of the buffer // and scans it into rb. Returns the buffer minus the last segment. func decomposeToLastBoundary(rb *reorderBuffer) { fd := &rb.f info, i := lastRuneStart(fd, rb.out) if int(info.size) != len(rb.out)-i { // illegal trailing continuation bytes return } if info.BoundaryAfter() { return } var add [maxNonStarters + 1]Properties // stores runeInfo in reverse order padd := 0 ss := streamSafe(0) p := len(rb.out) for { add[padd] = info v := ss.backwards(info) if v == ssOverflow { // Note that if we have an overflow, it the string we are appending to // is not correctly normalized. In this case the behavior is undefined. break } padd++ p -= int(info.size) if v == ssStarter || p < 0 { break } info, i = lastRuneStart(fd, rb.out[:p]) if int(info.size) != p-i { break } } rb.ss = ss // Copy bytes for insertion as we may need to overwrite rb.out. var buf [maxBufferSize * utf8.UTFMax]byte cp := buf[:copy(buf[:], rb.out[p:])] rb.out = rb.out[:p] for padd--; padd >= 0; padd-- { info = add[padd] rb.insertUnsafe(inputBytes(cp), 0, info) cp = cp[info.size:] } }
{ "pile_set_name": "Github" }
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import "get_source_report_with_mixin_lib1.dart"; class Test1 with A {}
{ "pile_set_name": "Github" }
"""PyTest Fixtures.""" import os import pytest from ansiblelint.constants import DEFAULT_RULESDIR from ansiblelint.rules import RulesCollection from ansiblelint.testing import RunFromText @pytest.fixture def default_rules_collection(): """Return default rule collection.""" assert os.path.isdir(DEFAULT_RULESDIR) return RulesCollection(rulesdirs=[DEFAULT_RULESDIR]) @pytest.fixture def default_text_runner(default_rules_collection): """Return RunFromText instance for the default set of collections.""" return RunFromText(default_rules_collection) @pytest.fixture def rule_runner(request): """Return runner for a specific rule class.""" rule_class = request.param collection = RulesCollection() collection.register(rule_class()) return RunFromText(collection)
{ "pile_set_name": "Github" }
/* * Copyright 2010 LinkedIn * * 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 kafka.utils import org.I0Itec.zkclient.ZkClient import org.I0Itec.zkclient.serialize.ZkSerializer import kafka.cluster.{Broker, Cluster} import scala.collection._ import java.util.Properties import org.I0Itec.zkclient.exception.{ZkNodeExistsException, ZkNoNodeException, ZkMarshallingError} import org.apache.log4j.Logger object ZkUtils { val ConsumersPath = "/consumers" val BrokerIdsPath = "/brokers/ids" val BrokerTopicsPath = "/brokers/topics" private val logger = Logger.getLogger(getClass()) /** * make sure a persistent path exists in ZK. Create the path if not exist. */ def makeSurePersistentPathExists(client: ZkClient, path: String) { if (!client.exists(path)) client.createPersistent(path, true) // won't throw NoNodeException or NodeExistsException } /** * create the parent path */ private def createParentPath(client: ZkClient, path: String): Unit = { val parentDir = path.substring(0, path.lastIndexOf('/')) if (parentDir.length != 0) client.createPersistent(parentDir, true) } /** * Create an ephemeral node with the given path and data. Create parents if necessary. */ private def createEphemeralPath(client: ZkClient, path: String, data: String): Unit = { try { client.createEphemeral(path, data) } catch { case e: ZkNoNodeException => { createParentPath(client, path) client.createEphemeral(path, data) } } } /** * Create an ephemeral node with the given path and data. * Throw NodeExistException if node already exists. */ def createEphemeralPathExpectConflict(client: ZkClient, path: String, data: String): Unit = { try { createEphemeralPath(client, path, data) } catch { case e: ZkNodeExistsException => { // this can happen when there is connection loss; make sure the data is what we intend to write var storedData: String = null try { storedData = readData(client, path) } catch { case e1: ZkNoNodeException => // the node disappeared; treat as if node existed and let caller handles this case e2 => throw e2 } if (storedData == null || storedData != data) { logger.info("conflict in " + path + " data: " + data + " stored data: " + storedData) throw e } else { // otherwise, the creation succeeded, return normally logger.info(path + " exists with value " + data + " during connection loss; this is ok") } } case e2 => throw e2 } } /** * Update the value of a persistent node with the given path and data. * create parrent directory if necessary. Never throw NodeExistException. */ def updatePersistentPath(client: ZkClient, path: String, data: String): Unit = { try { client.writeData(path, data) } catch { case e: ZkNoNodeException => { createParentPath(client, path) try { client.createPersistent(path, data) } catch { case e: ZkNodeExistsException => client.writeData(path, data) case e2 => throw e2 } } case e2 => throw e2 } } /** * Update the value of a persistent node with the given path and data. * create parrent directory if necessary. Never throw NodeExistException. */ def updateEphemeralPath(client: ZkClient, path: String, data: String): Unit = { try { client.writeData(path, data) } catch { case e: ZkNoNodeException => { createParentPath(client, path) client.createEphemeral(path, data) } case e2 => throw e2 } } def deletePath(client: ZkClient, path: String) { try { client.delete(path) } catch { case e: ZkNoNodeException => // this can happen during a connection loss event, return normally logger.info(path + " deleted during connection loss; this is ok") case e2 => throw e2 } } def deletePathRecursive(client: ZkClient, path: String) { try { client.deleteRecursive(path) } catch { case e: ZkNoNodeException => // this can happen during a connection loss event, return normally logger.info(path + " deleted during connection loss; this is ok") case e2 => throw e2 } } def readData(client: ZkClient, path: String): String = { client.readData(path) } def readDataMaybeNull(client: ZkClient, path: String): String = { client.readData(path, true) } def getChildren(client: ZkClient, path: String): Seq[String] = { import scala.collection.JavaConversions._ // triggers implicit conversion from java list to scala Seq client.getChildren(path) } def getChildrenParentMayNotExist(client: ZkClient, path: String): Seq[String] = { import scala.collection.JavaConversions._ // triggers implicit conversion from java list to scala Seq var ret: java.util.List[String] = null try { ret = client.getChildren(path) } catch { case e: ZkNoNodeException => return Nil case e2 => throw e2 } return ret } /** * Check if the given path exists */ def pathExists(client: ZkClient, path: String): Boolean = { client.exists(path) } def getLastPart(path : String) : String = path.substring(path.lastIndexOf('/') + 1) def getCluster(zkClient: ZkClient) : Cluster = { val cluster = new Cluster val nodes = getChildrenParentMayNotExist(zkClient, BrokerIdsPath) for (node <- nodes) { val brokerZKString = readData(zkClient, BrokerIdsPath + "/" + node) cluster.add(Broker.createBroker(node.toInt, brokerZKString)) } cluster } def getPartitionsForTopics(zkClient: ZkClient, topics: Iterator[String]): mutable.Map[String, List[String]] = { val ret = new mutable.HashMap[String, List[String]]() for (topic <- topics) { var partList: List[String] = Nil val brokers = getChildrenParentMayNotExist(zkClient, BrokerTopicsPath + "/" + topic) for (broker <- brokers) { val nParts = readData(zkClient, BrokerTopicsPath + "/" + topic + "/" + broker).toInt for (part <- 0 until nParts) partList ::= broker + "-" + part } partList = partList.sortWith((s,t) => s < t) ret += (topic -> partList) } ret } def setupPartition(zkClient : ZkClient, brokerId: Int, host: String, port: Int, topic: String, nParts: Int) { val brokerIdPath = BrokerIdsPath + "/" + brokerId val broker = new Broker(brokerId, brokerId.toString, host, port) createEphemeralPathExpectConflict(zkClient, brokerIdPath, broker.getZKString) val brokerPartTopicPath = BrokerTopicsPath + "/" + topic + "/" + brokerId createEphemeralPathExpectConflict(zkClient, brokerPartTopicPath, nParts.toString) } def deletePartition(zkClient : ZkClient, brokerId: Int, topic: String) { val brokerIdPath = BrokerIdsPath + "/" + brokerId zkClient.delete(brokerIdPath) val brokerPartTopicPath = BrokerTopicsPath + "/" + topic + "/" + brokerId zkClient.delete(brokerPartTopicPath) } } object StringSerializer extends ZkSerializer { @throws(classOf[ZkMarshallingError]) def serialize(data : Object) : Array[Byte] = data.asInstanceOf[String].getBytes("UTF-8") @throws(classOf[ZkMarshallingError]) def deserialize(bytes : Array[Byte]) : Object = { if (bytes == null) null else new String(bytes, "UTF-8") } } class ZKGroupDirs(val group: String) { def consumerDir = ZkUtils.ConsumersPath def consumerGroupDir = consumerDir + "/" + group def consumerRegistryDir = consumerGroupDir + "/ids" } class ZKGroupTopicDirs(group: String, topic: String) extends ZKGroupDirs(group) { def consumerOffsetDir = consumerGroupDir + "/offsets/" + topic def consumerOwnerDir = consumerGroupDir + "/owners/" + topic } class ZKConfig(props: Properties) { /** ZK host string */ val zkConnect = Utils.getString(props, "zk.connect", null) /** zookeeper session timeout */ val zkSessionTimeoutMs = Utils.getInt(props, "zk.sessiontimeout.ms", 6000) /** the max time that the client waits to establish a connection to zookeeper */ val zkConnectionTimeoutMs = Utils.getInt(props, "zk.connectiontimeout.ms",zkSessionTimeoutMs) /** how far a ZK follower can be behind a ZK leader */ val zkSyncTimeMs = Utils.getInt(props, "zk.synctime.ms", 2000) }
{ "pile_set_name": "Github" }
require 'mspec/runner/formatters/base' class SummaryFormatter < BaseFormatter end
{ "pile_set_name": "Github" }
.ListItem { display: flex; flex-shrink: 0; align-items: center; width: 100%; min-height: 48px; border-bottom: var(--border); }
{ "pile_set_name": "Github" }
module Distribution.Server.Framework.AuthCrypt ( PasswdPlain(..), PasswdHash(..), newPasswdHash, checkBasicAuthInfo, BasicAuthInfo(..), checkDigestAuthInfo, DigestAuthInfo(..), QopInfo(..), ) where import Distribution.Server.Features.Security.MD5 import Distribution.Server.Framework.AuthTypes import Distribution.Server.Users.Types (UserName(..)) import qualified Data.ByteString.Lazy.Char8 as BS.Lazy -- Only used for ASCII data import Data.List (intercalate) -- Hashed passwords are stored in the format: -- -- @md5 (username ++ ":" ++ realm ++ ":" ++ password)@. -- -- This format enables us to use either the basic or digest -- HTTP authentication methods. -- | Create a new 'PasswdHash' suitable for safe permanent storage. -- newPasswdHash :: RealmName -> UserName -> PasswdPlain -> PasswdHash newPasswdHash (RealmName realmName) (UserName userName) (PasswdPlain passwd) = PasswdHash $ md5HexDigest [userName, realmName, passwd] ------------------ -- HTTP Basic auth -- data BasicAuthInfo = BasicAuthInfo { basicRealm :: RealmName, basicUsername :: UserName, basicPasswd :: PasswdPlain } checkBasicAuthInfo :: PasswdHash -> BasicAuthInfo -> Bool checkBasicAuthInfo hash (BasicAuthInfo realmName userName pass) = newPasswdHash realmName userName pass == hash ------------------ -- HTTP Digest auth -- data DigestAuthInfo = DigestAuthInfo { digestUsername :: UserName, digestNonce :: String, digestResponse :: String, digestURI :: String, digestRqMethod :: String, digestQoP :: QopInfo } deriving Show data QopInfo = QopNone | QopAuth { digestNonceCount :: String, digestClientNonce :: String } -- | QopAuthInt deriving Show -- See RFC 2617 http://www.ietf.org/rfc/rfc2617 -- checkDigestAuthInfo :: PasswdHash -> DigestAuthInfo -> Bool checkDigestAuthInfo (PasswdHash passwdHash) (DigestAuthInfo _username nonce response uri method qopinfo) = hash3 == response where hash1 = passwdHash hash2 = md5HexDigest [method, uri] hash3 = case qopinfo of QopNone -> md5HexDigest [hash1, nonce, hash2] QopAuth nc cnonce -> md5HexDigest [hash1, nonce, nc, cnonce, "auth", hash2] ------------------ -- Utils -- md5HexDigest :: [String] -> String md5HexDigest = show . md5 . BS.Lazy.pack . intercalate ":"
{ "pile_set_name": "Github" }
/***************************************************************************** * Open MCT, Copyright (c) 2014-2020, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * * Open MCT is licensed under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * * Open MCT includes source code licensed under additional open source * licenses. See the Open Source Licenses file (LICENSES.md) included with * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ <template> <div v-show="isValidTarget"> <div class="c-drop-hint c-drop-hint--always-show" :class="{'is-mouse-over': isMouseOver}" @dragover.prevent @dragenter="dragenter" @dragleave="dragleave" @drop="dropHandler" ></div> </div> </template> <script> export default { props: { index: { type: Number, required: true }, allowDrop: { type: Function, required: true } }, data() { return { isMouseOver: false, isValidTarget: false }; }, mounted() { document.addEventListener('dragstart', this.dragstart); document.addEventListener('dragend', this.dragend); document.addEventListener('drop', this.dragend); }, destroyed() { document.removeEventListener('dragstart', this.dragstart); document.removeEventListener('dragend', this.dragend); document.removeEventListener('drop', this.dragend); }, methods: { dragenter() { this.isMouseOver = true; }, dragleave() { this.isMouseOver = false; }, dropHandler(event) { this.$emit('object-drop-to', this.index, event); this.isValidTarget = false; }, dragstart(event) { this.isValidTarget = this.allowDrop(event, this.index); }, dragend() { this.isValidTarget = false; } } }; </script>
{ "pile_set_name": "Github" }
// +build windows package sequences import ( "syscall" "unsafe" ) var ( kernel32Dll *syscall.LazyDLL = syscall.NewLazyDLL("Kernel32.dll") setConsoleMode *syscall.LazyProc = kernel32Dll.NewProc("SetConsoleMode") ) func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error { const ENABLE_VIRTUAL_TERMINAL_PROCESSING uint32 = 0x4 var mode uint32 err := syscall.GetConsoleMode(syscall.Stdout, &mode) if err != nil { return err } if enable { mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING } else { mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING } ret, _, err := setConsoleMode.Call(uintptr(unsafe.Pointer(stream)), uintptr(mode)) if ret == 0 { return err } return nil }
{ "pile_set_name": "Github" }
// // SMThreadTableViewCell.h // SimpleMail // // Created by Ben Gotow on 7/8/14. // Copyright (c) 2014 Inbox. All rights reserved. // #import <UIKit/UIKit.h> @interface SMThreadTableViewCell : UITableViewCell @property (nonatomic, strong) IBOutlet UILabel * dateLabel; @property (nonatomic, strong) IBOutlet UILabel * fromLabel; @property (nonatomic, strong) IBOutlet UILabel * bodyLabel; @property (nonatomic, strong) IBOutlet UIImageView * unreadDot; - (void)setThread:(INThread*)thread; @end
{ "pile_set_name": "Github" }
*** orig/isolinux.cfg 2016-10-12 04:45:19.000000000 +0200 --- custom/isolinux.cfg 2017-02-12 00:36:09.201190417 +0100 *************** *** 4,7 **** include menu.cfg default vesamenu.c32 prompt 0 ! timeout 0 --- 4,7 ---- include menu.cfg default vesamenu.c32 prompt 0 ! timeout 100 *** orig/boot/grub/grub.cfg 2018-04-25 22:11:06.000000000 +0200 --- custom/boot/grub/grub.cfg 2018-06-01 22:47:30.953007353 +0200 *************** *** 9,14 **** --- 9,15 ---- set menu_color_normal=white/black set menu_color_highlight=black/light-gray + set timeout=10 menuentry "Install" { set gfxpayload=keep
{ "pile_set_name": "Github" }
The curves tool allows to adjust the tonal range and colors of the image through control points. The tool provides a separate curve for each image channel. In the case of RGB images, an additional curve, called "RGB", allows to modify all three channels at the same time. In the graphs, the horizontal axis represents the input values and the vertical axis the output ones.The curve is initially a simple diagonal line, meaning that the output exactly matches input. Left-clicking on the graph with the mouse adds a new control point, while right-clicking on an existing control point deletes it. Control points can be moved by either dragging them with the moiuse, or by setting the corresponding input and output numerical values in the boxes below the graph.
{ "pile_set_name": "Github" }
package main import ( "flag" "fmt" "go/ast" "go/parser" "go/token" "os" "path/filepath" "sort" "strings" ) const invalidArgumentExitCode = 3 var dontRecurseFlag = flag.Bool("n", false, "don't recursively check paths") func main() { flag.Parse() if len(flag.Args()) == 0 { fmt.Println("missing argument: filepath") os.Exit(invalidArgumentExitCode) } lintFailed := false for _, path := range flag.Args() { root, err := filepath.Abs(path) if err != nil { fmt.Printf("Error finding absolute path: %s", err) os.Exit(invalidArgumentExitCode) } if walkPath(root) { lintFailed = true } } if lintFailed { os.Exit(1) } } func walkPath(root string) bool { lintFailed := false filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { if err != nil { fmt.Printf("Error during filesystem walk: %v\n", err) return nil } if fi.IsDir() { if path != root && (*dontRecurseFlag || filepath.Base(path) == "testdata" || filepath.Base(path) == "vendor") { return filepath.SkipDir } return nil } if !strings.HasSuffix(path, ".go") { return nil } fset, _, ineff := checkPath(path) for _, id := range ineff { fmt.Printf("%s: ineffectual assignment to %s\n", fset.Position(id.Pos()), id.Name) lintFailed = true } return nil }) return lintFailed } func checkPath(path string) (*token.FileSet, []*ast.CommentGroup, []*ast.Ident) { fset := token.NewFileSet() f, err := parser.ParseFile(fset, path, nil, parser.ParseComments) if err != nil { return nil, nil, nil } bld := &builder{vars: map[*ast.Object]*variable{}} bld.walk(f) chk := &checker{vars: bld.vars, seen: map[*block]bool{}} for _, b := range bld.roots { chk.check(b) } sort.Sort(chk.ineff) return fset, f.Comments, chk.ineff } type builder struct { roots []*block block *block vars map[*ast.Object]*variable results []*ast.FieldList breaks branchStack continues branchStack gotos branchStack labelStmt *ast.LabeledStmt } type block struct { children []*block ops map[*ast.Object][]operation } func (b *block) addChild(c *block) { b.children = append(b.children, c) } type operation struct { id *ast.Ident assign bool } type variable struct { fundept int escapes bool } func (bld *builder) walk(n ast.Node) { if n != nil { ast.Walk(bld, n) } } func (bld *builder) Visit(n ast.Node) ast.Visitor { switch n := n.(type) { case *ast.FuncDecl: if n.Body != nil { bld.fun(n.Type, n.Body) } case *ast.FuncLit: bld.fun(n.Type, n.Body) case *ast.IfStmt: bld.walk(n.Init) bld.walk(n.Cond) b0 := bld.block bld.newBlock(b0) bld.walk(n.Body) b1 := bld.block if n.Else != nil { bld.newBlock(b0) bld.walk(n.Else) b0 = bld.block } bld.newBlock(b0, b1) case *ast.ForStmt: lbl := bld.stmtLabel(n) brek := bld.breaks.push(lbl) continu := bld.continues.push(lbl) bld.walk(n.Init) start := bld.newBlock(bld.block) bld.walk(n.Cond) cond := bld.block bld.newBlock(cond) bld.walk(n.Body) continu.setDestination(bld.newBlock(bld.block)) bld.walk(n.Post) bld.block.addChild(start) brek.setDestination(bld.newBlock(cond)) bld.breaks.pop() bld.continues.pop() case *ast.RangeStmt: lbl := bld.stmtLabel(n) brek := bld.breaks.push(lbl) continu := bld.continues.push(lbl) bld.walk(n.X) pre := bld.newBlock(bld.block) start := bld.newBlock(pre) if n.Key != nil { lhs := []ast.Expr{n.Key} if n.Value != nil { lhs = append(lhs, n.Value) } bld.walk(&ast.AssignStmt{Lhs: lhs, Tok: n.Tok, TokPos: n.TokPos, Rhs: []ast.Expr{&ast.Ident{NamePos: n.X.End()}}}) } bld.walk(n.Body) bld.block.addChild(start) continu.setDestination(pre) brek.setDestination(bld.newBlock(pre, bld.block)) bld.breaks.pop() bld.continues.pop() case *ast.SwitchStmt: bld.walk(n.Init) bld.walk(n.Tag) bld.swtch(n, n.Body.List) case *ast.TypeSwitchStmt: bld.walk(n.Init) bld.walk(n.Assign) bld.swtch(n, n.Body.List) case *ast.SelectStmt: brek := bld.breaks.push(bld.stmtLabel(n)) for _, c := range n.Body.List { c := c.(*ast.CommClause).Comm if s, ok := c.(*ast.AssignStmt); ok { bld.walk(s.Rhs[0]) } else { bld.walk(c) } } b0 := bld.block exits := make([]*block, len(n.Body.List)) dfault := false for i, c := range n.Body.List { c := c.(*ast.CommClause) bld.newBlock(b0) bld.walk(c) exits[i] = bld.block dfault = dfault || c.Comm == nil } if !dfault { exits = append(exits, b0) } brek.setDestination(bld.newBlock(exits...)) bld.breaks.pop() case *ast.LabeledStmt: bld.gotos.get(n.Label).setDestination(bld.newBlock(bld.block)) bld.labelStmt = n bld.walk(n.Stmt) case *ast.BranchStmt: switch n.Tok { case token.BREAK: bld.breaks.get(n.Label).addSource(bld.block) bld.newBlock() case token.CONTINUE: bld.continues.get(n.Label).addSource(bld.block) bld.newBlock() case token.GOTO: bld.gotos.get(n.Label).addSource(bld.block) bld.newBlock() } case *ast.AssignStmt: if n.Tok == token.QUO_ASSIGN || n.Tok == token.REM_ASSIGN { bld.maybePanic() } for _, x := range n.Rhs { bld.walk(x) } for i, x := range n.Lhs { if id, ok := ident(x); ok { if n.Tok >= token.ADD_ASSIGN && n.Tok <= token.AND_NOT_ASSIGN { bld.use(id) } // Don't treat explicit initialization to zero as assignment; it is often used as shorthand for a bare declaration. if n.Tok == token.DEFINE && i < len(n.Rhs) && isZeroLiteral(n.Rhs[i]) { bld.use(id) } else { bld.assign(id) } } else { bld.walk(x) } } case *ast.GenDecl: if n.Tok == token.VAR { for _, s := range n.Specs { s := s.(*ast.ValueSpec) for _, x := range s.Values { bld.walk(x) } for _, id := range s.Names { if len(s.Values) > 0 { bld.assign(id) } else { bld.use(id) } } } } case *ast.IncDecStmt: if id, ok := ident(n.X); ok { bld.use(id) bld.assign(id) } else { bld.walk(n.X) } case *ast.Ident: bld.use(n) case *ast.ReturnStmt: for _, x := range n.Results { bld.walk(x) } res := bld.results[len(bld.results)-1] if res == nil { break } for _, f := range res.List { for _, id := range f.Names { if n.Results != nil { bld.assign(id) } bld.use(id) } } case *ast.SendStmt: bld.maybePanic() return bld case *ast.BinaryExpr: if n.Op == token.EQL || n.Op == token.QUO || n.Op == token.REM { bld.maybePanic() } return bld case *ast.CallExpr: bld.maybePanic() return bld case *ast.IndexExpr: bld.maybePanic() return bld case *ast.UnaryExpr: id, ok := ident(n.X) if ix, isIx := n.X.(*ast.IndexExpr); isIx { // We don't care about indexing into slices, but without type information we can do no better. id, ok = ident(ix.X) } if ok && n.Op == token.AND { if v, ok := bld.vars[id.Obj]; ok { v.escapes = true } } return bld case *ast.SelectorExpr: bld.maybePanic() // A method call (possibly delayed via a method value) might implicitly take // the address of its receiver, causing it to escape. // We can't do any better here without knowing the variable's type. if id, ok := ident(n.X); ok { if v, ok := bld.vars[id.Obj]; ok { v.escapes = true } } return bld case *ast.SliceExpr: bld.maybePanic() // We don't care about slicing into slices, but without type information we can do no better. if id, ok := ident(n.X); ok { if v, ok := bld.vars[id.Obj]; ok { v.escapes = true } } return bld case *ast.StarExpr: bld.maybePanic() return bld case *ast.TypeAssertExpr: bld.maybePanic() return bld default: return bld } return nil } func isZeroLiteral(x ast.Expr) bool { b, ok := x.(*ast.BasicLit) if !ok { return false } switch b.Value { case "0", "0.0", "0.", ".0", `""`: return true } return false } func (bld *builder) fun(typ *ast.FuncType, body *ast.BlockStmt) { for _, v := range bld.vars { v.fundept++ } bld.results = append(bld.results, typ.Results) b := bld.block bld.newBlock() bld.roots = append(bld.roots, bld.block) bld.walk(typ) bld.walk(body) bld.block = b bld.results = bld.results[:len(bld.results)-1] for _, v := range bld.vars { v.fundept-- } } func (bld *builder) swtch(stmt ast.Stmt, cases []ast.Stmt) { brek := bld.breaks.push(bld.stmtLabel(stmt)) b0 := bld.block list := b0 exits := make([]*block, 0, len(cases)+1) var dfault, fallthru *block for _, c := range cases { c := c.(*ast.CaseClause) if c.List != nil { list = bld.newBlock(list) for _, x := range c.List { bld.walk(x) } } parents := []*block{} if c.List != nil { parents = append(parents, list) } if fallthru != nil { parents = append(parents, fallthru) fallthru = nil } bld.newBlock(parents...) if c.List == nil { dfault = bld.block } for _, s := range c.Body { bld.walk(s) if s, ok := s.(*ast.BranchStmt); ok && s.Tok == token.FALLTHROUGH { fallthru = bld.block } } if fallthru == nil { exits = append(exits, bld.block) } } if dfault != nil { list.addChild(dfault) } else { exits = append(exits, b0) } brek.setDestination(bld.newBlock(exits...)) bld.breaks.pop() } // An operation that might panic marks named function results as used. func (bld *builder) maybePanic() { if len(bld.results) == 0 { return } res := bld.results[len(bld.results)-1] if res == nil { return } for _, f := range res.List { for _, id := range f.Names { bld.use(id) } } } func (bld *builder) newBlock(parents ...*block) *block { bld.block = &block{ops: map[*ast.Object][]operation{}} for _, b := range parents { b.addChild(bld.block) } return bld.block } func (bld *builder) stmtLabel(s ast.Stmt) *ast.Object { if ls := bld.labelStmt; ls != nil && ls.Stmt == s { return ls.Label.Obj } return nil } func (bld *builder) assign(id *ast.Ident) { bld.newOp(id, true) } func (bld *builder) use(id *ast.Ident) { bld.newOp(id, false) } func (bld *builder) newOp(id *ast.Ident, assign bool) { if id.Name == "_" || id.Obj == nil { return } v, ok := bld.vars[id.Obj] if !ok { v = &variable{} bld.vars[id.Obj] = v } v.escapes = v.escapes || v.fundept > 0 || bld.block == nil if b := bld.block; b != nil { b.ops[id.Obj] = append(b.ops[id.Obj], operation{id, assign}) } } type branchStack []*branch type branch struct { label *ast.Object srcs []*block dst *block } func (s *branchStack) push(lbl *ast.Object) *branch { br := &branch{label: lbl} *s = append(*s, br) return br } func (s *branchStack) get(lbl *ast.Ident) *branch { for i := len(*s) - 1; i >= 0; i-- { if br := (*s)[i]; lbl == nil || br.label == lbl.Obj { return br } } return s.push(lbl.Obj) } func (br *branch) addSource(src *block) { br.srcs = append(br.srcs, src) if br.dst != nil { src.addChild(br.dst) } } func (br *branch) setDestination(dst *block) { br.dst = dst for _, src := range br.srcs { src.addChild(dst) } } func (s *branchStack) pop() { *s = (*s)[:len(*s)-1] } func ident(x ast.Expr) (*ast.Ident, bool) { if p, ok := x.(*ast.ParenExpr); ok { return ident(p.X) } id, ok := x.(*ast.Ident) return id, ok } type checker struct { vars map[*ast.Object]*variable seen map[*block]bool ineff idents } func (chk *checker) check(b *block) { if chk.seen[b] { return } chk.seen[b] = true for obj, ops := range b.ops { if chk.vars[obj].escapes { continue } ops: for i, op := range ops { if !op.assign { continue } if i+1 < len(ops) { if ops[i+1].assign { chk.ineff = append(chk.ineff, op.id) } continue } seen := map[*block]bool{} for _, b := range b.children { if used(obj, b, seen) { continue ops } } chk.ineff = append(chk.ineff, op.id) } } for _, b := range b.children { chk.check(b) } } func used(obj *ast.Object, b *block, seen map[*block]bool) bool { if seen[b] { return false } seen[b] = true if ops := b.ops[obj]; len(ops) > 0 { return !ops[0].assign } for _, b := range b.children { if used(obj, b, seen) { return true } } return false } type idents []*ast.Ident func (ids idents) Len() int { return len(ids) } func (ids idents) Less(i, j int) bool { return ids[i].Pos() < ids[j].Pos() } func (ids idents) Swap(i, j int) { ids[i], ids[j] = ids[j], ids[i] }
{ "pile_set_name": "Github" }
function test() { class R extends RegExp {} var r = new R("baz","g"); return r instanceof R && r instanceof RegExp && Object.getPrototypeOf(R) === RegExp; } if (!test()) throw new Error("Test failed");
{ "pile_set_name": "Github" }
'use strict'; var _unambiguous = require('eslint-module-utils/unambiguous'); var _docsUrl = require('../docsUrl'); var _docsUrl2 = _interopRequireDefault(_docsUrl); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * @fileOverview Report modules that could parse incorrectly as scripts. * @author Ben Mosher */ module.exports = { meta: { type: 'suggestion', docs: { url: (0, _docsUrl2.default)('unambiguous') }, schema: [] }, create: function (context) { // ignore non-modules if (context.parserOptions.sourceType !== 'module') { return {}; } return { Program: function (ast) { if (!(0, _unambiguous.isModule)(ast)) { context.report({ node: ast, message: 'This module could be parsed as a valid script.' }); } } }; } }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy91bmFtYmlndW91cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2VUeXBlIiwiUHJvZ3JhbSIsImFzdCIsInJlcG9ydCIsIm5vZGUiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiOztBQUtBOztBQUNBOzs7Ozs7QUFOQTs7Ozs7QUFRQUEsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFNO0FBQ0pDLFdBQUssdUJBQVEsYUFBUjtBQURELEtBRkY7QUFLSkMsWUFBUTtBQUxKLEdBRFM7O0FBU2ZDLFVBQVEsVUFBVUMsT0FBVixFQUFtQjtBQUN6QjtBQUNBLFFBQUlBLFFBQVFDLGFBQVIsQ0FBc0JDLFVBQXRCLEtBQXFDLFFBQXpDLEVBQW1EO0FBQ2pELGFBQU8sRUFBUDtBQUNEOztBQUVELFdBQU87QUFDTEMsZUFBUyxVQUFVQyxHQUFWLEVBQWU7QUFDdEIsWUFBSSxDQUFDLDJCQUFTQSxHQUFULENBQUwsRUFBb0I7QUFDbEJKLGtCQUFRSyxNQUFSLENBQWU7QUFDYkMsa0JBQU1GLEdBRE87QUFFYkcscUJBQVM7QUFGSSxXQUFmO0FBSUQ7QUFDRjtBQVJJLEtBQVA7QUFXRDtBQTFCYyxDQUFqQiIsImZpbGUiOiJ1bmFtYmlndW91cy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGZpbGVPdmVydmlldyBSZXBvcnQgbW9kdWxlcyB0aGF0IGNvdWxkIHBhcnNlIGluY29ycmVjdGx5IGFzIHNjcmlwdHMuXG4gKiBAYXV0aG9yIEJlbiBNb3NoZXJcbiAqL1xuXG5pbXBvcnQgeyBpc01vZHVsZSB9IGZyb20gJ2VzbGludC1tb2R1bGUtdXRpbHMvdW5hbWJpZ3VvdXMnXG5pbXBvcnQgZG9jc1VybCBmcm9tICcuLi9kb2NzVXJsJ1xuXG5tb2R1bGUuZXhwb3J0cyA9IHtcbiAgbWV0YToge1xuICAgIHR5cGU6ICdzdWdnZXN0aW9uJyxcbiAgICBkb2NzOiB7XG4gICAgICB1cmw6IGRvY3NVcmwoJ3VuYW1iaWd1b3VzJyksXG4gICAgfSxcbiAgICBzY2hlbWE6IFtdLFxuICB9LFxuXG4gIGNyZWF0ZTogZnVuY3Rpb24gKGNvbnRleHQpIHtcbiAgICAvLyBpZ25vcmUgbm9uLW1vZHVsZXNcbiAgICBpZiAoY29udGV4dC5wYXJzZXJPcHRpb25zLnNvdXJjZVR5cGUgIT09ICdtb2R1bGUnKSB7XG4gICAgICByZXR1cm4ge31cbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgUHJvZ3JhbTogZnVuY3Rpb24gKGFzdCkge1xuICAgICAgICBpZiAoIWlzTW9kdWxlKGFzdCkpIHtcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICBub2RlOiBhc3QsXG4gICAgICAgICAgICBtZXNzYWdlOiAnVGhpcyBtb2R1bGUgY291bGQgYmUgcGFyc2VkIGFzIGEgdmFsaWQgc2NyaXB0LicsXG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9XG5cbiAgfSxcbn1cbiJdfQ==
{ "pile_set_name": "Github" }
#!/usr/bin/python # Copyright 2003, 2004 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import BoostBuild t = BoostBuild.Tester() # Regression test: when staging V2 used to change suffixes on targets # corresponding to real files. t.write("jamfile.jam", """ import type : register ; register A : a1 a2 a3 ; stage a : a.a3 ; """) t.write("jamroot.jam", "") t.write("a.a3", "") t.run_build_system() t.expect_addition("a/a.a3"); # Regression test: we should be able to specify empty suffix for derived target # type, even if base type has non-empty suffix. t.write("a.cpp", "") t.write("suffixes.jam", """ import type ; import generators ; import common ; type.register First : first : ; type.register Second : "" : First ; generators.register-standard $(__name__).second : CPP : Second ; rule second { TOUCH on $(<) = [ common.file-creation-command ] ; } actions second { $(TOUCH) $(<) } """) t.write("suffixes.py", """ import b2.build.type as type import b2.build.generators as generators import b2.tools.common as common from b2.manager import get_manager type.register("First", ["first"]) type.register("Second", [""], "First") generators.register_standard("suffixes.second", ["CPP"], ["Second"]) get_manager().engine().register_action("suffixes.second", "%s $(<)" % common.file_creation_command()) """) t.write("jamroot.jam", """ import suffixes ; """) t.write("jamfile.jam", """ second a : a.cpp ; """) t.run_build_system() t.expect_addition("bin/$toolset/debug/a") t.cleanup()
{ "pile_set_name": "Github" }
--TEST-- mb_output_handler() and mbstring.http_output_conv_mimetypes (4) --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --INI-- mbstring.internal_encoding=UTF-8 --FILE-- <?php mb_http_output("EUC-JP"); header("Content-Type: application/octet-stream"); ob_start(); ob_start('mb_output_handler'); echo "テスト"; ob_end_flush(); var_dump(bin2hex(ob_get_clean())); ?> --EXPECT-- string(18) "e38386e382b9e38388"
{ "pile_set_name": "Github" }
// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2007-2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED #define BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED #include <string> #include <boost/units/config.hpp> #include <boost/units/base_unit.hpp> #include <boost/units/physical_dimensions/mass.hpp> #include <boost/units/base_units/cgs/gram.hpp> #include <boost/units/conversion.hpp> // can't define in terms of kilogram because it is a scaled_base_unit //BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(imperial, pound, "pound", "lb", 0.45359237, si::kilogram_base_unit, -302); // exact conversion BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(imperial, pound, "pound", "lb", 453.59237, cgs::gram_base_unit, -302); // exact conversion #if BOOST_UNITS_HAS_BOOST_TYPEOF #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() BOOST_TYPEOF_REGISTER_TYPE(boost::units::imperial::pound_base_unit) #endif #endif // BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED
{ "pile_set_name": "Github" }
package org.bigbluebutton.core.models import com.softwaremill.quicklens._ object RegisteredUsers { def create(userId: String, extId: String, name: String, roles: String, token: String, avatar: String, guest: Boolean, authenticated: Boolean, guestStatus: String): RegisteredUser = { new RegisteredUser( userId, extId, name, roles, token, avatar, guest, authenticated, guestStatus, System.currentTimeMillis(), false, false, false ) } def findWithToken(token: String, users: RegisteredUsers): Option[RegisteredUser] = { users.toVector.find(u => u.authToken == token) } def findWithUserId(id: String, users: RegisteredUsers): Option[RegisteredUser] = { users.toVector.find(ru => id == ru.id) } def findWithExternUserId(id: String, users: RegisteredUsers): Option[RegisteredUser] = { users.toVector.find(ru => id == ru.externId) } def findAllWithExternUserId(id: String, users: RegisteredUsers): Vector[RegisteredUser] = { users.toVector.filter(ru => id == ru.externId) } def findUsersNotJoined(users: RegisteredUsers): Vector[RegisteredUser] = { users.toVector.filter(u => u.joined == false && u.markAsJoinTimedOut == false) } def getRegisteredUserWithToken(token: String, userId: String, regUsers: RegisteredUsers): Option[RegisteredUser] = { def isSameUserId(ru: RegisteredUser, userId: String): Option[RegisteredUser] = { if (userId.startsWith(ru.id)) { Some(ru) } else { None } } for { ru <- RegisteredUsers.findWithToken(token, regUsers) user <- isSameUserId(ru, userId) } yield user } def add(users: RegisteredUsers, user: RegisteredUser): Vector[RegisteredUser] = { findWithExternUserId(user.externId, users) match { case Some(u) => if (u.banned) { // Banned user is rejoining. Don't add so that validate token // will fail and can't join. // ralam april 21, 2020 val bannedUser = user.copy(banned = true) users.save(bannedUser) } else { // If user hasn't been ejected, we allow user to join // as the user might be joining using 2 browsers for // better management of meeting. // ralam april 21, 2020 users.save(user) } case None => users.save(user) } } private def banOrEjectUser(ejectedUser: RegisteredUser, users: RegisteredUsers, ban: Boolean): RegisteredUser = { // Some users join with multiple browser to manage the meeting. // Don't black list a user ejecting oneself. // ralam april 23, 2020 if (ban) { // Set a flag that user has been ejected. We flag the user instead of // removing so we can eject when user tries to rejoin with the same // external userid. // ralam april 21, 2020 val u = ejectedUser.modify(_.banned).setTo(true) users.save(u) u } else { users.delete(ejectedUser.id) ejectedUser } } def eject(id: String, users: RegisteredUsers, ban: Boolean): Option[RegisteredUser] = { for { ru <- findWithUserId(id, users) } yield { banOrEjectUser(ru, users, ban) } } def setWaitingForApproval(users: RegisteredUsers, user: RegisteredUser, guestStatus: String): RegisteredUser = { val u = user.modify(_.guestStatus).setTo(guestStatus) users.save(u) u } def updateUserRole(users: RegisteredUsers, user: RegisteredUser, role: String): RegisteredUser = { val u = user.modify(_.role).setTo(role) users.save(u) u } def updateUserJoin(users: RegisteredUsers, user: RegisteredUser): RegisteredUser = { val u = user.copy(joined = true) users.save(u) u } def markAsUserFailedToJoin(users: RegisteredUsers, user: RegisteredUser): RegisteredUser = { val u = user.copy(markAsJoinTimedOut = true) users.save(u) u } } class RegisteredUsers { private var regUsers = new collection.immutable.HashMap[String, RegisteredUser] private def toVector: Vector[RegisteredUser] = regUsers.values.toVector private def save(user: RegisteredUser): Vector[RegisteredUser] = { regUsers += user.authToken -> user regUsers.values.toVector } private def delete(id: String): Option[RegisteredUser] = { val ru = regUsers.values.find(p => p.id == id) ru foreach { u => regUsers -= u.authToken } ru } } case class RegisteredUser( id: String, externId: String, name: String, role: String, authToken: String, avatarURL: String, guest: Boolean, authed: Boolean, guestStatus: String, registeredOn: Long, joined: Boolean, markAsJoinTimedOut: Boolean, banned: Boolean )
{ "pile_set_name": "Github" }
client dev tun proto udp remote nyc-c13.ipvanish.com 443 resolv-retry infinite nobind persist-key persist-tun persist-remote-ip ca /etc/openvpn/ipvanish/ca.ipvanish.com.crt verify-x509-name nyc-c13.ipvanish.com name auth-user-pass /config/openvpn-credentials.txt comp-lzo verb 3 auth SHA256 cipher AES-256-CBC keysize 256 tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-DSS-WITH-AES-256-CBC-SHA:TLS-RSA-WITH-AES-256-CBC-SHA
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <LanguageData> <!-- EN: decree failed --> <DecreeFailed.stages.decree_failed.label>указ не исполнен</DecreeFailed.stages.decree_failed.label> <!-- EN: My noble authority has not been respected as it should be. --> <DecreeFailed.stages.decree_failed.description>Моё знатное положение не уважают в надлежащей мере.</DecreeFailed.stages.decree_failed.description> <!-- EN: decree satisfied --> <DecreeMet.stages.decree_satisfied.label>указ исполнен</DecreeMet.stages.decree_satisfied.label> <!-- EN: My noble authority has been respected as it should be. --> <DecreeMet.stages.decree_satisfied.description>Моё знатное положение уважают в полной мере.</DecreeMet.stages.decree_satisfied.description> <!-- EN: disinherited --> <Disinherited.stages.disinherited.label>потеря наследного титула</Disinherited.stages.disinherited.label> <!-- EN: I was disinherited of my title. Do I need to get medieval on these people? --> <Disinherited.stages.disinherited.description>Меня лишили наследного титула. Задать бы им всем за это жару!</Disinherited.stages.disinherited.description> </LanguageData>
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- from contextlib import contextmanager from . import PromptParameterException, prompts from .prompts import list, confirm, input, password, checkbox, rawlist, expand, editor from prompt_toolkit.patch_stdout import patch_stdout as pt_patch_stdout from prompt_toolkit.shortcuts import PromptSession from prompt_toolkit.application import Application def prompt(questions, answers=None, **kwargs): from . import prompts if isinstance(questions, dict): questions = [questions] answers = answers or {} patch_stdout = kwargs.pop('patch_stdout', False) return_asyncio_coroutine = kwargs.pop('return_asyncio_coroutine', False) true_color = kwargs.pop('true_color', False) refresh_interval = kwargs.pop('refresh_interval', 0) kbi_msg = kwargs.pop('keyboard_interrupt_msg', 'Cancelled by user') raise_kbi = kwargs.pop('raise_keyboard_interrupt', False) for question in questions: # import the question if 'type' not in question: raise PromptParameterException('type') if 'name' not in question: raise PromptParameterException('name') if 'message' not in question: raise PromptParameterException('message') try: choices = question.get('choices') if choices is not None and callable(choices): question['choices'] = choices(answers) _kwargs = {} _kwargs.update(kwargs) _kwargs.update(question) type_ = _kwargs.pop('type') name = _kwargs.pop('name') message = _kwargs.pop('message') when = _kwargs.pop('when', None) filter = _kwargs.pop('filter', None) if when: # at least a little sanity check! if callable(question['when']): try: if not question['when'](answers): continue except Exception as e: raise ValueError( 'Problem in \'when\' check of %s question: %s' % (name, e)) else: raise ValueError('\'when\' needs to be function that ' \ 'accepts a dict argument') if filter: # at least a little sanity check! if not callable(question['filter']): raise ValueError('\'filter\' needs to be function that ' \ 'accepts an argument') if callable(question.get('default')): _kwargs['default'] = question['default'](answers) with pt_patch_stdout() if patch_stdout else _dummy_context_manager(): result = getattr(prompts, type_).question(message, **_kwargs) if isinstance(result, PromptSession): answer = result.prompt() elif isinstance(result, Application): answer = result.run() else: # assert isinstance(answer, str) answer = result # answer = application.run( # return_asyncio_coroutine=return_asyncio_coroutine, # true_color=true_color, # refresh_interval=refresh_interval) if answer is not None: if filter: try: answer = question['filter'](answer) except Exception as e: raise ValueError( 'Problem processing \'filter\' of %s question: %s' % (name, e)) answers[name] = answer except AttributeError as e: print(e) raise ValueError('No question type \'%s\'' % type_) except KeyboardInterrupt as exc: if raise_kbi: raise exc from None if kbi_msg: print('') print(kbi_msg) print('') return {} return answers @contextmanager def _dummy_context_manager(): yield # TODO: # Bottom Bar - inquirer.ui.BottomBar
{ "pile_set_name": "Github" }
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="@dimen/widget_margin"> <LinearLayout android:id="@+id/mensa_widget_header_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/widget_header_rounded_corners_background" android:gravity="center_vertical" android:orientation="horizontal" android:padding="@dimen/material_small_padding"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:id="@+id/mensa_widget_header" android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="sans-serif-medium" android:textColor="@android:color/white" android:textSize="16sp" tools:text="Mensa" /> <TextView android:id="@+id/mensa_widget_subhead" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@android:color/white" android:textSize="14sp" tools:text="Date" /> </LinearLayout> <ImageView android:id="@+id/mensa_widget_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_cutlery" android:tint="@android:color/white" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="@drawable/widget_content_rounded_corners_background"> <ListView android:id="@+id/food_item" android:layout_width="match_parent" android:layout_height="match_parent" android:dividerHeight="1dp" android:divider="@color/list_divider" android:listSelector="@android:color/transparent" /> <TextView android:id="@+id/empty_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:fontFamily="sans-serif-medium" android:textColor="@color/text_dark_gray" android:textSize="20sp" tools:text="Empty view" tools:visibility="visible" /> </FrameLayout> </LinearLayout>
{ "pile_set_name": "Github" }
{ "aggregate": { "name": "newname", "availability_zone": "nova2" } }
{ "pile_set_name": "Github" }
------------------------------------------------------------------------------- --- $Id: ViewerColours.hs#2 2009/07/18 22:48:30 REDMOND\\satnams $ --- $Source: //depot/satnams/haskell/ThreadScope/ViewerColours.hs $ ------------------------------------------------------------------------------- module GUI.ViewerColours (Color, module GUI.ViewerColours) where import Graphics.UI.Gtk import Graphics.Rendering.Cairo ------------------------------------------------------------------------------- -- Colours runningColour :: Color runningColour = darkGreen gcColour :: Color gcColour = orange gcWaitColour :: Color gcWaitColour = lightOrange gcStartColour, gcWorkColour, gcIdleColour, gcEndColour :: Color gcStartColour = lightOrange gcWorkColour = orange gcIdleColour = lightOrange gcEndColour = lightOrange createThreadColour :: Color createThreadColour = lightBlue seqGCReqColour :: Color seqGCReqColour = cyan parGCReqColour :: Color parGCReqColour = darkBlue migrateThreadColour :: Color migrateThreadColour = darkRed threadWakeupColour :: Color threadWakeupColour = green shutdownColour :: Color shutdownColour = darkBrown labelTextColour :: Color labelTextColour = white bookmarkColour :: Color bookmarkColour = Color 0xff00 0x0000 0xff00 -- pinkish fizzledDudsColour, createdConvertedColour, overflowedColour :: Color fizzledDudsColour = grey createdConvertedColour = darkGreen overflowedColour = red userMessageColour :: Color userMessageColour = darkRed outerPercentilesColour :: Color outerPercentilesColour = lightGrey ------------------------------------------------------------------------------- black :: Color black = Color 0 0 0 grey :: Color grey = Color 0x8000 0x8000 0x8000 lightGrey :: Color lightGrey = Color 0xD000 0xD000 0xD000 gtkBorderGrey :: Color gtkBorderGrey = Color 0xF200 0xF100 0xF000 red :: Color red = Color 0xFFFF 0 0 green :: Color green = Color 0 0xFFFF 0 darkGreen :: Color darkGreen = Color 0x0000 0x6600 0x0000 blue :: Color blue = Color 0 0 0xFFFF cyan :: Color cyan = Color 0 0xFFFF 0xFFFF magenta :: Color magenta = Color 0xFFFF 0 0xFFFF lightBlue :: Color lightBlue = Color 0x6600 0x9900 0xFF00 darkBlue :: Color darkBlue = Color 0 0 0xBB00 purple :: Color purple = Color 0x9900 0x0000 0xcc00 darkPurple :: Color darkPurple = Color 0x6600 0 0x6600 darkRed :: Color darkRed = Color 0xcc00 0x0000 0x0000 orange :: Color orange = Color 0xE000 0x7000 0x0000 -- orange lightOrange :: Color lightOrange = Color 0xE000 0xD000 0xB000 -- orange profileBackground :: Color profileBackground = Color 0xFFFF 0xFFFF 0xFFFF tickColour :: Color tickColour = Color 0x3333 0x3333 0xFFFF darkBrown :: Color darkBrown = Color 0x6600 0 0 yellow :: Color yellow = Color 0xff00 0xff00 0x3300 white :: Color white = Color 0xffff 0xffff 0xffff ------------------------------------------------------------------------------- setSourceRGBAhex :: Color -> Double -> Render () setSourceRGBAhex (Color r g b) t = setSourceRGBA (fromIntegral r/0xFFFF) (fromIntegral g/0xFFFF) (fromIntegral b/0xFFFF) t -------------------------------------------------------------------------------
{ "pile_set_name": "Github" }
# mousetrap mousetrap is a tiny library that answers a single question. On a Windows machine, was the process invoked by someone double clicking on the executable file while browsing in explorer? ### Motivation Windows developers unfamiliar with command line tools will often "double-click" the executable for a tool. Because most CLI tools print the help and then exit when invoked without arguments, this is often very frustrating for those users. mousetrap provides a way to detect these invocations so that you can provide more helpful behavior and instructions on how to run the CLI tool. To see what this looks like, both from an organizational and a technical perspective, see https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ ### The interface The library exposes a single interface: func StartedByExplorer() (bool)
{ "pile_set_name": "Github" }
// Copyright (C) MongoDB, Inc. 2017-present. // // 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 // +build !go1.9 package bson // import "go.mongodb.org/mongo-driver/bson" import ( "math" "strconv" "strings" ) // Zeroer allows custom struct types to implement a report of zero // state. All struct types that don't implement Zeroer or where IsZero // returns false are considered to be not zero. type Zeroer interface { IsZero() bool } // D represents a BSON Document. This type can be used to represent BSON in a concise and readable // manner. It should generally be used when serializing to BSON. For deserializing, the Raw or // Document types should be used. // // Example usage: // // primitive.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} // // This type should be used in situations where order matters, such as MongoDB commands. If the // order is not important, a map is more comfortable and concise. type D []E // Map creates a map from the elements of the D. func (d D) Map() M { m := make(M, len(d)) for _, e := range d { m[e.Key] = e.Value } return m } // E represents a BSON element for a D. It is usually used inside a D. type E struct { Key string Value interface{} } // M is an unordered, concise representation of a BSON Document. It should generally be used to // serialize BSON when the order of the elements of a BSON document do not matter. If the element // order matters, use a D instead. // // Example usage: // // primitive.M{"foo": "bar", "hello": "world", "pi": 3.14159} // // This type is handled in the encoders as a regular map[string]interface{}. The elements will be // serialized in an undefined, random order, and the order will be different each time. type M map[string]interface{} // An A represents a BSON array. This type can be used to represent a BSON array in a concise and // readable manner. It should generally be used when serializing to BSON. For deserializing, the // RawArray or Array types should be used. // // Example usage: // // primitive.A{"bar", "world", 3.14159, primitive.D{{"qux", 12345}}} // type A []interface{} func formatDouble(f float64) string { var s string if math.IsInf(f, 1) { s = "Infinity" } else if math.IsInf(f, -1) { s = "-Infinity" } else if math.IsNaN(f) { s = "NaN" } else { // Print exactly one decimalType place for integers; otherwise, print as many are necessary to // perfectly represent it. s = strconv.FormatFloat(f, 'G', -1, 64) if !strings.ContainsRune(s, '.') { s += ".0" } } return s }
{ "pile_set_name": "Github" }
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Constants that were deprecated or moved to enums in the FreeBSD headers. Keep // them here for backwards compatibility. package unix const ( IFF_SMART = 0x20 IFT_1822 = 0x2 IFT_A12MPPSWITCH = 0x82 IFT_AAL2 = 0xbb IFT_AAL5 = 0x31 IFT_ADSL = 0x5e IFT_AFLANE8023 = 0x3b IFT_AFLANE8025 = 0x3c IFT_ARAP = 0x58 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 IFT_ASYNC = 0x54 IFT_ATM = 0x25 IFT_ATMDXI = 0x69 IFT_ATMFUNI = 0x6a IFT_ATMIMA = 0x6b IFT_ATMLOGICAL = 0x50 IFT_ATMRADIO = 0xbd IFT_ATMSUBINTERFACE = 0x86 IFT_ATMVCIENDPT = 0xc2 IFT_ATMVIRTUAL = 0x95 IFT_BGPPOLICYACCOUNTING = 0xa2 IFT_BSC = 0x53 IFT_CCTEMUL = 0x3d IFT_CEPT = 0x13 IFT_CES = 0x85 IFT_CHANNEL = 0x46 IFT_CNR = 0x55 IFT_COFFEE = 0x84 IFT_COMPOSITELINK = 0x9b IFT_DCN = 0x8d IFT_DIGITALPOWERLINE = 0x8a IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba IFT_DLSW = 0x4a IFT_DOCSCABLEDOWNSTREAM = 0x80 IFT_DOCSCABLEMACLAYER = 0x7f IFT_DOCSCABLEUPSTREAM = 0x81 IFT_DS0 = 0x51 IFT_DS0BUNDLE = 0x52 IFT_DS1FDL = 0xaa IFT_DS3 = 0x1e IFT_DTM = 0x8c IFT_DVBASILN = 0xac IFT_DVBASIOUT = 0xad IFT_DVBRCCDOWNSTREAM = 0x93 IFT_DVBRCCMACLAYER = 0x92 IFT_DVBRCCUPSTREAM = 0x94 IFT_ENC = 0xf4 IFT_EON = 0x19 IFT_EPLRS = 0x57 IFT_ESCON = 0x49 IFT_ETHER = 0x6 IFT_FAITH = 0xf2 IFT_FAST = 0x7d IFT_FASTETHER = 0x3e IFT_FASTETHERFX = 0x45 IFT_FDDI = 0xf IFT_FIBRECHANNEL = 0x38 IFT_FRAMERELAYINTERCONNECT = 0x3a IFT_FRAMERELAYMPI = 0x5c IFT_FRDLCIENDPT = 0xc1 IFT_FRELAY = 0x20 IFT_FRELAYDCE = 0x2c IFT_FRF16MFRBUNDLE = 0xa3 IFT_FRFORWARD = 0x9e IFT_G703AT2MB = 0x43 IFT_G703AT64K = 0x42 IFT_GIF = 0xf0 IFT_GIGABITETHERNET = 0x75 IFT_GR303IDT = 0xb2 IFT_GR303RDT = 0xb1 IFT_H323GATEKEEPER = 0xa4 IFT_H323PROXY = 0xa5 IFT_HDH1822 = 0x3 IFT_HDLC = 0x76 IFT_HDSL2 = 0xa8 IFT_HIPERLAN2 = 0xb7 IFT_HIPPI = 0x2f IFT_HIPPIINTERFACE = 0x39 IFT_HOSTPAD = 0x5a IFT_HSSI = 0x2e IFT_HY = 0xe IFT_IBM370PARCHAN = 0x48 IFT_IDSL = 0x9a IFT_IEEE80211 = 0x47 IFT_IEEE80212 = 0x37 IFT_IEEE8023ADLAG = 0xa1 IFT_IFGSN = 0x91 IFT_IMT = 0xbe IFT_INTERLEAVE = 0x7c IFT_IP = 0x7e IFT_IPFORWARD = 0x8e IFT_IPOVERATM = 0x72 IFT_IPOVERCDLC = 0x6d IFT_IPOVERCLAW = 0x6e IFT_IPSWITCH = 0x4e IFT_IPXIP = 0xf9 IFT_ISDN = 0x3f IFT_ISDNBASIC = 0x14 IFT_ISDNPRIMARY = 0x15 IFT_ISDNS = 0x4b IFT_ISDNU = 0x4c IFT_ISO88022LLC = 0x29 IFT_ISO88023 = 0x7 IFT_ISO88024 = 0x8 IFT_ISO88025 = 0x9 IFT_ISO88025CRFPINT = 0x62 IFT_ISO88025DTR = 0x56 IFT_ISO88025FIBER = 0x73 IFT_ISO88026 = 0xa IFT_ISUP = 0xb3 IFT_L3IPXVLAN = 0x89 IFT_LAPB = 0x10 IFT_LAPD = 0x4d IFT_LAPF = 0x77 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 IFT_MEDIAMAILOVERIP = 0x8b IFT_MFSIGLINK = 0xa7 IFT_MIOX25 = 0x26 IFT_MODEM = 0x30 IFT_MPC = 0x71 IFT_MPLS = 0xa6 IFT_MPLSTUNNEL = 0x96 IFT_MSDSL = 0x8f IFT_MVL = 0xbf IFT_MYRINET = 0x63 IFT_NFAS = 0xaf IFT_NSIP = 0x1b IFT_OPTICALCHANNEL = 0xc3 IFT_OPTICALTRANSPORT = 0xc4 IFT_OTHER = 0x1 IFT_P10 = 0xc IFT_P80 = 0xd IFT_PARA = 0x22 IFT_PFLOG = 0xf6 IFT_PFSYNC = 0xf7 IFT_PLC = 0xae IFT_POS = 0xab IFT_PPPMULTILINKBUNDLE = 0x6c IFT_PROPBWAP2MP = 0xb8 IFT_PROPCNLS = 0x59 IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 IFT_PROPMUX = 0x36 IFT_PROPWIRELESSP2P = 0x9d IFT_PTPSERIAL = 0x16 IFT_PVC = 0xf1 IFT_QLLC = 0x44 IFT_RADIOMAC = 0xbc IFT_RADSL = 0x5f IFT_REACHDSL = 0xc0 IFT_RFC1483 = 0x9f IFT_RS232 = 0x21 IFT_RSRB = 0x4f IFT_SDLC = 0x11 IFT_SDSL = 0x60 IFT_SHDSL = 0xa9 IFT_SIP = 0x1f IFT_SLIP = 0x1c IFT_SMDSDXI = 0x2b IFT_SMDSICIP = 0x34 IFT_SONET = 0x27 IFT_SONETOVERHEADCHANNEL = 0xb9 IFT_SONETPATH = 0x32 IFT_SONETVT = 0x33 IFT_SRP = 0x97 IFT_SS7SIGLINK = 0x9c IFT_STACKTOSTACK = 0x6f IFT_STARLAN = 0xb IFT_STF = 0xd7 IFT_T1 = 0x12 IFT_TDLC = 0x74 IFT_TERMPAD = 0x5b IFT_TR008 = 0xb0 IFT_TRANSPHDLC = 0x7b IFT_TUNNEL = 0x83 IFT_ULTRA = 0x1d IFT_USB = 0xa0 IFT_V11 = 0x40 IFT_V35 = 0x2d IFT_V36 = 0x41 IFT_V37 = 0x78 IFT_VDSL = 0x61 IFT_VIRTUALIPADDRESS = 0x70 IFT_VOICEEM = 0x64 IFT_VOICEENCAP = 0x67 IFT_VOICEFXO = 0x65 IFT_VOICEFXS = 0x66 IFT_VOICEOVERATM = 0x98 IFT_VOICEOVERFRAMERELAY = 0x99 IFT_VOICEOVERIP = 0x68 IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 IFT_X25HUNTGROUP = 0x7a IFT_X25MLP = 0x79 IFT_X25PLE = 0x28 IFT_XETHER = 0x1a IPPROTO_MAXID = 0x34 IPV6_FAITH = 0x1d IP_FAITH = 0x16 MAP_NORESERVE = 0x40 MAP_RENAME = 0x20 NET_RT_MAXID = 0x6 RTF_PRCLONING = 0x10000 RTM_OLDADD = 0x9 RTM_OLDDEL = 0xa SIOCADDRT = 0x8030720a SIOCALIFADDR = 0x8118691b SIOCDELRT = 0x8030720b SIOCDLIFADDR = 0x8118691d SIOCGLIFADDR = 0xc118691c SIOCGLIFPHYADDR = 0xc118694b SIOCSLIFPHYADDR = 0x8118694a )
{ "pile_set_name": "Github" }
package ini // Walk will traverse the AST using the v, the Visitor. func Walk(tree []AST, v Visitor) error { for _, node := range tree { switch node.Kind { case ASTKindExpr, ASTKindExprStatement: if err := v.VisitExpr(node); err != nil { return err } case ASTKindStatement, ASTKindCompletedSectionStatement, ASTKindNestedSectionStatement, ASTKindCompletedNestedSectionStatement: if err := v.VisitStatement(node); err != nil { return err } } } return nil }
{ "pile_set_name": "Github" }
-----BEGIN CERTIFICATE----- MIIB1TCCAT4CCQDV5mPlzm9+izANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDEyQ3 NTI3YmQ3Ny1hYjNlLTQ3NGItYWNlNy1lZWQ2MDUzOTMxZTcwHhcNMTUwNzA2MjI0 NTA3WhcNMjUwNzAzMjI0NTA3WjAvMS0wKwYDVQQDEyQ3NTI3YmQ3Ny1hYjNlLTQ3 NGItYWNlNy1lZWQ2MDUzOTMxZTcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB ALNRHEirN6vQAIBtf+Ud2yfgZ308sqt/sR4Nh8h1XQdko8PxYOtsHHb98G7Q5bay OfO/9JVlsnQMC48T+nT55PSpvaoLXSLP2JMPuuJt3uDGGKtVvzJvd8GNezFzxXyn g3LUty81KoKPBRsmp1GiB+gl5OKo8znzPmw3O6/mKruLAgMBAAEwDQYJKoZIhvcN AQEFBQADgYEACzoHUF8UV2Z6541Q2wKEA0UFUzmUjf/E1XwBO+1P15ZZ64uw34B4 1RwMPtAo9RY/PmICTWtNxWGxkzwb2JtDWtnxVER/lF8k2XcXPE76fxTHJF/BKk9J QU8OTD1dd9gHCBviQB9TqntRZ5X7axjtuWjb2umY+owBYzAHZkp1HKI= -----END CERTIFICATE-----
{ "pile_set_name": "Github" }
version=3 http://sf.net/pure-data/nusmuk-utils-(.*)\.tar\.gz
{ "pile_set_name": "Github" }
{ "created_at": "2015-02-27T22:28:49.231626", "description": "rbenv plugin to Run a command across all installed rubies.", "fork": false, "full_name": "chriseppstein/rbenv-each", "language": "Shell", "updated_at": "2015-02-27T23:43:25.963483" }
{ "pile_set_name": "Github" }
#include "gauge_wrapper.h" #include "allocator_mgr.h" #include "wxgui_defs.h" #include "wxgui_helpers.h" #include "xmlutils.h" #include <wx/gauge.h> GaugeWrapper::GaugeWrapper() : wxcWidget(ID_WXGAUGE) { PREPEND_STYLE(wxGA_HORIZONTAL, true); PREPEND_STYLE(wxGA_VERTICAL, false); PREPEND_STYLE(wxGA_SMOOTH, false); AddProperty(new StringProperty( PROP_RANGE, wxT("100"), _("Integer range (maximum value) of the gauge. It is ignored when the gauge is used in indeterminate mode."))); AddProperty(new StringProperty(PROP_VALUE, wxT("10"), _("Sets the position of the gauge"))); m_namePattern = wxT("m_gauge"); SetName(GenerateName()); } GaugeWrapper::~GaugeWrapper() {} wxcWidget* GaugeWrapper::Clone() const { return new GaugeWrapper(); } wxString GaugeWrapper::CppCtorCode() const { // wxGauge(wxWindow* parent, wxWindowID id, int range, const wxPoint& pos = wxDefaultPosition, const wxSize& size = // wxDefaultSize, long style = wxGA_HORIZONTAL, const wxValidator& validator = wxDefaultValidator, const wxString& // name = "gauge") wxString cpp; cpp << GetName() << wxT(" = new ") << GetRealClassName() << "(" << GetWindowParent() << wxT(", ") << WindowID() << wxT(", ") << PropertyString(PROP_RANGE) << wxT(", ") << wxT("wxDefaultPosition, ") << SizeAsString() << wxT(", ") << StyleFlags(wxT("wxGA_HORIZONTAL")) << wxT(");\n"); cpp << CPPCommonAttributes(); int pos = wxCrafter::ToNumber(PropertyString(PROP_VALUE), 0); cpp << GetName() << wxT("->SetValue(") << pos << wxT(");\n"); return cpp; } void GaugeWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add(wxT("#include <wx/gauge.h>")); } wxString GaugeWrapper::GetWxClassName() const { return wxT("wxGauge"); } void GaugeWrapper::ToXRC(wxString& text, XRC_TYPE type) const { text << XRCPrefix() << wxT("<range>") << wxCrafter::ToNumber(PropertyString(PROP_RANGE), 100) << wxT("</range>") << wxT("<value>") << wxCrafter::ToNumber(PropertyString(PROP_VALUE), 10) << wxT("</value>") << XRCStyle() << XRCCommonAttributes() << XRCSize() << XRCSuffix(); } void GaugeWrapper::LoadPropertiesFromXRC(const wxXmlNode* node) { // First call the base-class for the standard things wxcWidget::LoadPropertiesFromXRC(node); wxXmlNode* propertynode = XmlUtils::FindFirstByTagName(node, wxT("range")); if(propertynode) { SetPropertyString(PROP_RANGE, propertynode->GetNodeContent()); } propertynode = XmlUtils::FindFirstByTagName(node, wxT("value")); if(propertynode) { SetPropertyString(PROP_VALUE, propertynode->GetNodeContent()); } } void GaugeWrapper::LoadPropertiesFromwxSmith(const wxXmlNode* node) { // First call the base-class for the standard things wxcWidget::LoadPropertiesFromwxSmith(node); wxXmlNode* propertynode = XmlUtils::FindFirstByTagName(node, wxT("range")); if(propertynode) { SetPropertyString(PROP_RANGE, propertynode->GetNodeContent()); } propertynode = XmlUtils::FindFirstByTagName(node, wxT("value")); if(propertynode) { SetPropertyString(PROP_VALUE, propertynode->GetNodeContent()); } } void GaugeWrapper::LoadPropertiesFromwxFB(const wxXmlNode* node) { // First call the base-class for the standard things wxcWidget::LoadPropertiesFromwxFB(node); wxXmlNode* propertynode = XmlUtils::FindNodeByName(node, "property", "range"); if(propertynode) { SetPropertyString(PROP_RANGE, propertynode->GetNodeContent()); } propertynode = XmlUtils::FindNodeByName(node, "property", "value"); if(propertynode) { SetPropertyString(PROP_VALUE, propertynode->GetNodeContent()); } }
{ "pile_set_name": "Github" }
'use strict'; var React = require('react'); var classNames = require('classnames'); var ClassNameMixin = require('./mixins/ClassNameMixin'); var AvgGrid = require('./AvgGrid'); var omit = require('object.omit'); var Thumbnails = React.createClass({ mixins: [ClassNameMixin], propTypes: { classPrefix: React.PropTypes.string }, getDefaultProps: function() { return { classPrefix: 'thumbnails' }; }, render: function() { var classes = classNames(this.getClassSet(), this.props.className); var restProps = omit(this.props, Object.keys(this.constructor.propTypes)); return ( <AvgGrid {...restProps} className={classes} > {React.Children.map(this.props.children, function(child, i) { return ( <li key={i}> {child} </li> ); })} </AvgGrid> ); } }); module.exports = Thumbnails;
{ "pile_set_name": "Github" }
/****************** * display_list.h * *****************/ /********************************************************************************** * Adapted from: * * https://github.com/RudolphRiedel/FT800-FT813 * * By Rudolph Riedel * * * * MIT License * * * * Copyright (c) 2017 * * * * 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. * * * **********************************************************************************/ #pragma once namespace FTDI { /* FT8xx graphics engine specific macros useful for static display list generation */ inline uint32_t ALPHA_FUNC(uint8_t func, uint8_t ref) {return DL::ALPHA_FUNC|((func&7UL)<<8)|(ref&255UL);} inline uint32_t BEGIN(begin_t prim) {return DL::BEGIN|(prim&15UL);} inline uint32_t BITMAP_SOURCE(uint32_t ram_g_addr) {return DL::BITMAP_SOURCE|(ram_g_addr);} inline uint32_t BITMAP_HANDLE(uint8_t handle) {return DL::BITMAP_HANDLE|(handle&31UL);} inline uint32_t BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint16_t height) {return DL::BITMAP_LAYOUT|((format&31UL)<<19)|((linestride&1023UL)<<9)|(height&511UL);} inline uint32_t BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) {return DL::BITMAP_SIZE|((filter&1UL)<<20)|((wrapx&1UL)<<19)|((wrapy&1UL)<<18)|((width&511UL)<<9)|(height&511UL);} #if FTDI_API_LEVEL >= 810 inline uint32_t BITMAP_LAYOUT_H(uint8_t linestride, uint8_t height) {return DL::BITMAP_LAYOUT_H|((linestride&3UL)<<2)|(height&3UL);} inline uint32_t BITMAP_SIZE_H(uint8_t width, uint8_t height) {return DL::BITMAP_SIZE_H|((width&3UL)<<2)|(height&3UL);} #endif inline uint32_t BITMAP_TRANSFORM_A(uint16_t a) {return DL::BITMAP_TRANSFORM_A|(a&131071UL);} inline uint32_t BITMAP_TRANSFORM_B(uint16_t b) {return DL::BITMAP_TRANSFORM_B|(b&131071UL);} inline uint32_t BITMAP_TRANSFORM_C(uint32_t c) {return DL::BITMAP_TRANSFORM_C|(c&16777215UL);} inline uint32_t BITMAP_TRANSFORM_D(uint16_t d) {return DL::BITMAP_TRANSFORM_D|(d&131071UL);} inline uint32_t BITMAP_TRANSFORM_E(uint16_t e) {return DL::BITMAP_TRANSFORM_E|(e&131071UL);} inline uint32_t BITMAP_TRANSFORM_F(uint32_t f) {return DL::BITMAP_TRANSFORM_F|(f&16777215UL);} inline uint32_t BLEND_FUNC(uint8_t src,uint8_t dst) {return DL::BLEND_FUNC|((src&7UL)<<3)|(dst&7UL);} inline uint32_t CALL(uint16_t dest) {return DL::CALL|(dest&65535UL);} inline uint32_t CELL(uint8_t cell) {return DL::CELL|(cell&127UL);} inline uint32_t CLEAR(bool c,bool s,bool t) {return DL::CLEAR|((c?1UL:0UL)<<2)|((s?1UL:0UL)<<1)|(t?1UL:0UL);} inline uint32_t CLEAR_COLOR_A(uint8_t alpha) {return DL::CLEAR_COLOR_A|(alpha&255UL);} inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) {return DL::CLEAR_COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);} inline uint32_t CLEAR_COLOR_RGB(uint32_t rgb) {return DL::CLEAR_COLOR_RGB|rgb;} inline uint32_t CLEAR_STENCIL(uint8_t s) {return DL::CLEAR_STENCIL|(s&255UL);} inline uint32_t CLEAR_TAG(uint8_t s) {return DL::CLEAR_TAG|(s&255UL);} inline uint32_t COLOR_A(uint8_t alpha) {return DL::COLOR_A|(alpha&255UL);} inline uint32_t COLOR_MASK(bool r, bool g, bool b, bool a) {return DL::COLOR_MASK|((r?1UL:0UL)<<3)|((g?1UL:0UL)<<2)|((b?1UL:0UL)<<1)|(a?1UL:0UL);} inline uint32_t COLOR_RGB(uint8_t red,uint8_t green,uint8_t blue) {return DL::COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);} inline uint32_t COLOR_RGB(uint32_t rgb) {return DL::COLOR_RGB|rgb;} /* inline uint32_t DISPLAY() {return (0UL<<24)) */ inline uint32_t END() {return DL::END;} inline uint32_t JUMP(uint16_t dest) {return DL::JUMP|(dest&65535UL);} inline uint32_t LINE_WIDTH(uint16_t width) {return DL::LINE_WIDTH|(width&4095UL);} inline uint32_t MACRO(uint8_t m) {return DL::MACRO|(m&1UL);} inline uint32_t POINT_SIZE(uint16_t size) {return DL::POINT_SIZE|(size&8191UL);} inline uint32_t RESTORE_CONTEXT() {return DL::RESTORE_CONTEXT;} inline uint32_t RETURN () {return DL::RETURN;} inline uint32_t SAVE_CONTEXT() {return DL::SAVE_CONTEXT;} inline uint32_t SCISSOR_XY(uint16_t x,uint16_t y) { return DL::SCISSOR_XY | (FTDI::ftdi_chip >= 810 ? ((x&2047UL)<<11)|(y&2047UL) : ((x& 511UL)<<10)|(y&511UL)); } inline uint32_t SCISSOR_SIZE(uint16_t w,uint16_t h) { return DL::SCISSOR_SIZE | (FTDI::ftdi_chip >= 810 ? ((w&4095UL)<<12)|(h&4095UL) : ((w&1023UL)<<10)|(h&1023UL)); } inline uint32_t SCISSOR_XY() {return DL::SCISSOR_XY;} inline uint32_t SCISSOR_SIZE() { return DL::SCISSOR_SIZE | (FTDI::ftdi_chip >= 810 ? (2048UL<<12)|(2048UL) : ( 512UL<<10)|( 512UL)); } inline uint32_t STENCIL_FUNC(uint16_t func, uint8_t ref, uint8_t mask) {return DL::STENCIL_FUNC|((func&7UL)<<16)|((ref&255UL)<<8)|(mask&255UL);} inline uint32_t STENCIL_MASK(uint8_t mask) {return DL::STENCIL_MASK|(mask&255UL);} inline uint32_t STENCIL_OP(uint8_t sfail, uint8_t spass) {return DL::STENCIL_OP|(((sfail)&7UL)<<3)|(spass&7UL);} inline uint32_t TAG(uint8_t s) {return DL::TAG|(s&255UL);} inline uint32_t TAG_MASK(bool mask) {return DL::TAG_MASK|(mask?1:0);} inline uint32_t VERTEX2F(uint16_t x, uint16_t y) {return DL::VERTEX2F|((x&32767UL)<<15)|(y&32767UL);} inline uint32_t VERTEX2II(uint16_t x,uint16_t y, uint8_t handle = 0, uint8_t cell = 0) {return DL::VERTEX2II|((x&511UL)<<21)|((y&511UL)<<12)|((handle&31UL)<<7)|(cell&127UL);} #if FTDI_API_LEVEL >= 810 inline uint32_t VERTEX_FORMAT(uint8_t frac) {return DL::VERTEX_FORMAT|(frac&7UL);} inline uint32_t VERTEX_TRANSLATE_X(int32_t x) {return DL::VERTEX_TRANSLATE_X|(x&131071UL);} inline uint32_t VERTEX_TRANSLATE_Y(int32_t y) {return DL::VERTEX_TRANSLATE_Y|(y&131071UL);} #endif }
{ "pile_set_name": "Github" }
/* The MIT License (MIT) Copyright (C) 2017 RSK Labs Ltd. 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 "GwMakerEth.h" #include "Utils.h" #include <glog/logging.h> #include <limits.h> ///////////////////////////////GwMakerHandlerEth//////////////////////////////////// bool GwMakerHandlerEth::checkFields(JsonNode &r) { if (r.type() != Utilities::JS::type::Array || r.array().size() < 2) { LOG(ERROR) << "[getBlockByNumber,getWork] returns unexpected"; return false; } auto responses = r.array(); return checkFieldsPendingBlock(responses[0]) && checkFieldsGetwork(responses[1]); } bool GwMakerHandlerEth::checkFieldsPendingBlock(JsonNode &r) { /* response of eth_getBlockByNumber { "jsonrpc": "2.0", "id": 1, "result": { "difficulty": "0xbab6a8bebb86a", "extraData": "0x452f4254432e434f4d2f", "gasLimit": "0x7a1200", "gasUsed": "0x79f82b", "hash": null, "logsBloom": "...", "miner": null, "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "nonce": null, "number": "0x62853d", "parentHash": "0xd0e3d722db1fa9e0a05330bc0a1b4b3421ca61fcf23224d82869eeb2d77263a2", "receiptsRoot": "0x823f1bfe3a5f37f9891c528034d6a124752f63bdcc0e88bf3b731375301337f8", "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "size": "0x8bfb", "stateRoot": "0xdd58b5ce8ad79ca02bb9321c3b1a2123b9f627d9164cf4b73371fc39cfc12c5e", "timestamp": "0x5bb71091", "totalDifficulty": null, "transactions": [...], "transactionsRoot": "0x8bbba93b1b39a96308aac8914b7f407d0ff46bc7456241f9b540874b2e1a4502", "uncles": [...] } } */ if (r.type() != Utilities::JS::type::Obj) { LOG(ERROR) << "getBlockByNumber(penging) returns a non-object"; return false; } JsonNode result = r["result"]; if (result["error"].type() == Utilities::JS::type::Obj && result["error"]["message"].type() == Utilities::JS::type::Str) { LOG(ERROR) << result["error"]["message"].str(); return false; } if (result.type() != Utilities::JS::type::Obj) { LOG(ERROR) << "getBlockByNumber(penging) retrun unexpected"; return false; } if (result["parentHash"].type() != Utilities::JS::type::Str || result["gasLimit"].type() != Utilities::JS::type::Str || result["gasUsed"].type() != Utilities::JS::type::Str || // number will be null in some versions of Parity // result["number"].type() != Utilities::JS::type::Str || result["transactions"].type() != Utilities::JS::type::Array || result["uncles"].type() != Utilities::JS::type::Array) { LOG(ERROR) << "result of getBlockByNumber(penging): missing fields"; } return true; } bool GwMakerHandlerEth::checkFieldsGetwork(JsonNode &r) { // Ethereum's GetWork gives us 3 values: // { ... "result":[ // "0x645cf20198c2f3861e947d4f67e3ab63b7b2e24dcc9095bd9123e7b33371f6cc", // "0xabad8f99f3918bf903c6a909d9bbc0fdfa5a2f4b9cb1196175ec825c6610126c", // "0x0000000394427b08175efa9a9eb59b9123e2969bf19bf272b20787ed022fbe6c" // ]} // First value is headerhash, second value is seedhash and third value is // target. Seedhash is used to identify DAG file, headerhash and 64 bit // nonce value chosen by our miner give us hash, which, if below provided // target, yield block/share. // error // { // "jsonrpc": "2.0", // "id": 73, // "error": { // "code": -32000, // "message": "mining not ready: No work available yet, don't panic." // } // } if (r.type() != Utilities::JS::type::Obj) { LOG(ERROR) << "getwork returns a non-object"; return false; } JsonNode result = r["result"]; if (result["error"].type() == Utilities::JS::type::Obj && result["error"]["message"].type() == Utilities::JS::type::Str) { LOG(ERROR) << result["error"]["message"].str(); return false; } if (result.type() != Utilities::JS::type::Array || result.array().size() < 3) { LOG(ERROR) << "getwork retrun unexpected"; return false; } return true; } string GwMakerHandlerEth::constructRawMsg(JsonNode &r) { auto responses = r.array(); auto block = responses[0]["result"]; auto work = responses[1]["result"].array(); string heightStr = "null"; // number will be null in some versions of Parity if (block["number"].type() == Utilities::JS::type::Str) { heightStr = block["number"].str(); } // height/block-number in eth_getWork. // Parity will response this field. if (work.size() >= 4 && work[3].type() == Utilities::JS::type::Str) { if (heightStr != "null" && heightStr != work[3].str()) { LOG(WARNING) << "block height mis-matched between getBlockByNumber(pending) " << heightStr << " and getWork() " << work[3].str(); } heightStr = work[3].str(); } long height = strtol(heightStr.c_str(), nullptr, 16); if (height < 1 || height == LONG_MAX) { LOG(WARNING) << "block height/number wrong: " << heightStr << " (" << height << ")"; return ""; } float gasLimit = (float)strtoll(block["gasLimit"].str().c_str(), nullptr, 16); float gasUsed = (float)strtoll(block["gasUsed"].str().c_str(), nullptr, 16); float gasUsedPercent = gasUsed / gasLimit * 100; size_t uncles = block["uncles"].array().size(); size_t transactions = block["transactions"].array().size(); string parentHash = block["parentHash"].str(); // eth_getWork extension fields for BTCPool: // work[4], 32 bytes hex encoded parent block header pow-hash // work[5], hex encoded gas limit // work[6], hex encoded gas used // work[7], hex encoded transaction count // work[8], hex encoded uncle count bool btcpoolExtensionFields = false; if (work.size() >= 9 && work[4].type() == Utilities::JS::type::Str && work[5].type() == Utilities::JS::type::Str && work[6].type() == Utilities::JS::type::Str && work[7].type() == Utilities::JS::type::Str && work[8].type() == Utilities::JS::type::Str) { btcpoolExtensionFields = true; parentHash = work[4].str(); gasLimit = (float)strtoll(work[5].str().c_str(), nullptr, 16); gasUsed = (float)strtoll(work[6].str().c_str(), nullptr, 16); gasUsedPercent = gasUsed / gasLimit * 100; transactions = strtoll(work[7].str().c_str(), nullptr, 16); uncles = strtoll(work[8].str().c_str(), nullptr, 16); } // This field is RLP encoded header with additional 4 bytes at the end of // extra data to be filled by sserver string header; if (work.size() >= 10 && work[9].type() == Utilities::JS::type::Str) { LOG(INFO) << "header for extra nonce: " << work[9]; header = Strings::Format(",\"header\":\"%s\"", work[9].str()); } LOG(INFO) << "chain: " << def_.chainType_ << ", topic: " << def_.rawGwTopic_ << ", parent: " << parentHash << ", target: " << work[2].str() << ", hHash: " << work[0].str() << ", sHash: " << work[1].str() << ", height: " << height << ", uncles: " << uncles << ", transactions: " << transactions << ", gasUsedPercent: " << gasUsedPercent << ", btcpoolExtensionFields: " << (btcpoolExtensionFields ? "true" : "false"); return Strings::Format( "{" "\"created_at_ts\":%u," "\"chainType\":\"%s\"," "\"rpcAddress\":\"%s\"," "\"rpcUserPwd\":\"%s\"," "\"parent\":\"%s\"," "\"target\":\"%s\"," "\"hHash\":\"%s\"," "\"sHash\":\"%s\"," "\"height\":%d," "\"uncles\":%u," "\"transactions\":%u," "\"gasUsedPercent\":%f" "%s" "}", (uint32_t)time(nullptr), def_.chainType_, def_.rpcAddr_, def_.rpcUserPwd_, parentHash, work[2].str(), work[0].str(), work[1].str(), height, uncles, transactions, gasUsedPercent, header); } string GwMakerHandlerEth::getBlockHeight() { const string request = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[" "\"pending\", false],\"id\":2}"; string response; bool res = blockchainNodeRpcCall( def_.rpcAddr_.c_str(), def_.rpcUserPwd_.c_str(), request.c_str(), response); if (!res) { LOG(ERROR) << "get pending block failed"; return ""; } JsonNode j; if (!JsonNode::parse( response.c_str(), response.c_str() + response.length(), j)) { LOG(ERROR) << "deserialize block informaiton failed"; return ""; } JsonNode result = j["result"]; if (result.type() != Utilities::JS::type::Obj || result["number"].type() != Utilities::JS::type::Str) { LOG(ERROR) << "block informaiton format not expected: " << response; return ""; } return result["number"].str(); }
{ "pile_set_name": "Github" }
/* SPDX-License-Identifier: GPL-2.0+ */ /* * USB ConnectTech WhiteHEAT driver * * Copyright (C) 2002 * Connect Tech Inc. * * Copyright (C) 1999, 2000 * Greg Kroah-Hartman ([email protected]) * * See Documentation/usb/usb-serial.rst for more information on using this * driver * */ #ifndef __LINUX_USB_SERIAL_WHITEHEAT_H #define __LINUX_USB_SERIAL_WHITEHEAT_H /* WhiteHEAT commands */ #define WHITEHEAT_OPEN 1 /* open the port */ #define WHITEHEAT_CLOSE 2 /* close the port */ #define WHITEHEAT_SETUP_PORT 3 /* change port settings */ #define WHITEHEAT_SET_RTS 4 /* turn RTS on or off */ #define WHITEHEAT_SET_DTR 5 /* turn DTR on or off */ #define WHITEHEAT_SET_BREAK 6 /* turn BREAK on or off */ #define WHITEHEAT_DUMP 7 /* dump memory */ #define WHITEHEAT_STATUS 8 /* get status */ #define WHITEHEAT_PURGE 9 /* clear the UART fifos */ #define WHITEHEAT_GET_DTR_RTS 10 /* get the state of DTR and RTS for a port */ #define WHITEHEAT_GET_HW_INFO 11 /* get EEPROM info and hardware ID */ #define WHITEHEAT_REPORT_TX_DONE 12 /* get the next TX done */ #define WHITEHEAT_EVENT 13 /* unsolicited status events */ #define WHITEHEAT_ECHO 14 /* send data to the indicated IN endpoint */ #define WHITEHEAT_DO_TEST 15 /* perform specified test */ #define WHITEHEAT_CMD_COMPLETE 16 /* reply for some commands */ #define WHITEHEAT_CMD_FAILURE 17 /* reply for failed commands */ /* * Commands to the firmware */ /* * WHITEHEAT_OPEN * WHITEHEAT_CLOSE * WHITEHEAT_STATUS * WHITEHEAT_GET_DTR_RTS * WHITEHEAT_REPORT_TX_DONE */ struct whiteheat_simple { __u8 port; /* port number (1 to N) */ }; /* * WHITEHEAT_SETUP_PORT */ #define WHITEHEAT_PAR_NONE 'n' /* no parity */ #define WHITEHEAT_PAR_EVEN 'e' /* even parity */ #define WHITEHEAT_PAR_ODD 'o' /* odd parity */ #define WHITEHEAT_PAR_SPACE '0' /* space (force 0) parity */ #define WHITEHEAT_PAR_MARK '1' /* mark (force 1) parity */ #define WHITEHEAT_SFLOW_NONE 'n' /* no software flow control */ #define WHITEHEAT_SFLOW_RX 'r' /* XOFF/ON is sent when RX fills/empties */ #define WHITEHEAT_SFLOW_TX 't' /* when received XOFF/ON will stop/start TX */ #define WHITEHEAT_SFLOW_RXTX 'b' /* both SFLOW_RX and SFLOW_TX */ #define WHITEHEAT_HFLOW_NONE 0x00 /* no hardware flow control */ #define WHITEHEAT_HFLOW_RTS_TOGGLE 0x01 /* RTS is on during transmit, off otherwise */ #define WHITEHEAT_HFLOW_DTR 0x02 /* DTR is off/on when RX fills/empties */ #define WHITEHEAT_HFLOW_CTS 0x08 /* when received CTS off/on will stop/start TX */ #define WHITEHEAT_HFLOW_DSR 0x10 /* when received DSR off/on will stop/start TX */ #define WHITEHEAT_HFLOW_RTS 0x80 /* RTS is off/on when RX fills/empties */ struct whiteheat_port_settings { __u8 port; /* port number (1 to N) */ __le32 baud; /* any value 7 - 460800, firmware calculates best fit; arrives little endian */ __u8 bits; /* 5, 6, 7, or 8 */ __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */ __u8 parity; /* see WHITEHEAT_PAR_* above */ __u8 sflow; /* see WHITEHEAT_SFLOW_* above */ __u8 xoff; /* XOFF byte value */ __u8 xon; /* XON byte value */ __u8 hflow; /* see WHITEHEAT_HFLOW_* above */ __u8 lloop; /* 0/1 turns local loopback mode off/on */ } __attribute__ ((packed)); /* * WHITEHEAT_SET_RTS * WHITEHEAT_SET_DTR * WHITEHEAT_SET_BREAK */ #define WHITEHEAT_RTS_OFF 0x00 #define WHITEHEAT_RTS_ON 0x01 #define WHITEHEAT_DTR_OFF 0x00 #define WHITEHEAT_DTR_ON 0x01 #define WHITEHEAT_BREAK_OFF 0x00 #define WHITEHEAT_BREAK_ON 0x01 struct whiteheat_set_rdb { __u8 port; /* port number (1 to N) */ __u8 state; /* 0/1 turns signal off/on */ }; /* * WHITEHEAT_DUMP */ #define WHITEHEAT_DUMP_MEM_DATA 'd' /* data */ #define WHITEHEAT_DUMP_MEM_IDATA 'i' /* idata */ #define WHITEHEAT_DUMP_MEM_BDATA 'b' /* bdata */ #define WHITEHEAT_DUMP_MEM_XDATA 'x' /* xdata */ /* * Allowable address ranges (firmware checks address): * Type DATA: 0x00 - 0xff * Type IDATA: 0x80 - 0xff * Type BDATA: 0x20 - 0x2f * Type XDATA: 0x0000 - 0xffff * * B/I/DATA all read the local memory space * XDATA reads the external memory space * BDATA returns bits as bytes * * NOTE: 0x80 - 0xff (local space) are the Special Function Registers * of the 8051, and some have on-read side-effects. */ struct whiteheat_dump { __u8 mem_type; /* see WHITEHEAT_DUMP_* above */ __u16 addr; /* address, see restrictions above */ __u16 length; /* number of bytes to dump, max 63 bytes */ }; /* * WHITEHEAT_PURGE */ #define WHITEHEAT_PURGE_RX 0x01 /* purge rx fifos */ #define WHITEHEAT_PURGE_TX 0x02 /* purge tx fifos */ struct whiteheat_purge { __u8 port; /* port number (1 to N) */ __u8 what; /* bit pattern of what to purge */ }; /* * WHITEHEAT_ECHO */ struct whiteheat_echo { __u8 port; /* port number (1 to N) */ __u8 length; /* length of message to echo, max 61 bytes */ __u8 echo_data[61]; /* data to echo */ }; /* * WHITEHEAT_DO_TEST */ #define WHITEHEAT_TEST_UART_RW 0x01 /* read/write uart registers */ #define WHITEHEAT_TEST_UART_INTR 0x02 /* uart interrupt */ #define WHITEHEAT_TEST_SETUP_CONT 0x03 /* setup for PORT_CONT/PORT_DISCONT */ #define WHITEHEAT_TEST_PORT_CONT 0x04 /* port connect */ #define WHITEHEAT_TEST_PORT_DISCONT 0x05 /* port disconnect */ #define WHITEHEAT_TEST_UART_CLK_START 0x06 /* uart clock test start */ #define WHITEHEAT_TEST_UART_CLK_STOP 0x07 /* uart clock test stop */ #define WHITEHEAT_TEST_MODEM_FT 0x08 /* modem signals, requires a loopback cable/connector */ #define WHITEHEAT_TEST_ERASE_EEPROM 0x09 /* erase eeprom */ #define WHITEHEAT_TEST_READ_EEPROM 0x0a /* read eeprom */ #define WHITEHEAT_TEST_PROGRAM_EEPROM 0x0b /* program eeprom */ struct whiteheat_test { __u8 port; /* port number (1 to n) */ __u8 test; /* see WHITEHEAT_TEST_* above*/ __u8 info[32]; /* additional info */ }; /* * Replies from the firmware */ /* * WHITEHEAT_STATUS */ #define WHITEHEAT_EVENT_MODEM 0x01 /* modem field is valid */ #define WHITEHEAT_EVENT_ERROR 0x02 /* error field is valid */ #define WHITEHEAT_EVENT_FLOW 0x04 /* flow field is valid */ #define WHITEHEAT_EVENT_CONNECT 0x08 /* connect field is valid */ #define WHITEHEAT_FLOW_NONE 0x00 /* no flow control active */ #define WHITEHEAT_FLOW_HARD_OUT 0x01 /* TX is stopped by CTS (waiting for CTS to go on) */ #define WHITEHEAT_FLOW_HARD_IN 0x02 /* remote TX is stopped by RTS */ #define WHITEHEAT_FLOW_SOFT_OUT 0x04 /* TX is stopped by XOFF received (waiting for XON) */ #define WHITEHEAT_FLOW_SOFT_IN 0x08 /* remote TX is stopped by XOFF transmitted */ #define WHITEHEAT_FLOW_TX_DONE 0x80 /* TX has completed */ struct whiteheat_status_info { __u8 port; /* port number (1 to N) */ __u8 event; /* indicates what the current event is, see WHITEHEAT_EVENT_* above */ __u8 modem; /* modem signal status (copy of uart's MSR register) */ __u8 error; /* line status (copy of uart's LSR register) */ __u8 flow; /* flow control state, see WHITEHEAT_FLOW_* above */ __u8 connect; /* 0 means not connected, non-zero means connected */ }; /* * WHITEHEAT_GET_DTR_RTS */ struct whiteheat_dr_info { __u8 mcr; /* copy of uart's MCR register */ }; /* * WHITEHEAT_GET_HW_INFO */ struct whiteheat_hw_info { __u8 hw_id; /* hardware id number, WhiteHEAT = 0 */ __u8 sw_major_rev; /* major version number */ __u8 sw_minor_rev; /* minor version number */ struct whiteheat_hw_eeprom_info { __u8 b0; /* B0 */ __u8 vendor_id_low; /* vendor id (low byte) */ __u8 vendor_id_high; /* vendor id (high byte) */ __u8 product_id_low; /* product id (low byte) */ __u8 product_id_high; /* product id (high byte) */ __u8 device_id_low; /* device id (low byte) */ __u8 device_id_high; /* device id (high byte) */ __u8 not_used_1; __u8 serial_number_0; /* serial number (low byte) */ __u8 serial_number_1; /* serial number */ __u8 serial_number_2; /* serial number */ __u8 serial_number_3; /* serial number (high byte) */ __u8 not_used_2; __u8 not_used_3; __u8 checksum_low; /* checksum (low byte) */ __u8 checksum_high; /* checksum (high byte */ } hw_eeprom_info; /* EEPROM contents */ }; /* * WHITEHEAT_EVENT */ struct whiteheat_event_info { __u8 port; /* port number (1 to N) */ __u8 event; /* see whiteheat_status_info.event */ __u8 info; /* see whiteheat_status_info.modem, .error, .flow, .connect */ }; /* * WHITEHEAT_DO_TEST */ #define WHITEHEAT_TEST_FAIL 0x00 /* test failed */ #define WHITEHEAT_TEST_UNKNOWN 0x01 /* unknown test requested */ #define WHITEHEAT_TEST_PASS 0xff /* test passed */ struct whiteheat_test_info { __u8 port; /* port number (1 to N) */ __u8 test; /* indicates which test this is a response for, see WHITEHEAT_DO_TEST above */ __u8 status; /* see WHITEHEAT_TEST_* above */ __u8 results[32]; /* test-dependent results */ }; #endif
{ "pile_set_name": "Github" }
/* * XAOperation.h * eXttra * * Created by nibs ra on 2/10/05. * Copyright 2005 __MyCompanyName__. All rights reserved. * */ #ifndef _XA_OPERATION_H_ #define _XA_OPERATION_H_ /* #include <XAOperation.h> */ #include <XATypes.h> Boolean XAPerformOperation(XAOperationRef opaqueRef, int fd, CFStringRef path); Boolean XAOperationPerform(XAOperationRef opaqueRef, int fd, CFStringRef path); #endif
{ "pile_set_name": "Github" }
import 'package:logger/src/log_output.dart'; import 'package:logger/src/logger.dart'; /// Logs simultaneously to multiple [LogOutput] outputs. class MultiOutput extends LogOutput { List<LogOutput> _outputs; MultiOutput(List<LogOutput> outputs) { _outputs = _normalizeOutputs(outputs); } List<LogOutput> _normalizeOutputs(List<LogOutput> outputs) { if (outputs == null) return []; outputs.removeWhere((o) => o == null); return outputs; } @override void output(OutputEvent event) { _outputs.forEach((o) => o.output(event)); } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Resizimg plugin | Trumbowyg</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="../../css/main.css"> </head> <body class="documentation-body"> <div class="main main-demo-inner"> <section class="wrapper section"> <h2 class="section-title">Resizimg plugin</h2> <div class="feature"> <h3>Basic usage</h3> <p> Images can be resized by click over the image and dragging their bottom-right corner (the red ones). </p> <a href="../../documentation/plugins/#plugin-resizimg" class="button button-demo">Read resizimg plugin documentation</a> <div id="editor" style="margin: 1rem"> <h2>Resize that image!</h2> <img src="//rawcdn.githack.com/Alex-D/Trumbowyg/develop/banner.jpg" style="height: 200px"> </div> <h4>The code</h4> <p> Nothing to do unless you want to change the default values of options, in which case you could: </p> <pre><code class="js-code-to-eval javascript"> $('#editor').trumbowyg({ plugins: { resizimg: { minSize: 64, step: 16, } } }); </code></pre> </div> <div class="feature"> <h3>Setup</h3> <h4>In head tag</h4> <pre><code class="html loading-head"> </code></pre> <h4>At the end of body</h4> <p>Note the additional requirement: the <a href="https://github.com/RickStrahl/jquery-resizable" target="_blank">jquery-resizable</a> plugin must be loaded for Resizimg to work.</p> <pre><code class="html loading-body"> &lt;!-- Import jQuery --> &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">&lt;/script> &lt;script>window.jQuery || document.write('&lt;script src="js/vendor/jquery-3.3.1.min.js">&lt;\/script>')&lt;/script> &lt;!-- Import only if you use JQuery UI with Resizable interaction --> &lt;script src="//rawcdn.githack.com/trumbowyg/dist/plugins/resizimg/resizable-resolveconflict.min.js">&lt;/script> &lt;!-- Import dependency for Resizimg. For a production setup, follow install instructions here: https://github.com/RickStrahl/jquery-resizable --> &lt;script src="//rawcdn.githack.com/RickStrahl/jquery-resizable/master/dist/jquery-resizable.min.js">&lt;/script> </code></pre> </div> </section> </div> <!-- Import jQuery --> <script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="../../js/vendor/jquery-3.3.1.min.js"><\/script>')</script> <!-- Import dependency for Resizimg --> <script src="//rawcdn.githack.com/RickStrahl/jquery-resizable/master/dist/jquery-resizable.min.js"></script> <!-- DO NOT COPY THESE LINES IN YOUR PROJECT, THEY ARE THERE JUST FOR THE EXAMPLE PAGE PURPOSE --> <script src="../js/loader.js"></script> <script> loadStyle('dist/ui/trumbowyg.css'); loadScript('dist/trumbowyg.js', 'Import Trumbowyg'); loadScript('dist/plugins/resizimg/trumbowyg.resizimg.min.js', 'Import all plugins you want AFTER importing jQuery and Trumbowyg'); </script> <script src="../js/runExampleCode.js"></script> <script src="../js/highlight.js"></script> </body> </html>
{ "pile_set_name": "Github" }
(function() { "use strict"; var Assert = YUITest.Assert; YUITest.TestRunner.add(new YUITest.TestCase({ name: "Outline:none Errors", "Using outline: none should result in a warning": function() { var result = CSSLint.verify(".foo { outline: none; }", { "outline-none": 1 }); Assert.areEqual(1, result.messages.length); Assert.areEqual("warning", result.messages[0].type); Assert.areEqual("Outlines should only be modified using :focus.", result.messages[0].message); }, "Using outline: 0 should result in a warning": function() { var result = CSSLint.verify(".foo { outline: 0; }", { "outline-none": 1 }); Assert.areEqual(1, result.messages.length); Assert.areEqual("warning", result.messages[0].type); Assert.areEqual("Outlines should only be modified using :focus.", result.messages[0].message); }, "Using outline: none alone with :focus should result in a warning": function() { var result = CSSLint.verify(".foo:focus { outline: none; }", { "outline-none": 1 }); Assert.areEqual(1, result.messages.length); Assert.areEqual("warning", result.messages[0].type); Assert.areEqual("Outlines shouldn't be hidden unless other visual changes are made.", result.messages[0].message); }, "Using outline: 0 alone with :focus should result in a warning": function() { var result = CSSLint.verify(".foo:focus { outline: 0; }", { "outline-none": 1 }); Assert.areEqual(1, result.messages.length); Assert.areEqual("warning", result.messages[0].type); Assert.areEqual("Outlines shouldn't be hidden unless other visual changes are made.", result.messages[0].message); }, "Using outline: none with :focus and another property should not result in a warning": function() { var result = CSSLint.verify(".foo:focus { outline: none; border: 1px solid black; }", { "outline-none": 1 }); Assert.areEqual(0, result.messages.length); }, "Using outline: 0 with :focus and another property should not result in a warning": function() { var result = CSSLint.verify(".foo:focus { outline: 0; border: 1px solid black;}", { "outline-none": 1 }); Assert.areEqual(0, result.messages.length); } })); })();
{ "pile_set_name": "Github" }
package edu.stanford.bmir.protege.web.client.progress; import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HasVisibility; import com.google.gwt.user.client.ui.Label; import javax.annotation.Nonnull; import javax.inject.Inject; import static com.google.common.base.Preconditions.checkNotNull; /** * Matthew Horridge * Stanford Center for Biomedical Informatics Research * 1 Mar 2017 */ public class BusyViewImpl extends Composite implements BusyView, HasVisibility { interface BusyViewImplUiBinder extends UiBinder<HTMLPanel, BusyViewImpl> { } @UiField protected Label messageLabel; private static BusyViewImplUiBinder ourUiBinder = GWT.create(BusyViewImplUiBinder.class); @Inject public BusyViewImpl() { initWidget(ourUiBinder.createAndBindUi(this)); } public void setMessage(@Nonnull String message) { messageLabel.setText(checkNotNull(message)); messageLabel.setVisible(true); } public void clearMessage() { messageLabel.setText(""); messageLabel.setVisible(false); } }
{ "pile_set_name": "Github" }
module.exports = { up: function(migration, DataTypes, done) { migration.addColumn( 'TwitterUsers', 'deactivatedAt', DataTypes.DATE ); done() }, down: function(migration, DataTypes, done) { migration.removeColumn( 'TwitterUsers', 'deactivatedAt'); done() } }
{ "pile_set_name": "Github" }
load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ "admission.go", "config.go", ], importpath = "k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction", visibility = ["//visibility:public"], deps = [ "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apimachinery/announced:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library", "//vendor/k8s.io/apiserver/pkg/admission:go_default_library", "//vendor/k8s.io/kubernetes/pkg/apis/core:go_default_library", "//vendor/k8s.io/kubernetes/pkg/apis/core/helper/qos:go_default_library", "//vendor/k8s.io/kubernetes/pkg/apis/core/v1:go_default_library", "//vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset:go_default_library", "//vendor/k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion:go_default_library", "//vendor/k8s.io/kubernetes/pkg/client/listers/core/internalversion:go_default_library", "//vendor/k8s.io/kubernetes/pkg/kubeapiserver/admission:go_default_library", "//vendor/k8s.io/kubernetes/pkg/kubeapiserver/admission/util:go_default_library", "//vendor/k8s.io/kubernetes/pkg/scheduler/algorithm:go_default_library", "//vendor/k8s.io/kubernetes/pkg/util/tolerations:go_default_library", "//vendor/k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction:go_default_library", "//vendor/k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction/install:go_default_library", "//vendor/k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction/v1alpha1:go_default_library", "//vendor/k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction/validation:go_default_library", ], ) filegroup( name = "package-srcs", srcs = glob(["**"]), tags = ["automanaged"], visibility = ["//visibility:private"], ) filegroup( name = "all-srcs", srcs = [ ":package-srcs", "//vendor/k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], )
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app />
{ "pile_set_name": "Github" }
import "fmt" import "h2g2.mcl" import "mod1/" # imports as example1 import "git://github.com/purpleidea/mgmt-example1/" import "git://github.com/purpleidea/mgmt-example2/" $answer = $h2g2.answer test "hello" { anotherstr => fmt.printf("the answer is: %d", $answer), } test "hello2" { anotherstr => fmt.printf("i imported local: %s", $mod1.name), } test "hello3" { anotherstr => fmt.printf("i imported remote: %s and %s", $example1.name, $example2.ex1), }
{ "pile_set_name": "Github" }
/* while.c */ #include <testfwk.h> char c1 = 0, c2 = 1; void testEmptyWhile(void) { /* loops forever if bug ist present */ do {} while (c1 && c2); /* other cases: */ do {} while ( c1 && c1); do {} while ( c1 && !c2); do {} while (!c1 && !c2); do {} while ( c2 && c1); do {} while (!c2 && c1); do {} while (!c2 && !c1); do {} while (!c2 && !c2); do {} while ( c1 || c1); do {} while ( c1 || !c2); do {} while (!c2 || c1); do {} while (!c2 || !c2); ASSERT(1); }
{ "pile_set_name": "Github" }
#!/bin/bash if grep -q -Ew "(drbl-live-debug|ocs-debug|ocs-live-debug)" /proc/cmdline; then /bin/bash fi
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 93acd980342222e4a99a3bb483f4332c timeCreated: 1469677997 licenseType: Pro NativeFormatImporter: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
CONFIG_HW_COMPATIBILITY=y # CONFIG_MTD is not set CONFIG_LUAPKG="lua5.2" CONFIG_EXTRA_CFLAGS="-g" CONFIG_BOOTLOADER_NONE=y CONFIG_HASH_VERIFY=y CONFIG_ENCRYPTED_IMAGES=y CONFIG_WEBSERVER=y CONFIG_MONGOOSESSL=y CONFIG_LUAEXTERNAL=y CONFIG_RAW=y CONFIG_LUASCRIPTHANDLER=y CONFIG_SHELLSCRIPTHANDLER=y CONFIG_HANDLER_IN_LUA=y CONFIG_ARCHIVE=y CONFIG_REMOTE_HANDLER=y
{ "pile_set_name": "Github" }
package dao; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.OnConflictStrategy; import android.arch.persistence.room.Query; import android.arch.persistence.room.TypeConverters; import java.util.List; import io.github.project_travel_mate.roompersistence.BooleanConverter; import objects.ChecklistItem; /** * Created by Santosh on 05/09/18. */ @Dao @TypeConverters({BooleanConverter.class}) public interface WidgetCheckListDao { @Insert void insert(ChecklistItem... checkItem); @Insert(onConflict = OnConflictStrategy.REPLACE) // or OnConflictStrategy.IGNORE void insertAll(List<ChecklistItem> checkItem); @Query("UPDATE events_new SET name = :name WHERE id IS :id") void updateName(String name, int id); @Query("UPDATE events_new SET isDone = :done WHERE id IS :id") void updateIsDone(int id, boolean done); @Delete void delete(ChecklistItem... checkItem); @Query("Select * FROM events_new") ChecklistItem[] loadAll(); @Query("DELETE FROM events_new") void deleteAll(); }
{ "pile_set_name": "Github" }
using NHapi.Base.Parser; using NHapi.Base; using NHapi.Base.Log; using System; using System.Collections.Generic; using NHapi.Model.V27.Segment; using NHapi.Model.V27.Datatype; using NHapi.Base.Model; namespace NHapi.Model.V27.Group { ///<summary> ///Represents the MFN_M15_MF_INV_ITEM Group. A Group is an ordered collection of message /// segments that can repeat together or be optionally in/excluded together. /// This Group contains the following elements: ///<ol> ///<li>0: MFE (Master File Entry) </li> ///<li>1: IIM (Inventory Item Master) </li> ///</ol> ///</summary> [Serializable] public class MFN_M15_MF_INV_ITEM : AbstractGroup { ///<summary> /// Creates a new MFN_M15_MF_INV_ITEM Group. ///</summary> public MFN_M15_MF_INV_ITEM(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(MFE), true, false); this.add(typeof(IIM), true, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating MFN_M15_MF_INV_ITEM - this is probably a bug in the source code generator.", e); } } ///<summary> /// Returns MFE (Master File Entry) - creates it if necessary ///</summary> public MFE MFE { get{ MFE ret = null; try { ret = (MFE)this.GetStructure("MFE"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error ocurred",e); } return ret; } } ///<summary> /// Returns IIM (Inventory Item Master) - creates it if necessary ///</summary> public IIM IIM { get{ IIM ret = null; try { ret = (IIM)this.GetStructure("IIM"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error ocurred",e); } return ret; } } } }
{ "pile_set_name": "Github" }
|4+0&#ffffff0|2| @72 |4|3| @72 |4@1| @72 |4|5| @72 |4|6| @72 |4|7| @72 |4|8| @72 >4|9| @72 |~+0#4040ff13&| @73 |!+2#ffffff16#00e0003|/|b|i|n|/|s|h| |[|T|e|r|m|i|n|a|l|]| @55 | +0#0000000#ffffff0@74 |~+0#4040ff13&| @73 |~| @73 |~| @73 |~| @73 |~| @73 |~| @73 |~| @73 |[+1#0000000&|N|o| |N|a|m|e|]| @65 | +0&&@74
{ "pile_set_name": "Github" }
.artwork-metadata-stub include ./templates/didactics include ./templates/contact
{ "pile_set_name": "Github" }
// Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // *Preprocessed* version of the main "plus.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { template< typename Tag1 , typename Tag2 > struct plus_impl : if_c< ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) ) , aux::cast2nd_impl< plus_impl< Tag1,Tag1 >,Tag1, Tag2 > , aux::cast1st_impl< plus_impl< Tag2,Tag2 >,Tag1, Tag2 > >::type { }; /// for Digital Mars C++/compilers with no CTPS/TTP support template<> struct plus_impl< na,na > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename Tag > struct plus_impl< na,Tag > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename Tag > struct plus_impl< Tag,na > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename T > struct plus_tag { typedef typename T::tag type; }; template< typename BOOST_MPL_AUX_NA_PARAM(N1) , typename BOOST_MPL_AUX_NA_PARAM(N2) , typename N3 = na, typename N4 = na, typename N5 = na > struct plus : plus< plus< plus< plus< N1,N2 >, N3>, N4>, N5> { BOOST_MPL_AUX_LAMBDA_SUPPORT( 5 , plus , ( N1, N2, N3, N4, N5 ) ) }; template< typename N1, typename N2, typename N3, typename N4 > struct plus< N1,N2,N3,N4,na > : plus< plus< plus< N1,N2 >, N3>, N4> { BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( 5 , plus , ( N1, N2, N3, N4, na ) ) }; template< typename N1, typename N2, typename N3 > struct plus< N1,N2,N3,na,na > : plus< plus< N1,N2 >, N3> { BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( 5 , plus , ( N1, N2, N3, na, na ) ) }; template< typename N1, typename N2 > struct plus< N1,N2,na,na,na > : plus_impl< typename plus_tag<N1>::type , typename plus_tag<N2>::type >::template apply< N1,N2 >::type { BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( 5 , plus , ( N1, N2, na, na, na ) ) }; BOOST_MPL_AUX_NA_SPEC2(2, 5, plus) }} namespace boost { namespace mpl { template<> struct plus_impl< integral_c_tag,integral_c_tag > { template< typename N1, typename N2 > struct apply : integral_c< typename aux::largest_int< typename N1::value_type , typename N2::value_type >::type , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > { }; }; }}
{ "pile_set_name": "Github" }
package me.xiaobailong24.mvvmarms.weather.app.utils; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.annotation.IdRes; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.View; import java.util.ArrayList; import java.util.Collections; import java.util.List; import timber.log.Timber; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 2017/01/17 * desc : Fragment相关工具类 * </pre> */ public final class FragmentUtils { private FragmentUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } private static final int TYPE_ADD_FRAGMENT = 0x01; private static final int TYPE_REMOVE_FRAGMENT = 0x01 << 1; private static final int TYPE_REMOVE_TO_FRAGMENT = 0x01 << 2; private static final int TYPE_REPLACE_FRAGMENT = 0x01 << 3; private static final int TYPE_POP_ADD_FRAGMENT = 0x01 << 4; private static final int TYPE_HIDE_FRAGMENT = 0x01 << 5; private static final int TYPE_SHOW_FRAGMENT = 0x01 << 6; private static final int TYPE_HIDE_SHOW_FRAGMENT = 0x01 << 7; private static final String ARGS_ID = "args_id"; private static final String ARGS_IS_HIDE = "args_is_hide"; private static final String ARGS_IS_ADD_STACK = "args_is_add_stack"; /** * 新增fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @return fragment */ public static Fragment addFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId) { return addFragment(fragmentManager, fragment, containerId, false); } /** * 新增fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @param isHide 是否隐藏 * @return fragment */ public static Fragment addFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId, boolean isHide) { return addFragment(fragmentManager, fragment, containerId, isHide, false); } /** * 新增fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @param isHide 是否隐藏 * @param isAddStack 是否入回退栈 * @return fragment */ public static Fragment addFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId, boolean isHide, boolean isAddStack) { putArgs(fragment, new Args(containerId, isHide, isAddStack)); return operateFragment(fragmentManager, null, fragment, TYPE_ADD_FRAGMENT); } /** * 新增fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @param isHide 是否隐藏 * @param isAddStack 是否入回退栈 * @return fragment */ public static Fragment addFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId, boolean isHide, boolean isAddStack, SharedElement... sharedElement) { putArgs(fragment, new Args(containerId, isHide, isAddStack)); return operateFragment(fragmentManager, null, fragment, TYPE_ADD_FRAGMENT, sharedElement); } /** * 先隐藏后新增fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param hideFragment 要隐藏的fragment * @param addFragment 新增的fragment * @param isHide 是否隐藏 * @param isAddStack 是否入回退栈 * @return fragment */ public static Fragment hideAddFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment hideFragment, @NonNull Fragment addFragment, @IdRes int containerId, boolean isHide, boolean isAddStack, SharedElement... sharedElement) { putArgs(addFragment, new Args(containerId, isHide, isAddStack)); return operateFragment(fragmentManager, hideFragment, addFragment, TYPE_ADD_FRAGMENT, sharedElement); } /** * 新增多个fragment * * @param fragmentManager fragment管理器 * @param fragments fragments * @param containerId 布局Id * @param showIndex 要显示的fragment索引 * @return 要显示的fragment */ public static Fragment addFragments(@NonNull FragmentManager fragmentManager, @NonNull List<Fragment> fragments, @IdRes int containerId, int showIndex) { for (int i = 0, size = fragments.size(); i < size; ++i) { Fragment fragment = fragments.get(i); if (fragment != null) { addFragment(fragmentManager, fragment, containerId, showIndex != i, false); } } return fragments.get(showIndex); } /** * 新增多个fragment * * @param fragmentManager fragment管理器 * @param fragments fragments * @param containerId 布局Id * @param showIndex 要显示的fragment索引 * @param lists 共享元素链表 * @return 要显示的fragment */ public static Fragment addFragments(@NonNull FragmentManager fragmentManager, @NonNull List<Fragment> fragments, @IdRes int containerId, int showIndex, @NonNull List<SharedElement>... lists) { for (int i = 0, size = fragments.size(); i < size; ++i) { Fragment fragment = fragments.get(i); List<SharedElement> list = lists[i]; if (fragment != null) { if (list != null) { putArgs(fragment, new Args(containerId, showIndex != i, false)); return operateFragment(fragmentManager, null, fragment, TYPE_ADD_FRAGMENT, list.toArray(new SharedElement[0])); } } } return fragments.get(showIndex); } /** * 移除fragment * * @param fragment fragment */ public static void removeFragment(@NonNull Fragment fragment) { operateFragment(fragment.getFragmentManager(), null, fragment, TYPE_REMOVE_FRAGMENT); } /** * 移除到指定fragment * * @param fragment fragment * @param isIncludeSelf 是否包括Fragment类自己 */ public static void removeToFragment(@NonNull Fragment fragment, boolean isIncludeSelf) { operateFragment(fragment.getFragmentManager(), isIncludeSelf ? fragment : null, fragment, TYPE_REMOVE_TO_FRAGMENT); } /** * 移除同级别fragment */ public static void removeFragments(@NonNull FragmentManager fragmentManager) { List<Fragment> fragments = getFragments(fragmentManager); if (fragments.isEmpty()) { { return; } } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { { removeFragment(fragment); } } } } /** * 移除所有fragment */ public static void removeAllFragments(@NonNull FragmentManager fragmentManager) { List<Fragment> fragments = getFragments(fragmentManager); if (fragments.isEmpty()) { return; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { removeAllFragments(fragment.getChildFragmentManager()); removeFragment(fragment); } } } /** * 替换fragment * * @param srcFragment 源fragment * @param destFragment 目标fragment * @param isAddStack 是否入回退栈 * @return 目标fragment */ public static Fragment replaceFragment(@NonNull Fragment srcFragment, @NonNull Fragment destFragment, boolean isAddStack) { if (srcFragment.getArguments() == null) { return null; } int containerId = srcFragment.getArguments().getInt(ARGS_ID); if (containerId == 0) { return null; } return replaceFragment(srcFragment.getFragmentManager(), destFragment, containerId, isAddStack); } /** * 替换fragment * * @param srcFragment 源fragment * @param destFragment 目标fragment * @param isAddStack 是否入回退栈 * @param sharedElement 共享元素 * @return 目标fragment */ public static Fragment replaceFragment(@NonNull Fragment srcFragment, @NonNull Fragment destFragment, boolean isAddStack, SharedElement... sharedElement) { if (srcFragment.getArguments() == null) { return null; } int containerId = srcFragment.getArguments().getInt(ARGS_ID); if (containerId == 0) { return null; } return replaceFragment(srcFragment.getFragmentManager(), destFragment, containerId, isAddStack, sharedElement); } /** * 替换fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @param isAddStack 是否入回退栈 * @return fragment */ public static Fragment replaceFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId, boolean isAddStack) { putArgs(fragment, new Args(containerId, false, isAddStack)); return operateFragment(fragmentManager, null, fragment, TYPE_REPLACE_FRAGMENT); } /** * 替换fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @param isAddStack 是否入回退栈 * @param sharedElement 共享元素 * @return fragment */ public static Fragment replaceFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId, boolean isAddStack, SharedElement... sharedElement) { putArgs(fragment, new Args(containerId, false, isAddStack)); return operateFragment(fragmentManager, null, fragment, TYPE_REPLACE_FRAGMENT, sharedElement); } /** * 出栈fragment * * @param fragmentManager fragment管理器 * @return {@code true}: 出栈成功<br>{@code false}: 出栈失败 */ public static boolean popFragment(@NonNull FragmentManager fragmentManager) { return fragmentManager.popBackStackImmediate(); } /** * 出栈到指定fragment * * @param fragmentManager fragment管理器 * @param fragmentClass Fragment类 * @param isIncludeSelf 是否包括Fragment类自己 * @return {@code true}: 出栈成功<br>{@code false}: 出栈失败 */ public static boolean popToFragment(@NonNull FragmentManager fragmentManager, Class<? extends Fragment> fragmentClass, boolean isIncludeSelf) { return fragmentManager.popBackStackImmediate(fragmentClass.getSimpleName(), isIncludeSelf ? FragmentManager.POP_BACK_STACK_INCLUSIVE : 0); } /** * 出栈同级别fragment * * @param fragmentManager fragment管理器 */ public static void popFragments(@NonNull FragmentManager fragmentManager) { while (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStackImmediate(); } } /** * 出栈所有fragment * * @param fragmentManager fragment管理器 */ public static void popAllFragments(@NonNull FragmentManager fragmentManager) { List<Fragment> fragments = getFragments(fragmentManager); if (fragments.isEmpty()) { return; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { popAllFragments(fragment.getChildFragmentManager()); } } while (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStackImmediate(); } } /** * 先出栈后新增fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @param isAddStack 是否入回退栈 * @return fragment */ public static Fragment popAddFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId, boolean isAddStack) { putArgs(fragment, new Args(containerId, false, isAddStack)); return operateFragment(fragmentManager, null, fragment, TYPE_POP_ADD_FRAGMENT); } /** * 先出栈后新增fragment * * @param fragmentManager fragment管理器 * @param containerId 布局Id * @param fragment fragment * @param isAddStack 是否入回退栈 * @return fragment */ public static Fragment popAddFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @IdRes int containerId, boolean isAddStack, SharedElement... sharedElements) { putArgs(fragment, new Args(containerId, false, isAddStack)); return operateFragment(fragmentManager, null, fragment, TYPE_POP_ADD_FRAGMENT, sharedElements); } /** * 隐藏fragment * * @param fragment fragment * @return 隐藏的Fragment */ public static Fragment hideFragment(@NonNull Fragment fragment) { Args args = getArgs(fragment); if (args != null) { putArgs(fragment, new Args(args.id, true, args.isAddStack)); } return operateFragment(fragment.getFragmentManager(), null, fragment, TYPE_HIDE_FRAGMENT); } /** * 隐藏同级别fragment * * @param fragmentManager fragment管理器 */ public static void hideFragments(@NonNull FragmentManager fragmentManager) { List<Fragment> fragments = getFragments(fragmentManager); if (fragments.isEmpty()) { return; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { hideFragment(fragment); } } } /** * 显示fragment * * @param fragment fragment * @return show的Fragment */ public static Fragment showFragment(@NonNull Fragment fragment) { Args args = getArgs(fragment); if (args != null) { putArgs(fragment, new Args(args.id, false, args.isAddStack)); } return operateFragment(fragment.getFragmentManager(), null, fragment, TYPE_SHOW_FRAGMENT); } /** * 显示fragment * * @param fragment fragment * @return show的Fragment */ public static Fragment hideAllShowFragment(@NonNull Fragment fragment) { hideFragments(fragment.getFragmentManager()); return operateFragment(fragment.getFragmentManager(), null, fragment, TYPE_SHOW_FRAGMENT); } /** * 先隐藏后显示fragment * * @param hideFragment 需要隐藏的Fragment * @param showFragment 需要显示的Fragment * @return 显示的Fragment */ public static Fragment hideShowFragment(@NonNull Fragment hideFragment, @NonNull Fragment showFragment) { Args args = getArgs(hideFragment); if (args != null) { putArgs(hideFragment, new Args(args.id, true, args.isAddStack)); } args = getArgs(showFragment); if (args != null) { putArgs(showFragment, new Args(args.id, false, args.isAddStack)); } return operateFragment(showFragment.getFragmentManager(), hideFragment, showFragment, TYPE_HIDE_SHOW_FRAGMENT); } /** * 传参 * * @param fragment fragment * @param args 参数 */ private static void putArgs(@NonNull Fragment fragment, Args args) { Bundle bundle = fragment.getArguments(); if (bundle == null) { bundle = new Bundle(); fragment.setArguments(bundle); } bundle.putInt(ARGS_ID, args.id); bundle.putBoolean(ARGS_IS_HIDE, args.isHide); bundle.putBoolean(ARGS_IS_ADD_STACK, args.isAddStack); } /** * 获取参数 * * @param fragment fragment */ private static Args getArgs(@NonNull Fragment fragment) { Bundle bundle = fragment.getArguments(); if (bundle == null || bundle.getInt(ARGS_ID) == 0) { return null; } return new Args(bundle.getInt(ARGS_ID), bundle.getBoolean(ARGS_IS_HIDE), bundle.getBoolean(ARGS_IS_ADD_STACK)); } /** * 操作fragment * * @param fragmentManager fragment管理器 * @param srcFragment 源fragment * @param destFragment 目标fragment * @param type 操作类型 * @param sharedElements 共享元素 * @return destFragment */ private static Fragment operateFragment(@NonNull FragmentManager fragmentManager, Fragment srcFragment, @NonNull Fragment destFragment, int type, SharedElement... sharedElements) { if (srcFragment == destFragment) { return null; } if (srcFragment != null && srcFragment.isRemoving()) { Timber.e(srcFragment.getClass().getSimpleName() + " is isRemoving"); return null; } String name = destFragment.getClass().getSimpleName(); Bundle args = destFragment.getArguments(); FragmentTransaction ft = fragmentManager.beginTransaction(); if (sharedElements == null || sharedElements.length == 0) { ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); } else { // 添加共享元素动画 for (SharedElement element : sharedElements) { ft.addSharedElement(element.sharedElement, element.name); } } switch (type) { case TYPE_ADD_FRAGMENT: if (srcFragment != null) { ft.hide(srcFragment); } if (destFragment.isAdded()) { break; } ft.add(args.getInt(ARGS_ID), destFragment, name); if (args.getBoolean(ARGS_IS_HIDE)) { ft.hide(destFragment); } if (args.getBoolean(ARGS_IS_ADD_STACK)) { ft.addToBackStack(name); } break; case TYPE_REMOVE_FRAGMENT: ft.remove(destFragment); break; case TYPE_REMOVE_TO_FRAGMENT: List<Fragment> fragments = getFragments(fragmentManager); for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment == destFragment) { if (srcFragment != null) { ft.remove(fragment); } break; } ft.remove(fragment); } break; case TYPE_REPLACE_FRAGMENT: ft.replace(args.getInt(ARGS_ID), destFragment, name); if (args.getBoolean(ARGS_IS_ADD_STACK)) { ft.addToBackStack(name); } break; case TYPE_POP_ADD_FRAGMENT: popFragment(fragmentManager); ft.add(args.getInt(ARGS_ID), destFragment, name); if (args.getBoolean(ARGS_IS_ADD_STACK)) { ft.addToBackStack(name); } break; case TYPE_HIDE_FRAGMENT: ft.hide(destFragment); break; case TYPE_SHOW_FRAGMENT: ft.show(destFragment); break; case TYPE_HIDE_SHOW_FRAGMENT: ft.hide(srcFragment).show(destFragment); break; default: break; } ft.commitAllowingStateLoss(); return destFragment; } /** * 获取同级别最后加入的fragment * * @param fragmentManager fragment管理器 * @return 最后加入的fragment */ public static Fragment getLastAddFragment(@NonNull FragmentManager fragmentManager) { return getLastAddFragmentIsInStack(fragmentManager, false); } /** * 获取栈中同级别最后加入的fragment * * @param fragmentManager fragment管理器 * @return 最后加入的fragment */ public static Fragment getLastAddFragmentInStack(@NonNull FragmentManager fragmentManager) { return getLastAddFragmentIsInStack(fragmentManager, true); } /** * 根据栈参数获取同级别最后加入的fragment * * @param fragmentManager fragment管理器 * @param isInStack 是否是栈中的 * @return 栈中最后加入的fragment */ private static Fragment getLastAddFragmentIsInStack(@NonNull FragmentManager fragmentManager, boolean isInStack) { List<Fragment> fragments = getFragments(fragmentManager); if (fragments.isEmpty()) { return null; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { if (isInStack) { if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) { return fragment; } } else { return fragment; } } } return null; } /** * 获取顶层可见fragment * * @param fragmentManager fragment管理器 * @return 顶层可见fragment */ public static Fragment getTopShowFragment(@NonNull FragmentManager fragmentManager) { return getTopShowFragmentIsInStack(fragmentManager, null, false); } /** * 获取栈中顶层可见fragment * * @param fragmentManager fragment管理器 * @return 栈中顶层可见fragment */ public static Fragment getTopShowFragmentInStack(@NonNull FragmentManager fragmentManager) { return getTopShowFragmentIsInStack(fragmentManager, null, true); } /** * 根据栈参数获取顶层可见fragment * * @param fragmentManager fragment管理器 * @param parentFragment 父fragment * @param isInStack 是否是栈中的 * @return 栈中顶层可见fragment */ private static Fragment getTopShowFragmentIsInStack(@NonNull FragmentManager fragmentManager, Fragment parentFragment, boolean isInStack) { List<Fragment> fragments = getFragments(fragmentManager); if (fragments.isEmpty()) { return parentFragment; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null && fragment.isResumed() && fragment.isVisible() && fragment.getUserVisibleHint()) { if (isInStack) { if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) { return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, true); } } else { return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, false); } } } return parentFragment; } /** * 获取同级别fragment * * @param fragmentManager fragment管理器 * @return 同级别的fragments */ public static List<Fragment> getFragments(@NonNull FragmentManager fragmentManager) { return getFragmentsIsInStack(fragmentManager, false); } /** * 获取栈中同级别fragment * * @param fragmentManager fragment管理器 * @return 栈中同级别fragment */ public static List<Fragment> getFragmentsInStack(@NonNull FragmentManager fragmentManager) { return getFragmentsIsInStack(fragmentManager, true); } /** * 根据栈参数获取同级别fragment * * @param fragmentManager fragment管理器 * @param isInStack 是否是栈中的 * @return 栈中同级别fragment */ private static List<Fragment> getFragmentsIsInStack(@NonNull FragmentManager fragmentManager, boolean isInStack) { List<Fragment> fragments = fragmentManager.getFragments(); if (fragments == null || fragments.isEmpty()) { return Collections.emptyList(); } List<Fragment> result = new ArrayList<>(); for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { if (isInStack) { if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) { result.add(fragment); } } else { result.add(fragment); } } } return result; } /** * 获取所有fragment * * @param fragmentManager fragment管理器 * @return 所有fragment */ public static List<FragmentNode> getAllFragments(@NonNull FragmentManager fragmentManager) { return getAllFragmentsIsInStack(fragmentManager, new ArrayList<FragmentNode>(), false); } /** * 获取栈中所有fragment * * @param fragmentManager fragment管理器 * @return 所有fragment */ public static List<FragmentNode> getAllFragmentsInStack(@NonNull FragmentManager fragmentManager) { return getAllFragmentsIsInStack(fragmentManager, new ArrayList<FragmentNode>(), true); } /** * 根据栈参数获取所有fragment * <p>需之前对fragment的操作都借助该工具类</p> * * @param fragmentManager fragment管理器 * @param result 结果 * @param isInStack 是否是栈中的 * @return 栈中所有fragment */ private static List<FragmentNode> getAllFragmentsIsInStack(@NonNull FragmentManager fragmentManager, List<FragmentNode> result, boolean isInStack) { List<Fragment> fragments = fragmentManager.getFragments(); if (fragments == null || fragments.isEmpty()) { return Collections.emptyList(); } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { if (isInStack) { if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) { result.add(new FragmentNode(fragment, getAllFragmentsIsInStack(fragment.getChildFragmentManager(), new ArrayList<FragmentNode>(), true))); } } else { result.add(new FragmentNode(fragment, getAllFragmentsIsInStack(fragment.getChildFragmentManager(), new ArrayList<FragmentNode>(), false))); } } } return result; } /** * 获取目标fragment的前一个fragment * * @param destFragment 目标fragment * @return 目标fragment的前一个fragment */ public static Fragment getPreFragment(@NonNull Fragment destFragment) { FragmentManager fragmentManager = destFragment.getFragmentManager(); if (fragmentManager == null) { return null; } List<Fragment> fragments = getFragments(fragmentManager); boolean flag = false; for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (flag && fragment != null) { return fragment; } if (fragment == destFragment) { flag = true; } } return null; } /** * 查找fragment * * @param fragmentManager fragment管理器 * @param fragmentClass fragment类 * @return 查找到的fragment */ public static Fragment findFragment(@NonNull FragmentManager fragmentManager, Class<? extends Fragment> fragmentClass) { List<Fragment> fragments = getFragments(fragmentManager); if (fragments.isEmpty()) { return null; } return fragmentManager.findFragmentByTag(fragmentClass.getSimpleName()); } /** * 处理fragment回退键 * <p>如果fragment实现了OnBackClickListener接口,返回{@code true}: 表示已消费回退键事件,反之则没消费</p> * <p>具体示例见FragmentActivity</p> * * @param fragment fragment * @return 是否消费回退事件 */ public static boolean dispatchBackPress(@NonNull Fragment fragment) { return dispatchBackPress(fragment.getFragmentManager()); } /** * 处理fragment回退键 * <p>如果fragment实现了OnBackClickListener接口,返回{@code true}: 表示已消费回退键事件,反之则没消费</p> * <p>具体示例见FragmentActivity</p> * * @param fragmentManager fragment管理器 * @return 是否消费回退事件 */ public static boolean dispatchBackPress(@NonNull FragmentManager fragmentManager) { List<Fragment> fragments = fragmentManager.getFragments(); if (fragments == null || fragments.isEmpty()) { return false; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null && fragment.isResumed() && fragment.isVisible() && fragment.getUserVisibleHint() && fragment instanceof OnBackClickListener && ((OnBackClickListener) fragment).onBackClick()) { return true; } } return false; } /** * 设置背景色 * * @param fragment fragment * @param color 背景色 */ public static void setBackgroundColor(@NonNull Fragment fragment, @ColorInt int color) { View view = fragment.getView(); if (view != null) { view.setBackgroundColor(color); } } /** * 设置背景资源 * * @param fragment fragment * @param resId 资源Id */ public static void setBackgroundResource(@NonNull Fragment fragment, @DrawableRes int resId) { View view = fragment.getView(); if (view != null) { view.setBackgroundResource(resId); } } /** * 设置背景 * * @param fragment fragment * @param background 背景 */ public static void setBackground(@NonNull Fragment fragment, Drawable background) { View view = fragment.getView(); if (view != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(background); } else { view.setBackgroundDrawable(background); } } } static class Args { int id; boolean isHide; boolean isAddStack; Args(int id, boolean isHide, boolean isAddStack) { this.id = id; this.isHide = isHide; this.isAddStack = isAddStack; } } public static class SharedElement { View sharedElement; String name; public SharedElement(View sharedElement, String name) { this.sharedElement = sharedElement; this.name = name; } } static class FragmentNode { Fragment fragment; List<FragmentNode> next; public FragmentNode(Fragment fragment, List<FragmentNode> next) { this.fragment = fragment; this.next = next; } @Override public String toString() { return fragment.getClass().getSimpleName() + "->" + ((next == null || next.isEmpty()) ? "no child" : next.toString()); } } public interface OnBackClickListener { boolean onBackClick(); } }
{ "pile_set_name": "Github" }
package unit.issues; class Issue7032 extends unit.Test { function test() { eq(10, def(null)); } static function def(p) { return def2(p); } static inline function def2(?p = 10) { return p; } }
{ "pile_set_name": "Github" }
--- name: Feature request about: Suggest an idea for this project title: '' labels: 'Type: Enhancement' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here.
{ "pile_set_name": "Github" }
{ "compilers": { "less": { "autoPrefix": "", "cssComb": "none", "ieCompat": true, "strictMath": false, "strictUnits": false, "relativeUrls": true, "rootPath": "", "sourceMapRoot": "", "sourceMapBasePath": "", "sourceMap": false }, "sass": { "includePath": "", "indentType": "space", "indentWidth": 2, "outputStyle": "nested", "Precision": 5, "relativeUrls": true, "sourceMapRoot": "", "sourceMap": false }, "stylus": { "sourceMap": false }, "babel": { "sourceMap": false }, "coffeescript": { "bare": false, "runtimeMode": "node", "sourceMap": false } }, "minifiers": { "css": { "enabled": true, "termSemicolons": true, "gzip": false }, "javascript": { "enabled": true, "termSemicolons": true, "gzip": false } } }
{ "pile_set_name": "Github" }
#import <Foundation/Foundation.h> @interface PodsDummy_Pods_MVVMPlayground : NSObject @end @implementation PodsDummy_Pods_MVVMPlayground @end
{ "pile_set_name": "Github" }
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.content; import android.database.ContentObserver; import android.database.Cursor; import android.os.Handler; import java.util.HashMap; import java.util.Map; import java.util.Observable; /** * Caches the contents of a cursor into a Map of String->ContentValues and optionally * keeps the cache fresh by registering for updates on the content backing the cursor. The column of * the database that is to be used as the key of the map is user-configurable, and the * ContentValues contains all columns other than the one that is designated the key. * <p> * The cursor data is accessed by row key and column name via getValue(). */ public class ContentQueryMap extends Observable { private volatile Cursor mCursor; private String[] mColumnNames; private int mKeyColumn; private Handler mHandlerForUpdateNotifications = null; private boolean mKeepUpdated = false; private Map<String, ContentValues> mValues = null; private ContentObserver mContentObserver; /** Set when a cursor change notification is received and is cleared on a call to requery(). */ private boolean mDirty = false; /** * Creates a ContentQueryMap that caches the content backing the cursor * * @param cursor the cursor whose contents should be cached * @param columnNameOfKey the column that is to be used as the key of the values map * @param keepUpdated true if the cursor's ContentProvider should be monitored for changes and * the map updated when changes do occur * @param handlerForUpdateNotifications the Handler that should be used to receive * notifications of changes (if requested). Normally you pass null here, but if * you know that the thread that is creating this isn't a thread that can receive * messages then you can create your own handler and use that here. */ public ContentQueryMap(Cursor cursor, String columnNameOfKey, boolean keepUpdated, Handler handlerForUpdateNotifications) { mCursor = cursor; mColumnNames = mCursor.getColumnNames(); mKeyColumn = mCursor.getColumnIndexOrThrow(columnNameOfKey); mHandlerForUpdateNotifications = handlerForUpdateNotifications; setKeepUpdated(keepUpdated); // If we aren't keeping the cache updated with the current state of the cursor's // ContentProvider then read it once into the cache. Otherwise the cache will be filled // automatically. if (!keepUpdated) { readCursorIntoCache(cursor); } } /** * Change whether or not the ContentQueryMap will register with the cursor's ContentProvider * for change notifications. If you use a ContentQueryMap in an activity you should call this * with false in onPause(), which means you need to call it with true in onResume() * if want it to be kept updated. * @param keepUpdated if true the ContentQueryMap should be registered with the cursor's * ContentProvider, false otherwise */ public void setKeepUpdated(boolean keepUpdated) { if (keepUpdated == mKeepUpdated) return; mKeepUpdated = keepUpdated; if (!mKeepUpdated) { mCursor.unregisterContentObserver(mContentObserver); mContentObserver = null; } else { if (mHandlerForUpdateNotifications == null) { mHandlerForUpdateNotifications = new Handler(); } if (mContentObserver == null) { mContentObserver = new ContentObserver(mHandlerForUpdateNotifications) { @Override public void onChange(boolean selfChange) { // If anyone is listening, we need to do this now to broadcast // to the observers. Otherwise, we'll just set mDirty and // let it query lazily when they ask for the values. if (countObservers() != 0) { requery(); } else { mDirty = true; } } }; } mCursor.registerContentObserver(mContentObserver); // mark dirty, since it is possible the cursor's backing data had changed before we // registered for changes mDirty = true; } } /** * Access the ContentValues for the row specified by rowName * @param rowName which row to read * @return the ContentValues for the row, or null if the row wasn't present in the cursor */ public synchronized ContentValues getValues(String rowName) { if (mDirty) requery(); return mValues.get(rowName); } /** Requeries the cursor and reads the contents into the cache */ public void requery() { final Cursor cursor = mCursor; if (cursor == null) { // If mCursor is null then it means there was a requery() in flight // while another thread called close(), which nulls out mCursor. // If this happens ignore the requery() since we are closed anyways. return; } mDirty = false; if (!cursor.requery()) { // again, don't do anything if the cursor is already closed return; } readCursorIntoCache(cursor); setChanged(); notifyObservers(); } private synchronized void readCursorIntoCache(Cursor cursor) { // Make a new map so old values returned by getRows() are undisturbed. int capacity = mValues != null ? mValues.size() : 0; mValues = new HashMap<String, ContentValues>(capacity); while (cursor.moveToNext()) { ContentValues values = new ContentValues(); for (int i = 0; i < mColumnNames.length; i++) { if (i != mKeyColumn) { values.put(mColumnNames[i], cursor.getString(i)); } } mValues.put(cursor.getString(mKeyColumn), values); } } public synchronized Map<String, ContentValues> getRows() { if (mDirty) requery(); return mValues; } public synchronized void close() { if (mContentObserver != null) { mCursor.unregisterContentObserver(mContentObserver); mContentObserver = null; } mCursor.close(); mCursor = null; } @Override protected void finalize() throws Throwable { if (mCursor != null) close(); super.finalize(); } }
{ "pile_set_name": "Github" }
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.ioteventsdata.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.ioteventsdata.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * DetectorStateDefinition JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DetectorStateDefinitionJsonUnmarshaller implements Unmarshaller<DetectorStateDefinition, JsonUnmarshallerContext> { public DetectorStateDefinition unmarshall(JsonUnmarshallerContext context) throws Exception { DetectorStateDefinition detectorStateDefinition = new DetectorStateDefinition(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("stateName", targetDepth)) { context.nextToken(); detectorStateDefinition.setStateName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("variables", targetDepth)) { context.nextToken(); detectorStateDefinition.setVariables(new ListUnmarshaller<VariableDefinition>(VariableDefinitionJsonUnmarshaller.getInstance()) .unmarshall(context)); } if (context.testExpression("timers", targetDepth)) { context.nextToken(); detectorStateDefinition.setTimers(new ListUnmarshaller<TimerDefinition>(TimerDefinitionJsonUnmarshaller.getInstance()) .unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return detectorStateDefinition; } private static DetectorStateDefinitionJsonUnmarshaller instance; public static DetectorStateDefinitionJsonUnmarshaller getInstance() { if (instance == null) instance = new DetectorStateDefinitionJsonUnmarshaller(); return instance; } }
{ "pile_set_name": "Github" }
// the Neovius surface: https://en.wikipedia.org/wiki/Neovius_surface let neovius = make_shape { dist[x,y,z,_] = -(3*(cos x+cos y+cos z) + 4*cos x*cos y*cos z); is_3d = true; }; in neovius >> shell .2 >> lipschitz 10 `intersection` cube 20
{ "pile_set_name": "Github" }
// src/script/scala-2/progscala3/rounding/DoWhileAlternative.scala var count = 0 // The old do/while construct was removed in Scala 3 // do { // count += 1 // println(count) // } while (count < 10) // Using the Scala-2 like syntax, you have to write it as follows: while ({ count += 1 println(count) count < 10 }) () assert(count == 10)
{ "pile_set_name": "Github" }
export default Ember.ObjectController.extend({ actions: { saveSettings: function () { var controller = this; controller.get('model').save().then(function () { controller.send('notify', 'success', 'Settings saved!'); controller.send('buildSignal'); }); } } });
{ "pile_set_name": "Github" }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ // // This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.42000. // #pragma warning disable 1591 namespace Socioboard.Api.Affiliates { using System; using System.Web.Services; using System.Diagnostics; using System.Web.Services.Protocols; using System.Xml.Serialization; using System.ComponentModel; /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="AffiliatesSoap", Namespace="http://tempuri.org/")] public partial class Affiliates : System.Web.Services.Protocols.SoapHttpClientProtocol { private System.Threading.SendOrPostCallback AddAffiliateDetailOperationCompleted; private System.Threading.SendOrPostCallback GetAffilieteDetailbyUserIdOperationCompleted; private System.Threading.SendOrPostCallback GetAffilieteDetailbyUserIdTransOperationCompleted; private System.Threading.SendOrPostCallback AddRequestToWithdrawOperationCompleted; private System.Threading.SendOrPostCallback GetEwalletWithdrawOperationCompleted; private System.Threading.SendOrPostCallback GetAllEwalletWithdrawOperationCompleted; private System.Threading.SendOrPostCallback UpdatePaymentStatusOperationCompleted; private bool useDefaultCredentialsSetExplicitly; /// <remarks/> public Affiliates() { this.Url = global::Socioboard.Properties.Settings.Default.Socioboard_Api_Affiliates_Affiliates; if ((this.IsLocalFileSystemWebService(this.Url) == true)) { this.UseDefaultCredentials = true; this.useDefaultCredentialsSetExplicitly = false; } else { this.useDefaultCredentialsSetExplicitly = true; } } public new string Url { get { return base.Url; } set { if ((((this.IsLocalFileSystemWebService(base.Url) == true) && (this.useDefaultCredentialsSetExplicitly == false)) && (this.IsLocalFileSystemWebService(value) == false))) { base.UseDefaultCredentials = false; } base.Url = value; } } public new bool UseDefaultCredentials { get { return base.UseDefaultCredentials; } set { base.UseDefaultCredentials = value; this.useDefaultCredentialsSetExplicitly = true; } } /// <remarks/> public event AddAffiliateDetailCompletedEventHandler AddAffiliateDetailCompleted; /// <remarks/> public event GetAffilieteDetailbyUserIdCompletedEventHandler GetAffilieteDetailbyUserIdCompleted; /// <remarks/> public event GetAffilieteDetailbyUserIdTransCompletedEventHandler GetAffilieteDetailbyUserIdTransCompleted; /// <remarks/> public event AddRequestToWithdrawCompletedEventHandler AddRequestToWithdrawCompleted; /// <remarks/> public event GetEwalletWithdrawCompletedEventHandler GetEwalletWithdrawCompleted; /// <remarks/> public event GetAllEwalletWithdrawCompletedEventHandler GetAllEwalletWithdrawCompleted; /// <remarks/> public event UpdatePaymentStatusCompletedEventHandler UpdatePaymentStatusCompleted; /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddAffiliateDetail", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public void AddAffiliateDetail(string UserId, string FriendsUserId, System.DateTime AffiliateDate, string Amount) { this.Invoke("AddAffiliateDetail", new object[] { UserId, FriendsUserId, AffiliateDate, Amount}); } /// <remarks/> public void AddAffiliateDetailAsync(string UserId, string FriendsUserId, System.DateTime AffiliateDate, string Amount) { this.AddAffiliateDetailAsync(UserId, FriendsUserId, AffiliateDate, Amount, null); } /// <remarks/> public void AddAffiliateDetailAsync(string UserId, string FriendsUserId, System.DateTime AffiliateDate, string Amount, object userState) { if ((this.AddAffiliateDetailOperationCompleted == null)) { this.AddAffiliateDetailOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddAffiliateDetailOperationCompleted); } this.InvokeAsync("AddAffiliateDetail", new object[] { UserId, FriendsUserId, AffiliateDate, Amount}, this.AddAffiliateDetailOperationCompleted, userState); } private void OnAddAffiliateDetailOperationCompleted(object arg) { if ((this.AddAffiliateDetailCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.AddAffiliateDetailCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetAffilieteDetailbyUserId", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string GetAffilieteDetailbyUserId(string UserId, string FriendsUserId) { object[] results = this.Invoke("GetAffilieteDetailbyUserId", new object[] { UserId, FriendsUserId}); return ((string)(results[0])); } /// <remarks/> public void GetAffilieteDetailbyUserIdAsync(string UserId, string FriendsUserId) { this.GetAffilieteDetailbyUserIdAsync(UserId, FriendsUserId, null); } /// <remarks/> public void GetAffilieteDetailbyUserIdAsync(string UserId, string FriendsUserId, object userState) { if ((this.GetAffilieteDetailbyUserIdOperationCompleted == null)) { this.GetAffilieteDetailbyUserIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAffilieteDetailbyUserIdOperationCompleted); } this.InvokeAsync("GetAffilieteDetailbyUserId", new object[] { UserId, FriendsUserId}, this.GetAffilieteDetailbyUserIdOperationCompleted, userState); } private void OnGetAffilieteDetailbyUserIdOperationCompleted(object arg) { if ((this.GetAffilieteDetailbyUserIdCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.GetAffilieteDetailbyUserIdCompleted(this, new GetAffilieteDetailbyUserIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetAffilieteDetailbyUserIdTrans", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string GetAffilieteDetailbyUserIdTrans(string UserId) { object[] results = this.Invoke("GetAffilieteDetailbyUserIdTrans", new object[] { UserId}); return ((string)(results[0])); } /// <remarks/> public void GetAffilieteDetailbyUserIdTransAsync(string UserId) { this.GetAffilieteDetailbyUserIdTransAsync(UserId, null); } /// <remarks/> public void GetAffilieteDetailbyUserIdTransAsync(string UserId, object userState) { if ((this.GetAffilieteDetailbyUserIdTransOperationCompleted == null)) { this.GetAffilieteDetailbyUserIdTransOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAffilieteDetailbyUserIdTransOperationCompleted); } this.InvokeAsync("GetAffilieteDetailbyUserIdTrans", new object[] { UserId}, this.GetAffilieteDetailbyUserIdTransOperationCompleted, userState); } private void OnGetAffilieteDetailbyUserIdTransOperationCompleted(object arg) { if ((this.GetAffilieteDetailbyUserIdTransCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.GetAffilieteDetailbyUserIdTransCompleted(this, new GetAffilieteDetailbyUserIdTransCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddRequestToWithdraw", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string AddRequestToWithdraw(string WithdrawAmount, string PaymentMethod, string PaypalEmail, string IbanCode, string SwiftCode, string Other, string UserID) { object[] results = this.Invoke("AddRequestToWithdraw", new object[] { WithdrawAmount, PaymentMethod, PaypalEmail, IbanCode, SwiftCode, Other, UserID}); return ((string)(results[0])); } /// <remarks/> public void AddRequestToWithdrawAsync(string WithdrawAmount, string PaymentMethod, string PaypalEmail, string IbanCode, string SwiftCode, string Other, string UserID) { this.AddRequestToWithdrawAsync(WithdrawAmount, PaymentMethod, PaypalEmail, IbanCode, SwiftCode, Other, UserID, null); } /// <remarks/> public void AddRequestToWithdrawAsync(string WithdrawAmount, string PaymentMethod, string PaypalEmail, string IbanCode, string SwiftCode, string Other, string UserID, object userState) { if ((this.AddRequestToWithdrawOperationCompleted == null)) { this.AddRequestToWithdrawOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRequestToWithdrawOperationCompleted); } this.InvokeAsync("AddRequestToWithdraw", new object[] { WithdrawAmount, PaymentMethod, PaypalEmail, IbanCode, SwiftCode, Other, UserID}, this.AddRequestToWithdrawOperationCompleted, userState); } private void OnAddRequestToWithdrawOperationCompleted(object arg) { if ((this.AddRequestToWithdrawCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.AddRequestToWithdrawCompleted(this, new AddRequestToWithdrawCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetEwalletWithdraw", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string GetEwalletWithdraw(string UserId) { object[] results = this.Invoke("GetEwalletWithdraw", new object[] { UserId}); return ((string)(results[0])); } /// <remarks/> public void GetEwalletWithdrawAsync(string UserId) { this.GetEwalletWithdrawAsync(UserId, null); } /// <remarks/> public void GetEwalletWithdrawAsync(string UserId, object userState) { if ((this.GetEwalletWithdrawOperationCompleted == null)) { this.GetEwalletWithdrawOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetEwalletWithdrawOperationCompleted); } this.InvokeAsync("GetEwalletWithdraw", new object[] { UserId}, this.GetEwalletWithdrawOperationCompleted, userState); } private void OnGetEwalletWithdrawOperationCompleted(object arg) { if ((this.GetEwalletWithdrawCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.GetEwalletWithdrawCompleted(this, new GetEwalletWithdrawCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetAllEwalletWithdraw", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string GetAllEwalletWithdraw() { object[] results = this.Invoke("GetAllEwalletWithdraw", new object[0]); return ((string)(results[0])); } /// <remarks/> public void GetAllEwalletWithdrawAsync() { this.GetAllEwalletWithdrawAsync(null); } /// <remarks/> public void GetAllEwalletWithdrawAsync(object userState) { if ((this.GetAllEwalletWithdrawOperationCompleted == null)) { this.GetAllEwalletWithdrawOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAllEwalletWithdrawOperationCompleted); } this.InvokeAsync("GetAllEwalletWithdraw", new object[0], this.GetAllEwalletWithdrawOperationCompleted, userState); } private void OnGetAllEwalletWithdrawOperationCompleted(object arg) { if ((this.GetAllEwalletWithdrawCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.GetAllEwalletWithdrawCompleted(this, new GetAllEwalletWithdrawCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/UpdatePaymentStatus", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public int UpdatePaymentStatus(string id, int status) { object[] results = this.Invoke("UpdatePaymentStatus", new object[] { id, status}); return ((int)(results[0])); } /// <remarks/> public void UpdatePaymentStatusAsync(string id, int status) { this.UpdatePaymentStatusAsync(id, status, null); } /// <remarks/> public void UpdatePaymentStatusAsync(string id, int status, object userState) { if ((this.UpdatePaymentStatusOperationCompleted == null)) { this.UpdatePaymentStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdatePaymentStatusOperationCompleted); } this.InvokeAsync("UpdatePaymentStatus", new object[] { id, status}, this.UpdatePaymentStatusOperationCompleted, userState); } private void OnUpdatePaymentStatusOperationCompleted(object arg) { if ((this.UpdatePaymentStatusCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.UpdatePaymentStatusCompleted(this, new UpdatePaymentStatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> public new void CancelAsync(object userState) { base.CancelAsync(userState); } private bool IsLocalFileSystemWebService(string url) { if (((url == null) || (url == string.Empty))) { return false; } System.Uri wsUri = new System.Uri(url); if (((wsUri.Port >= 1024) && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) { return true; } return false; } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] public delegate void AddAffiliateDetailCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] public delegate void GetAffilieteDetailbyUserIdCompletedEventHandler(object sender, GetAffilieteDetailbyUserIdCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetAffilieteDetailbyUserIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; internal GetAffilieteDetailbyUserIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } /// <remarks/> public string Result { get { this.RaiseExceptionIfNecessary(); return ((string)(this.results[0])); } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] public delegate void GetAffilieteDetailbyUserIdTransCompletedEventHandler(object sender, GetAffilieteDetailbyUserIdTransCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetAffilieteDetailbyUserIdTransCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; internal GetAffilieteDetailbyUserIdTransCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } /// <remarks/> public string Result { get { this.RaiseExceptionIfNecessary(); return ((string)(this.results[0])); } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] public delegate void AddRequestToWithdrawCompletedEventHandler(object sender, AddRequestToWithdrawCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class AddRequestToWithdrawCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; internal AddRequestToWithdrawCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } /// <remarks/> public string Result { get { this.RaiseExceptionIfNecessary(); return ((string)(this.results[0])); } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] public delegate void GetEwalletWithdrawCompletedEventHandler(object sender, GetEwalletWithdrawCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetEwalletWithdrawCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; internal GetEwalletWithdrawCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } /// <remarks/> public string Result { get { this.RaiseExceptionIfNecessary(); return ((string)(this.results[0])); } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] public delegate void GetAllEwalletWithdrawCompletedEventHandler(object sender, GetAllEwalletWithdrawCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetAllEwalletWithdrawCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; internal GetAllEwalletWithdrawCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } /// <remarks/> public string Result { get { this.RaiseExceptionIfNecessary(); return ((string)(this.results[0])); } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] public delegate void UpdatePaymentStatusCompletedEventHandler(object sender, UpdatePaymentStatusCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1055.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class UpdatePaymentStatusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; internal UpdatePaymentStatusCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } /// <remarks/> public int Result { get { this.RaiseExceptionIfNecessary(); return ((int)(this.results[0])); } } } } #pragma warning restore 1591
{ "pile_set_name": "Github" }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ #define CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ #include <memory> #include <string> #include <vector> #include "base/compiler_specific.h" #include "base/macros.h" #include "build/build_config.h" #include "content/child/child_thread_impl.h" #include "content/common/content_export.h" #include "content/common/process_control.mojom.h" #include "content/public/utility/utility_thread.h" #include "mojo/public/cpp/bindings/binding_set.h" namespace base { class FilePath; } namespace content { class BlinkPlatformImpl; class UtilityBlinkPlatformImpl; class UtilityProcessControlImpl; #if defined(COMPILER_MSVC) // See explanation for other RenderViewHostImpl which is the same issue. #pragma warning(push) #pragma warning(disable: 4250) #endif // This class represents the background thread where the utility task runs. class UtilityThreadImpl : public UtilityThread, public ChildThreadImpl { public: UtilityThreadImpl(); // Constructor that's used when running in single process mode. explicit UtilityThreadImpl(const InProcessChildThreadParams& params); ~UtilityThreadImpl() override; void Shutdown() override; void ReleaseProcessIfNeeded() override; void EnsureBlinkInitialized() override; private: void Init(); // ChildThread implementation. bool OnControlMessageReceived(const IPC::Message& msg) override; // IPC message handlers. void OnBatchModeStarted(); void OnBatchModeFinished(); void BindProcessControlRequest( mojo::InterfaceRequest<content::mojom::ProcessControl> request); // True when we're running in batch mode. bool batch_mode_; std::unique_ptr<UtilityBlinkPlatformImpl> blink_platform_impl_; // Process control for Mojo application hosting. std::unique_ptr<UtilityProcessControlImpl> process_control_; // Bindings to the mojom::ProcessControl impl. mojo::BindingSet<mojom::ProcessControl> process_control_bindings_; DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl); }; #if defined(COMPILER_MSVC) #pragma warning(pop) #endif } // namespace content #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_
{ "pile_set_name": "Github" }
/* w32time interface definitions */ [ uuid("8fb6d884-2388-11d0-8c35-00c04fda2795"), endpoint("ncacn_np:[\\pipe\\srvsvc]","ncacn_np:[\\pipe\\atsvc]","ncacn_np:[\\pipe\\browser]","ncacn_np:[\\pipe\\keysvc]","ncacn_np:[\\pipe\\wkssvc]"), version(4.1), pointer_default(unique), helpstring("Win32 Time Server") ] interface w32time { /*****************/ /* Function 0x00 */ [todo] WERROR w32time_SyncTime(); [todo] WERROR w32time_GetNetLogonServiceBits(); [todo] WERROR w32time_QueryProviderStatus(); }
{ "pile_set_name": "Github" }
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2013-2014. // Modifications copyright (c) 2013-2014, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_LINEAR_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_LINEAR_HPP #include <cstddef> #include <deque> #include <boost/range.hpp> #include <boost/geometry/util/range.hpp> #include <boost/geometry/core/point_type.hpp> #include <boost/geometry/core/tag.hpp> #include <boost/geometry/core/tags.hpp> #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp> #include <boost/geometry/algorithms/detail/overlay/do_reverse.hpp> #include <boost/geometry/policies/disjoint_interrupt_policy.hpp> #include <boost/geometry/policies/robustness/no_rescale_policy.hpp> #include <boost/geometry/policies/robustness/segment_ratio_type.hpp> #include <boost/geometry/algorithms/dispatch/disjoint.hpp> namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace disjoint { template <typename Segment1, typename Segment2> struct disjoint_segment { static inline bool apply(Segment1 const& segment1, Segment2 const& segment2) { typedef typename point_type<Segment1>::type point_type; // We don't need to rescale to detect disjointness typedef no_rescale_policy rescale_policy_type; rescale_policy_type robust_policy; typedef segment_intersection_points < point_type, typename segment_ratio_type < point_type, rescale_policy_type >::type > intersection_return_type; intersection_return_type is = strategy::intersection::relate_cartesian_segments < policies::relate::segments_intersection_points < intersection_return_type > >::apply(segment1, segment2, robust_policy); return is.count == 0; } }; struct assign_disjoint_policy { // We want to include all points: static bool const include_no_turn = true; static bool const include_degenerate = true; static bool const include_opposite = true; // We don't assign extra info: template < typename Info, typename Point1, typename Point2, typename IntersectionInfo > static inline void apply(Info& , Point1 const& , Point2 const&, IntersectionInfo const&) {} }; template <typename Geometry1, typename Geometry2> struct disjoint_linear { static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2) { typedef typename geometry::point_type<Geometry1>::type point_type; typedef detail::no_rescale_policy rescale_policy_type; typedef typename geometry::segment_ratio_type < point_type, rescale_policy_type >::type segment_ratio_type; typedef overlay::turn_info < point_type, segment_ratio_type, typename detail::get_turns::turn_operation_type < Geometry1, Geometry2, segment_ratio_type >::type > turn_info_type; std::deque<turn_info_type> turns; // Specify two policies: // 1) Stop at any intersection // 2) In assignment, include also degenerate points (which are normally skipped) disjoint_interrupt_policy interrupt_policy; dispatch::get_turns < typename geometry::tag<Geometry1>::type, typename geometry::tag<Geometry2>::type, Geometry1, Geometry2, overlay::do_reverse<geometry::point_order<Geometry1>::value>::value, // should be false overlay::do_reverse<geometry::point_order<Geometry2>::value>::value, // should be false detail::get_turns::get_turn_info_type < Geometry1, Geometry2, assign_disjoint_policy > >::apply(0, geometry1, 1, geometry2, rescale_policy_type(), turns, interrupt_policy); return !interrupt_policy.has_intersections; } }; }} // namespace detail::disjoint #endif // DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { template <typename Linear1, typename Linear2> struct disjoint<Linear1, Linear2, 2, linear_tag, linear_tag, false> : detail::disjoint::disjoint_linear<Linear1, Linear2> {}; template <typename Segment1, typename Segment2> struct disjoint<Segment1, Segment2, 2, segment_tag, segment_tag, false> : detail::disjoint::disjoint_segment<Segment1, Segment2> {}; } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_LINEAR_HPP
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="@dimen/dp_05" android:background="@color/comment_line" />
{ "pile_set_name": "Github" }
# This file is part of cloud-init. See LICENSE file for license information. """cloud-init Integration Test Verify Script.""" from tests.cloud_tests.testcases import base class TestUserGroups(base.CloudTestCase): """Example cloud-config test.""" def test_group_ubuntu(self): """Test ubuntu group exists.""" out = self.get_data_file('group_ubuntu') self.assertRegex(out, r'ubuntu:x:[0-9]{4}:') def test_group_cloud_users(self): """Test cloud users group exists.""" out = self.get_data_file('group_cloud_users') self.assertRegex(out, r'cloud-users:x:[0-9]{4}:barfoo') def test_user_ubuntu(self): """Test ubuntu user exists.""" out = self.get_data_file('user_ubuntu') self.assertRegex( out, r'ubuntu:x:[0-9]{4}:[0-9]{4}:Ubuntu:/home/ubuntu:/bin/bash') def test_user_foobar(self): """Test foobar user exists.""" out = self.get_data_file('user_foobar') self.assertRegex( out, r'foobar:x:[0-9]{4}:[0-9]{4}:Foo B. Bar:/home/foobar:') def test_user_barfoo(self): """Test barfoo user exists.""" out = self.get_data_file('user_barfoo') self.assertRegex( out, r'barfoo:x:[0-9]{4}:[0-9]{4}:Bar B. Foo:/home/barfoo:') def test_user_cloudy(self): """Test cloudy user exists.""" out = self.get_data_file('user_cloudy') self.assertRegex(out, r'cloudy:x:[0-9]{3,4}:') def test_user_root_in_secret(self): """Test root user is in 'secret' group.""" _user, _, groups = self.get_data_file('root_groups').partition(":") self.assertIn("secret", groups.split(), msg="User root is not in group 'secret'") # vi: ts=4 expandtab
{ "pile_set_name": "Github" }
#ifndef __eglplatform_h_ #define __eglplatform_h_ /* ** Copyright (c) 2007-2016 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are 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 Materials. ** ** THE MATERIALS ARE 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 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* Platform-specific types and definitions for egl.h * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $ * * Adopters may modify khrplatform.h and this file to suit their platform. * You are encouraged to submit all modifications to the Khronos group so that * they can be included in future versions of this file. Please submit changes * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) * by filing a bug against product "EGL" component "Registry". */ #include <KHR/khrplatform.h> /* Macros used in EGL function prototype declarations. * * EGL functions should be prototyped as: * * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); * * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h */ #ifndef EGLAPI #define EGLAPI KHRONOS_APICALL #endif #ifndef EGLAPIENTRY #define EGLAPIENTRY KHRONOS_APIENTRY #endif #define EGLAPIENTRYP EGLAPIENTRY* /* The types NativeDisplayType, NativeWindowType, and NativePixmapType * are aliases of window-system-dependent types, such as X Display * or * Windows Device Context. They must be defined in platform-specific * code below. The EGL-prefixed versions of Native*Type are the same * types, renamed in EGL 1.3 so all types in the API start with "EGL". * * Khronos STRONGLY RECOMMENDS that you use the default definitions * provided below, since these changes affect both binary and source * portability of applications using EGL running on different EGL * implementations. */ #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif #include <windows.h> typedef HDC EGLNativeDisplayType; typedef HBITMAP EGLNativePixmapType; typedef HWND EGLNativeWindowType; #elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ typedef int EGLNativeDisplayType; typedef void *EGLNativeWindowType; typedef void *EGLNativePixmapType; #elif defined(__ANDROID__) || defined(ANDROID) struct ANativeWindow; struct egl_native_pixmap_t; typedef struct ANativeWindow* EGLNativeWindowType; typedef struct egl_native_pixmap_t* EGLNativePixmapType; typedef void* EGLNativeDisplayType; #elif defined(__unix__) /* X11 (tentative) */ #include <X11/Xlib.h> #include <X11/Xutil.h> typedef Display *EGLNativeDisplayType; typedef Pixmap EGLNativePixmapType; typedef Window EGLNativeWindowType; #else #error "Platform not recognized" #endif /* EGL 1.2 types, renamed for consistency in EGL 1.3 */ typedef EGLNativeDisplayType NativeDisplayType; typedef EGLNativePixmapType NativePixmapType; typedef EGLNativeWindowType NativeWindowType; /* Define EGLint. This must be a signed integral type large enough to contain * all legal attribute names and values passed into and out of EGL, whether * their type is boolean, bitmask, enumerant (symbolic constant), integer, * handle, or other. While in general a 32-bit integer will suffice, if * handles are 64 bit types, then EGLint should be defined as a signed 64-bit * integer type. */ typedef khronos_int32_t EGLint; /* C++ / C typecast macros for special EGL handle values */ #if defined(__cplusplus) #define EGL_CAST(type, value) (static_cast<type>(value)) #else #define EGL_CAST(type, value) ((type) (value)) #endif #endif /* __eglplatform_h */
{ "pile_set_name": "Github" }
///////////////////////////////////////////////////////////////////////// // $Id$ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2018 The Bochs Project // // 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 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 St, Fifth Floor, Boston, MA B 02110-1301 USA ///////////////////////////////////////////////////////////////////////// #define NEED_CPU_REG_SHORTCUTS 1 #include "bochs.h" #include "cpu.h" #define LOG_THIS BX_CPU_THIS_PTR void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EwIwM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); write_virtual_word(i->seg(), eaddr, i->Iw()); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EwIwR(bxInstruction_c *i) { BX_WRITE_16BIT_REG(i->dst(), i->Iw()); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EwGwM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); write_virtual_word(i->seg(), eaddr, BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_GwEwR(bxInstruction_c *i) { BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_GwEwM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); Bit16u val16 = read_virtual_word(i->seg(), eaddr); BX_WRITE_16BIT_REG(i->dst(), val16); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EwSwR(bxInstruction_c *i) { /* Illegal to use nonexisting segments */ if (i->src() >= 6) { BX_INFO(("MOV_EwSw: using of nonexisting segment register %d", i->src())); exception(BX_UD_EXCEPTION, 0); } Bit16u seg_reg = BX_CPU_THIS_PTR sregs[i->src()].selector.value; if (i->os32L()) { BX_WRITE_32BIT_REGZ(i->dst(), seg_reg); } else { BX_WRITE_16BIT_REG(i->dst(), seg_reg); } BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EwSwM(bxInstruction_c *i) { /* Illegal to use nonexisting segments */ if (i->src() >= 6) { BX_INFO(("MOV_EwSw: using of nonexisting segment register %d", i->src())); exception(BX_UD_EXCEPTION, 0); } bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); Bit16u seg_reg = BX_CPU_THIS_PTR sregs[i->src()].selector.value; write_virtual_word(i->seg(), eaddr, seg_reg); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_SwEw(bxInstruction_c *i) { Bit16u op2_16; /* Attempt to load CS or nonexisting segment register */ if (i->dst() >= 6 || i->dst() == BX_SEG_REG_CS) { BX_INFO(("MOV_EwSw: can't use this segment register %d", i->dst())); exception(BX_UD_EXCEPTION, 0); } if (i->modC0()) { op2_16 = BX_READ_16BIT_REG(i->src()); } else { bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); /* pointer, segment address pair */ op2_16 = read_virtual_word(i->seg(), eaddr); } load_seg_reg(&BX_CPU_THIS_PTR sregs[i->dst()], op2_16); if (i->dst() == BX_SEG_REG_SS) { // MOV SS inhibits interrupts, debug exceptions and single-step // trap exceptions until the execution boundary following the // next instruction is reached. // Same code as POP_SS() inhibit_interrupts(BX_INHIBIT_INTERRUPTS_BY_MOVSS); } BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::LEA_GwM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); BX_WRITE_16BIT_REG(i->dst(), (Bit16u) eaddr); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_AXOd(bxInstruction_c *i) { AX = read_virtual_word_32(i->seg(), i->Id()); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_OdAX(bxInstruction_c *i) { write_virtual_word_32(i->seg(), i->Id(), AX); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVZX_GwEbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); Bit8u op2_8 = read_virtual_byte(i->seg(), eaddr); /* zero extend byte op2 into word op1 */ BX_WRITE_16BIT_REG(i->dst(), (Bit16u) op2_8); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVZX_GwEbR(bxInstruction_c *i) { Bit8u op2_8 = BX_READ_8BIT_REGx(i->src(), i->extend8bitL()); /* zero extend byte op2 into word op1 */ BX_WRITE_16BIT_REG(i->dst(), (Bit16u) op2_8); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVSX_GwEbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); Bit8u op2_8 = read_virtual_byte(i->seg(), eaddr); /* sign extend byte op2 into word op1 */ BX_WRITE_16BIT_REG(i->dst(), (Bit8s) op2_8); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVSX_GwEbR(bxInstruction_c *i) { Bit8u op2_8 = BX_READ_8BIT_REGx(i->src(),i->extend8bitL()); /* sign extend byte op2 into word op1 */ BX_WRITE_16BIT_REG(i->dst(), (Bit8s) op2_8); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::XCHG_EwGwM(bxInstruction_c *i) { Bit16u op1_16, op2_16; bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); op1_16 = read_RMW_virtual_word(i->seg(), eaddr); op2_16 = BX_READ_16BIT_REG(i->src()); write_RMW_linear_word(op2_16); BX_WRITE_16BIT_REG(i->src(), op1_16); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::XCHG_EwGwR(bxInstruction_c *i) { Bit16u op1_16, op2_16; #if BX_DEBUGGER // Note for mortals: the instruction to trigger this is "xchgw %bx,%bx" if (bx_dbg.magic_break_enabled && (i->src() == 3) && (i->dst() == 3)) { BX_CPU_THIS_PTR magic_break = 1; BX_NEXT_INSTR(i); } #endif op1_16 = BX_READ_16BIT_REG(i->dst()); op2_16 = BX_READ_16BIT_REG(i->src()); BX_WRITE_16BIT_REG(i->src(), op1_16); BX_WRITE_16BIT_REG(i->dst(), op2_16); BX_NEXT_INSTR(i); } // Note: CMOV accesses a memory source operand (read), regardless // of whether condition is true or not. Thus, exceptions may // occur even if the MOV does not take place. void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVO_GwEwR(bxInstruction_c *i) { if (get_OF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNO_GwEwR(bxInstruction_c *i) { if (!get_OF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVB_GwEwR(bxInstruction_c *i) { if (get_CF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNB_GwEwR(bxInstruction_c *i) { if (!get_CF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVZ_GwEwR(bxInstruction_c *i) { if (get_ZF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNZ_GwEwR(bxInstruction_c *i) { if (!get_ZF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVBE_GwEwR(bxInstruction_c *i) { if (get_CF() || get_ZF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNBE_GwEwR(bxInstruction_c *i) { if (! (get_CF() || get_ZF())) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVS_GwEwR(bxInstruction_c *i) { if (get_SF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNS_GwEwR(bxInstruction_c *i) { if (!get_SF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVP_GwEwR(bxInstruction_c *i) { if (get_PF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNP_GwEwR(bxInstruction_c *i) { if (!get_PF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVL_GwEwR(bxInstruction_c *i) { if (getB_SF() != getB_OF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNL_GwEwR(bxInstruction_c *i) { if (getB_SF() == getB_OF()) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVLE_GwEwR(bxInstruction_c *i) { if (get_ZF() || (getB_SF() != getB_OF())) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::CMOVNLE_GwEwR(bxInstruction_c *i) { if (! get_ZF() && (getB_SF() == getB_OF())) BX_WRITE_16BIT_REG(i->dst(), BX_READ_16BIT_REG(i->src())); BX_NEXT_INSTR(i); }
{ "pile_set_name": "Github" }
var kICD_FileData: Int { get } var kICD_MetaData: Int { get } var kICD_ThumbnailData: Int { get } var kICD_ThumbnailDataFormatJPEG: Int { get } var kICD_ThumbnailDataFormatTIFF: Int { get } var kICD_ThumbnailDataFormatPNG: Int { get } var hasChildrenMask: Int { get } var hasThumbnailMask: Int { get } var fileLockedMask: Int { get } var rawImageFormatMask: Int { get } var fileInTempCacheMask: Int { get } var largeFileSizeMask: Int { get } var addedAfterCCCMask: Int { get } struct ObjectInfo { var icaObject: ICAObject var reserved: UInt var icaObjectInfo: ICAObjectInfo var uniqueID: UInt32 var thumbnailSize: UInt32 var dataSize: UInt32 var dataWidth: UInt32 var dataHeight: UInt32 var name: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) var creationDate: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) var flags: UInt32 var privateData: Ptr var uniqueIDFireWire: UInt64 var tag: UInt32 var dataSize64: UInt64 init() init(icaObject icaObject: ICAObject, reserved reserved: UInt, icaObjectInfo icaObjectInfo: ICAObjectInfo, uniqueID uniqueID: UInt32, thumbnailSize thumbnailSize: UInt32, dataSize dataSize: UInt32, dataWidth dataWidth: UInt32, dataHeight dataHeight: UInt32, name name: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8), creationDate creationDate: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8), flags flags: UInt32, privateData privateData: Ptr, uniqueIDFireWire uniqueIDFireWire: UInt64, tag tag: UInt32, dataSize64 dataSize64: UInt64) } struct ICD_ObjectSendMessagePB { var header: ICDHeader var object: ICAObject var objectInfo: ICAObjectInfo var connectionID: ICAConnectionID var message: ICAMessage var totalDataSize: UInt32 var result: UInt32 init() init(header header: ICDHeader, object object: ICAObject, objectInfo objectInfo: ICAObjectInfo, connectionID connectionID: ICAConnectionID, message message: ICAMessage, totalDataSize totalDataSize: UInt32, result result: UInt32) } typealias __ICD_OpenUSBDevice = @convention(c) (UInt32, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_OpenUSBDeviceWithIORegPath = @convention(c) (UInt32, UnsafeMutablePointer<Int8>, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_OpenFireWireDevice = @convention(c) (UInt64, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_OpenFireWireDeviceWithIORegPath = @convention(c) (UInt64, UnsafeMutablePointer<Int8>, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_OpenBluetoothDevice = @convention(c) (CFDictionary!, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_OpenTCPIPDevice = @convention(c) (CFDictionary!, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_OpenMassStorageDevice = @convention(c) (CFString!, DASession!, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_CloseDevice = @convention(c) (UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_PeriodicTask = @convention(c) (UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_GetObjectInfo = @convention(c) (UnsafePointer<ObjectInfo>, UInt32, UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_Cleanup = @convention(c) (UnsafeMutablePointer<ObjectInfo>) -> ICAError typealias __ICD_GetPropertyData = @convention(c) (UnsafePointer<ObjectInfo>, UnsafeMutablePointer<Void>) -> ICAError typealias __ICD_SetPropertyData = @convention(c) (UnsafePointer<ObjectInfo>, UnsafePointer<Void>) -> ICAError typealias __ICD_ReadFileData = @convention(c) (UnsafePointer<ObjectInfo>, UInt32, Ptr, UInt32, UnsafeMutablePointer<UInt32>) -> ICAError typealias __ICD_WriteFileData = @convention(c) (UnsafePointer<ObjectInfo>, UnsafePointer<Int8>, UInt32, Ptr, UInt32, UnsafeMutablePointer<UInt32>) -> ICAError typealias __ICD_SendMessage = @convention(c) (UnsafePointer<ObjectInfo>, UnsafeMutablePointer<ICD_ObjectSendMessagePB>, ICDCompletion!) -> ICAError typealias __ICD_AddPropertiesToCFDictionary = @convention(c) (UnsafeMutablePointer<ObjectInfo>, CFMutableDictionary!) -> ICAError typealias __ICD_WriteDataToFile = @convention(c) (UnsafePointer<ObjectInfo>, UnsafeMutablePointer<FILE>, UInt32, UnsafeMutablePointer<Int>) -> ICAError typealias __ICD_WriteDataToFileDescriptor = @convention(c) (UnsafePointer<ObjectInfo>, Int32, UInt32, UnsafeMutablePointer<Int>) -> ICAError typealias __ICD_WriteDataToFileDescriptor64 = @convention(c) (UnsafePointer<ObjectInfo>, Int32) -> ICAError func ICD_main(_ argc: Int32, _ argv: UnsafeMutablePointer<UnsafePointer<Int8>>) -> Int32 func ICDGetStandardPropertyData(_ objectInfo: UnsafePointer<ObjectInfo>, _ pb: UnsafeMutablePointer<Void>) -> ICAError func ICDNewObjectInfoCreated(_ parentInfo: UnsafePointer<ObjectInfo>, _ index: UInt32, _ newICAObject: UnsafeMutablePointer<ICAObject>) -> ICAError typealias ICDNewObjectCreatedCompletion = @convention(c) (UnsafePointer<ObjectInfo>) -> Void func ICDNewObjectCreated(_ parentInfo: UnsafePointer<ObjectInfo>, _ objectInfo: UnsafePointer<ObjectInfo>, _ completion: ICDNewObjectCreatedCompletion!) -> ICAError func ICDCopyDeviceInfoDictionary(_ deviceName: UnsafePointer<Int8>, _ theDict: UnsafeMutablePointer<Unmanaged<CFDictionary>?>) -> ICAError func ICDCreateEventDataCookie(_ object: ICAObject, _ cookie: UnsafeMutablePointer<ICAEventDataCookie>) -> ICAError func ICDConnectUSBDevice(_ locationID: UInt32) -> ICAError func ICDConnectUSBDeviceWithIORegPath(_ locationID: UInt32, _ ioregPath: UnsafeMutablePointer<Int8>) -> ICAError func ICDDisconnectUSBDevice(_ locationID: UInt32) -> ICAError func ICDDisconnectUSBDeviceWithIORegPath(_ locationID: UInt32, _ ioregPath: UnsafeMutablePointer<Int8>) -> ICAError func ICDConnectFWDevice(_ guid: UInt64) -> ICAError func ICDConnectFWDeviceWithIORegPath(_ guid: UInt64, _ ioregPath: UnsafeMutablePointer<Int8>) -> ICAError func ICDDisconnectFWDevice(_ guid: UInt64) -> ICAError func ICDDisconnectFWDeviceWithIORegPath(_ guid: UInt64, _ ioregPath: UnsafeMutablePointer<Int8>) -> ICAError func ICDConnectBluetoothDevice(_ params: CFDictionary!) -> ICAError func ICDDisconnectBluetoothDevice(_ params: CFDictionary!) -> ICAError func ICDConnectTCPIPDevice(_ params: CFDictionary!) -> ICAError func ICDDisconnectTCPIPDevice(_ params: CFDictionary!) -> ICAError struct ICD_callback_functions { var f_ICD_OpenUSBDevice: __ICD_OpenUSBDevice! var f_ICD_CloseDevice: __ICD_CloseDevice! var f_ICD_PeriodicTask: __ICD_PeriodicTask! var f_ICD_GetObjectInfo: __ICD_GetObjectInfo! var f_ICD_Cleanup: __ICD_Cleanup! var f_ICD_GetPropertyData: __ICD_GetPropertyData! var f_ICD_SetPropertyData: __ICD_SetPropertyData! var f_ICD_ReadFileData: __ICD_ReadFileData! var f_ICD_WriteFileData: __ICD_WriteFileData! var f_ICD_SendMessage: __ICD_SendMessage! var f_ICD_AddPropertiesToCFDictionary: __ICD_AddPropertiesToCFDictionary! var f_ICD_OpenFireWireDevice: __ICD_OpenFireWireDevice! var f_ICD_OpenUSBDeviceWithIORegPath: __ICD_OpenUSBDeviceWithIORegPath! var f_ICD_OpenFireWireDeviceWithIORegPath: __ICD_OpenFireWireDeviceWithIORegPath! var f_ICD_OpenBluetoothDevice: __ICD_OpenBluetoothDevice! var f_ICD_OpenTCPIPDevice: __ICD_OpenTCPIPDevice! var f_ICD_WriteDataToFile: __ICD_WriteDataToFile! var f_ICD_OpenMassStorageDevice: __ICD_OpenMassStorageDevice! var f_ICD_WriteDataToFileDescriptor: __ICD_WriteDataToFileDescriptor! var f_ICD_WriteDataToFileDescriptor64: __ICD_WriteDataToFileDescriptor64! init() init(f_ICD_OpenUSBDevice f_ICD_OpenUSBDevice: __ICD_OpenUSBDevice!, f_ICD_CloseDevice f_ICD_CloseDevice: __ICD_CloseDevice!, f_ICD_PeriodicTask f_ICD_PeriodicTask: __ICD_PeriodicTask!, f_ICD_GetObjectInfo f_ICD_GetObjectInfo: __ICD_GetObjectInfo!, f_ICD_Cleanup f_ICD_Cleanup: __ICD_Cleanup!, f_ICD_GetPropertyData f_ICD_GetPropertyData: __ICD_GetPropertyData!, f_ICD_SetPropertyData f_ICD_SetPropertyData: __ICD_SetPropertyData!, f_ICD_ReadFileData f_ICD_ReadFileData: __ICD_ReadFileData!, f_ICD_WriteFileData f_ICD_WriteFileData: __ICD_WriteFileData!, f_ICD_SendMessage f_ICD_SendMessage: __ICD_SendMessage!, f_ICD_AddPropertiesToCFDictionary f_ICD_AddPropertiesToCFDictionary: __ICD_AddPropertiesToCFDictionary!, f_ICD_OpenFireWireDevice f_ICD_OpenFireWireDevice: __ICD_OpenFireWireDevice!, f_ICD_OpenUSBDeviceWithIORegPath f_ICD_OpenUSBDeviceWithIORegPath: __ICD_OpenUSBDeviceWithIORegPath!, f_ICD_OpenFireWireDeviceWithIORegPath f_ICD_OpenFireWireDeviceWithIORegPath: __ICD_OpenFireWireDeviceWithIORegPath!, f_ICD_OpenBluetoothDevice f_ICD_OpenBluetoothDevice: __ICD_OpenBluetoothDevice!, f_ICD_OpenTCPIPDevice f_ICD_OpenTCPIPDevice: __ICD_OpenTCPIPDevice!, f_ICD_WriteDataToFile f_ICD_WriteDataToFile: __ICD_WriteDataToFile!, f_ICD_OpenMassStorageDevice f_ICD_OpenMassStorageDevice: __ICD_OpenMassStorageDevice!, f_ICD_WriteDataToFileDescriptor f_ICD_WriteDataToFileDescriptor: __ICD_WriteDataToFileDescriptor!, f_ICD_WriteDataToFileDescriptor64 f_ICD_WriteDataToFileDescriptor64: __ICD_WriteDataToFileDescriptor64!) } var gICDCallbackFunctions: ICD_callback_functions
{ "pile_set_name": "Github" }
-----BEGIN EDDSA PRIVATE KEY----- MFICAQAwBQYDK2VwBCIEIFwOftlJ9QL4yEBIBh9UmTRwCu+A6puPK9OFmVk0A19P oSIEIKZgKbt92EfL1B7QbQ9XANgqH1BqQrxd5bgZZbLfJK9Q -----END EDDSA PRIVATE KEY-----
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 37cb9e3c68c881e458e3d738e5c69343 TextureImporter: internalIDToNameTable: [] externalObjects: {} serializedVersion: 10 mipmaps: mipMapMode: 0 enableMipMap: 0 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 borderMipMap: 0 mipMapsPreserveCoverage: 0 alphaTestReferenceValue: 0.5 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 seamlessCubemap: 0 textureFormat: 1 maxTextureSize: 2048 textureSettings: serializedVersion: 2 filterMode: -1 aniso: -1 mipBias: -100 wrapU: 1 wrapV: 1 wrapW: 1 nPOTScale: 0 lightmap: 0 compressionQuality: 50 spriteMode: 1 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 100 spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 1 spriteTessellationDetail: -1 textureType: 8 textureShape: 1 singleChannelComponent: 0 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 1 spriteSheet: serializedVersion: 2 sprites: [] outline: [] physicsShape: [] bones: [] spriteID: a128c1414c423fd4e847349bc5844e00 internalID: 0 vertices: [] indices: edges: [] weights: [] secondaryTextures: [] spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
module FastJsonapi class Scalar attr_reader :key, :method, :conditional_proc def initialize(key:, method:, options: {}) @key = key @method = method @conditional_proc = options[:if] end def serialize(record, serialization_params, output_hash) if conditionally_allowed?(record, serialization_params) if method.is_a?(Proc) output_hash[key] = FastJsonapi.call_proc(method, record, serialization_params) else output_hash[key] = record.public_send(method) end end end def conditionally_allowed?(record, serialization_params) if conditional_proc.present? FastJsonapi.call_proc(conditional_proc, record, serialization_params) else true end end end end
{ "pile_set_name": "Github" }
test_number=002 description="fail when missing required params" $bin >/dev/null 2>&1 if [ $? -eq 0 ]; then test_status $test_number 0 "$description" FAIL else test_status $test_number 0 "$description" PASS fi
{ "pile_set_name": "Github" }
package abi37_0_0.expo.modules.av; public interface AudioEventHandler { void pauseImmediately(); boolean requiresAudioFocus(); void updateVolumeMuteAndDuck(); void handleAudioFocusInterruptionBegan(); void handleAudioFocusGained(); void onPause(); void onResume(); }
{ "pile_set_name": "Github" }
--- author: name: Linode email: [email protected] deprecated: yes description: 'Securely copying files to and from your Linode with Filezilla, a free and open source file transfer client for Linux desktop systems.' keywords: ["filezilla", "ftp", "linux scp", "sftp", "linux sftp program", "linux ftp"] tags: ["ubuntu"] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' aliases: ['/networking/file-transfer/transfer-files-filezilla-ubuntu-9-10/'] modified: 2011-08-22 modified_by: name: Linode published: 2009-11-13 title: 'Transfer Files with Filezilla on Ubuntu 9.10 Desktop' --- Filezilla is a free, open source file transfer program written for Linux, Mac OS X, and Windows systems. It implements several file transfer protocols, most notably SFTP via SSH. This tool allows you to securely transfer files to and from your Linode using an encrypted channel, avoiding the security problems and usability issues inherent in traditional FTP client/server systems. Filezilla can send both your login credentials and file transfers over the network securely encrypted (provided you're using SFTP), while standard FTP clients send this information as plaintext. You'll need to make sure your Linode is running an SSH daemon (all Linodes run an OpenSSH server by default), and that you have a user account on the server before following these instructions. If you wish, you may use the `root` account on your Linode to perform file transfers, although you may need to change [file ownership and permissions](/docs/tools-reference/linux-users-and-groups) on the server after doing so. # Installing Filezilla On your desktop, click "System" -\> "Administration" -\> "Synaptic Package Manager" as shown below to start the package installer. [![Launching Synaptic on Ubuntu 9.10 desktop edition.](179-filezilla-ubuntu-synaptic.png)](179-filezilla-ubuntu-synaptic.png) In the package manager's "Quick search" box, enter "sftp" and click the "Search" icon. A list of packages related to sftp programs will appear. Locate "filezilla" in this list and check its box to select it for installation. Click the "Apply" button to proceed. [![Finding a package in Synaptic on Ubuntu 9.10 desktop edition.](180-filezilla-ubuntu-selected.png)](180-filezilla-ubuntu-selected.png) You will be asked to confirm your installation request. Click the "Apply" button to proceed. [![Confirming package installation in Synaptic on Ubuntu 9.10 desktop edition.](181-filezilla-ubuntu-apply.png)](181-filezilla-ubuntu-apply.png) Filezilla and required dependency files will be installed on your system. You may close Synaptic once the install has completed. # Using Filezilla On your desktop, click "Applications" -\> "Internet" -\> "Filezilla" to launch the program. [![Menu entry for Filezilla on Ubuntu 9.10 desktop edition.](182-filezilla-ubuntu-menu-entry.png)](182-filezilla-ubuntu-menu-entry.png) Enter your Linode's IP address in the "Host" field. Enter the account username you wish to connect as in the "Username" field. Please note that this must be a user account on your Linode; if in doubt, enter "root" to log in as the root user. Enter the account's password in the "Password" field, and enter "22" in the "Port" field. Click "Quickconnect" to initiate the file transfer session. [![Quickconnect in Filezilla on Ubuntu 9.10 desktop edition.](183-filezilla-ubuntu-quick-connect.png)](183-filezilla-ubuntu-quick-connect.png) If this is the first time you've connected to your Linode with an SSH or SFTP program, you'll receive a warning that the host key is unknown. [![Unknown SSH key warning in Filezilla on Ubuntu 9.10 desktop edition.](184-filezilla-ubuntu-unknown-key.png)](184-filezilla-ubuntu-unknown-key.png) This is due to the possibility that someone could be eavesdropping on your connection, posing as the server you are trying to log into. You need some "out of band" method of comparing the key fingerprint presented to Filezilla with the fingerprint of the public key on the server you wish to log into. You may do so by logging into your Linode via the Lish console (see the "Console" tab in the Linode Manager) and executing the following command: ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub The key fingerprints should match; click "Yes" to accept the warning and cache this host key. You won't receive further warnings unless the key presented to Filezilla changes for some reason; typically, this should only happen if you reinstall the remote server's operating system. If you should receive this warning again from a system you already have the host key cached on, you should not trust the connection and investigate matters further. When you're ready to proceed, click the "Ok" button. You'll be presented with a split view, with your local filesystem on the left and your Linode's filesystem on the right. You may transfer files by dragging and dropping them between each side. # Connecting Without a Password (SSH Keys) If you'd like to use SSH keys to allow access to your Linode without the need to specify a password, you'll need to make sure you have an SSH keypair generated for your local user account. To verify this, open a terminal (click "Applications" -\> "Accessories" -\> "Terminal") and type the following command: ls ~/.ssh/ If you see a list of files including `id_rsa` or `id_dsa`, you already have keys on your workstation. If you don't see such files listed, issue the following command to create a keypair: ssh-keygen -t rsa Next, you'll need to copy your public key (created as `id_rsa.pub`) to your Linode. Issue the following commands to do so. If your files are called `id_dsa` and `id_dsa.pub`, change the command accordingly. Substitute the name of the user account you wish to log into on your Linode (or "root") for the "user" portion of the command, and substitute your Linode's IP address or domain name for the "hostname.com" portion of the command. scp ~/.ssh/id_rsa.pub [email protected]:~/.ssh/uploaded_key.pub ssh [email protected] "echo \`cat ~/.ssh/uploaded_key.pub\` >> ~/.ssh/authorized_keys2" Test the ability to log in without a password by issuing the following command: ssh [email protected] If you're asked for a password, please double-check the preceding steps in this section. If you're logged into your Linode, you may type `exit` to close the SSH connection. Provided you were able to log in without entering a password, return to Filezilla and initiate a new connection. You should now be able to connect to your Linode without entering a password in the "Password" field. # More Information You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials. - [Filezilla Documentation](http://wiki.filezilla-project.org/Documentation) - [Tools & Resources](/docs/tools-reference/)
{ "pile_set_name": "Github" }
<?php /* * This file is part of Psy Shell. * * (c) 2012-2018 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy\Test\Formatter\Fixtures; class SomeClass { const SOME_CONST = 'some const'; private $someProp = 'some prop'; public function someMethod($someParam) { return 'some method'; } public static function someClosure() { return function () { return 'some closure'; }; } }
{ "pile_set_name": "Github" }
"""Tools to save/restore model from checkpoints.""" import argparse import sys import os import torch import re import json CHECKPOINT_PATTERN = re.compile('^checkpoint-(\d+)$') class ArgsDict(dict): def __init__(self, **kwargs): super(ArgsDict, self).__init__() for key, value in kwargs.items(): self[key] = value self.__dict__ = self def load_checkpoint(model, optimizer, model_dir, map_to_cpu=False, step=None): path = os.path.join(model_dir, 'checkpoint') if step is not None: path += '-{:08d}'.format(step) if os.path.exists(path): print("Loading model from %s" % path) if map_to_cpu: checkpoint = torch.load( path, map_location=lambda storage, location: storage) else: checkpoint = torch.load(path) old_state_dict = model.state_dict() for key in old_state_dict.keys(): if key not in checkpoint['model']: checkpoint['model'][key] = old_state_dict[key] model.load_state_dict(checkpoint['model']) optimizer.load_state_dict(checkpoint['optimizer']) return checkpoint.get('step', 0) return 0 def load_and_map_checkpoint(model, model_dir, remap): path = os.path.join(model_dir, 'checkpoint') print("Loading parameters %s from %s" % (remap.keys(), model_dir)) checkpoint = torch.load(path) new_state_dict = model.state_dict() for name, value in remap.items(): # TODO: smarter mapping. new_state_dict[name] = checkpoint['model'][value] model.load_state_dict(new_state_dict) def save_checkpoint(model, optimizer, step, model_dir, ignore=[], keep_every_n=10000000): if not os.path.exists(model_dir): os.makedirs(model_dir) path = os.path.join(model_dir, 'checkpoint') step_padded = format(step, '08d') state_dict = model.state_dict() if ignore: for key in state_dict.keys(): for item in ignore: if key.startswith(item): state_dict.pop(key) torch.save({ 'model': state_dict, 'optimizer': optimizer.state_dict(), 'step': step }, '{}-{}'.format(path, step_padded)) if os.path.exists(path): os.unlink(path) source = 'checkpoint-' + step_padded os.symlink(source, path) # Cull old checkpoints. if keep_every_n is not None: all_checkpoints = [] for name in os.listdir(model_dir): m = CHECKPOINT_PATTERN.match(name) if m is None or name == source: continue checkpoint_step = int(m.group(1)) all_checkpoints.append((checkpoint_step, name)) all_checkpoints.sort() last_step = float('-inf') for checkpoint_step, name in all_checkpoints: if checkpoint_step - last_step >= keep_every_n: last_step = checkpoint_step continue os.unlink(os.path.join(model_dir, name)) class Saver(object): """Class to manage save and restore for the model and optimizer.""" def __init__(self, model, optimizer, keep_every_n=None): self._model = model self._optimizer = optimizer self._keep_every_n = keep_every_n def restore(self, model_dir, map_to_cpu=False, step=None): """Restores model and optimizer from given directory. Returns: Last training step for the model restored. """ last_step = load_checkpoint( self._model, self._optimizer, model_dir, map_to_cpu, step) return last_step def save(self, model_dir, step): """Saves model and optimizer to given directory. Args: model_dir: Model directory to save. step: Current training step. """ save_checkpoint(self._model, self._optimizer, step, model_dir, keep_every_n=self._keep_every_n) def restore_part(self, other_model_dir, remap): """Restores part of the model from other directory. Useful to initialize part of the model with another pretrained model. Args: other_model_dir: Model directory to load from. remap: dict, remapping current parameters to the other model's. """ load_and_map_checkpoint(self._model, other_model_dir, remap) def save_args(args): if not os.path.exists(args.model_dir): os.makedirs(args.model_dir) with open(os.path.join(args.model_dir, 'args.json'), 'w') as f: f.write(json.dumps(vars(args))) def restore_args(args): if not os.path.exists(args.model_dir): raise Exception('{} does not exist'.format(args.model_dir)) with open(os.path.join(args.model_dir, 'args.json')) as f: new_args = json.loads(f.read()) for arg in new_args: if not hasattr(args, arg): setattr(args, arg, new_args[arg]) def print_params(dct, indent=0): for key in dct: if isinstance(dct[key], dict): print(" " * indent + str(key)) print_params(dct[key], indent + 2) elif isinstance(dct[key], torch.Tensor): print(" " * indent + key + " " + str(dct[key].size())) else: print(" " * indent + key + " = " + str(dct[key])) if __name__ == "__main__": parser = argparse.ArgumentParser(description='Checkpoint Viewer') parser.add_argument('--model_dir', type=str, default='') args = parser.parse_args() path = os.path.join(args.model_dir, 'checkpoint') print("Loading model from %s" % path) checkpoint = torch.load(path) print_params(checkpoint)
{ "pile_set_name": "Github" }
/**************************************************************************** ** ** Copyright (C) 2016 Jochen Becher ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include "melement.h" #include "qmt/infrastructure/handles.h" #include <QString> namespace qmt { class MRelation; class QMT_EXPORT MObject : public MElement { public: MObject(); MObject(const MObject &rhs); ~MObject() override; MObject &operator=(const MObject &rhs); QString name() const { return m_name; } void setName(const QString &name); const Handles<MObject> &children() const { return m_children; } void setChildren(const Handles<MObject> &children); void addChild(const Uid &uid); void addChild(MObject *child); void insertChild(int beforeIndex, const Uid &uid); void insertChild(int beforeIndex, MObject *child); void removeChild(const Uid &uid); void removeChild(MObject *child); void decontrolChild(const Uid &uid); void decontrolChild(MObject *child); const Handles<MRelation> &relations() const { return m_relations; } void setRelations(const Handles<MRelation> &relations); void addRelation(const Uid &uid); void addRelation(MRelation *relation); void insertRelation(int beforeIndex, MRelation *relation); void removeRelation(MRelation *relation); void decontrolRelation(MRelation *relation); void accept(MVisitor *visitor) override; void accept(MConstVisitor *visitor) const override; private: QString m_name; Handles<MObject> m_children; Handles<MRelation> m_relations; }; } // namespace qmt
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Zend * @package Zend_Mobile * @subpackage Zend_Mobile_Push * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ /** Zend_Mobile_Exception */ require_once 'Zend/Mobile/Exception.php'; /** * @category Zend * @package Zend_Mobile * @subpackage Zend_Mobile_Push * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ class Zend_Mobile_Push_Exception extends Zend_Mobile_Exception {}
{ "pile_set_name": "Github" }