text
stringlengths
2
1.04M
meta
dict
require('medium-editor/dist/css/medium-editor.css'); require('medium-editor/dist/css/themes/default.css'); require('./app.css'); var React = require('react'); var Editor = require('../lib/editor'); var App = React.createClass({ getInitialState() { return {text: 'Fusce dapibus, tellus ac cursus commodo'} }, render() { return ( <div className="app"> <h1>react-medium-editor</h1> <h3>Html content</h3> <div>{this.state.text}</div> <h3>Editor #1 (&lt;pre&gt; tag)</h3> <Editor tag="pre" text={this.state.text} onChange={this.handleChange} options={{buttons: ['bold', 'italic', 'underline']}} /> <h3>Editor #2</h3> <Editor text={this.state.text} onChange={this.handleChange} /> </div> ); }, handleChange(text) { this.setState({text: text}); } }); React.render(<App/>, document.getElementById('app'));
{ "content_hash": "577f8d58fd5e0986ebcacd2a01364cc3", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 62, "avg_line_length": 23.804878048780488, "alnum_prop": 0.5594262295081968, "repo_name": "idream3/react-medium-editor", "id": "2bfcd7082ab9c76cf9dc66ba67cc3874982ddb1d", "size": "976", "binary": false, "copies": "5", "ref": "refs/heads/gh-pages", "path": "example/app.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "233" }, { "name": "HTML", "bytes": "730" }, { "name": "JavaScript", "bytes": "3803" }, { "name": "Makefile", "bytes": "81" } ], "symlink_target": "" }
import React from 'react'; import PropTypes from 'prop-types'; // Components import Wysiwyg from 'components/shared/Wysiwyg'; import Dashboard from 'components/shared/Dashboard'; class EditDashboard extends React.Component { constructor(props) { super(props); this.state = { topContent: props.topContent, bottomContent: props.bottomContent }; } render() { return ( <div className="c-edit-dashboard vizz-wysiwyg"> <input type="hidden" name="site_page[dashboard_setting][content_top]" value={this.state.topContent || ''} /> <input type="hidden" name="site_page[dashboard_setting][content_bottom]" value={this.state.bottomContent || ''} /> <Wysiwyg items={this.props.topContent ? JSON.parse(this.props.topContent) : []} onChange={content => this.setState({ topContent: JSON.stringify(content) })} blocks={['text', 'image', 'html']} /> <Dashboard preview pageSlug="preview" dataset={this.props.dataset} widget={this.props.widget} hiddenFields={this.props.hiddenFields} /> <Wysiwyg items={this.props.bottomContent ? JSON.parse(this.props.bottomContent) : []} onChange={content => this.setState({ bottomContent: JSON.stringify(content) })} blocks={['text', 'image', 'html']} /> </div> ); } } EditDashboard.propTypes = { dataset: PropTypes.string, widget: PropTypes.string, topContent: PropTypes.string, bottomContent: PropTypes.string, hiddenFields: PropTypes.arrayOf(PropTypes.string) }; EditDashboard.defaultProps = { topContent: null, bottomContent: null, widget: null, dataset: null, hiddenFields: [] }; export default EditDashboard;
{ "content_hash": "4b731131b6bc3882aef5876fd63e923c", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 143, "avg_line_length": 31.962962962962962, "alnum_prop": 0.6645422943221321, "repo_name": "Vizzuality/forest-atlas-landscape-cms", "id": "95bc11040cf8fcf20c0539eb6a77ae8301ab49d2", "size": "1726", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "app/javascript/pages/admin/edit-dashboard.js", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "1037" }, { "name": "HTML", "bytes": "190365" }, { "name": "Handlebars", "bytes": "12819" }, { "name": "JavaScript", "bytes": "374437" }, { "name": "Ruby", "bytes": "496593" }, { "name": "SCSS", "bytes": "183677" }, { "name": "Shell", "bytes": "5223" } ], "symlink_target": "" }
package org.rioproject.bean; import java.lang.annotation.*; /** * The SetConfiguration annotation is used on a method in a bean to have it's * configured parameters injected. The method on which the * SetConfiguration annotation is applied MUST fulfill the following requirements: * * <ul> * <li>The method must have a single parameter of type {@link java.util.Map}&lt;String, Object&gt; * <li>The method must have no return * <li>The method must not throw a checked exception * <li>The method on which SetParameters is applied must be public * <li>The method must not be static * </ul> * * @author Dennis Reedy */ @Documented @Retention (RetentionPolicy.RUNTIME) @Target (value= ElementType.METHOD) public @interface SetParameters { }
{ "content_hash": "620d03e408e84f91a4936dcb5c93dcaa", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 98, "avg_line_length": 30.12, "alnum_prop": 0.7436918990703851, "repo_name": "khartig/assimilator", "id": "a675437d9a7b3a76aa192a1454e4aa9d0ec08548", "size": "1368", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "rio-lib/src/main/java/org/rioproject/bean/SetParameters.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "8852" }, { "name": "CSS", "bytes": "2456" }, { "name": "Groovy", "bytes": "409606" }, { "name": "HTML", "bytes": "279722" }, { "name": "Java", "bytes": "5257555" }, { "name": "Shell", "bytes": "14035" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using Xunit; namespace HarshPoint.Tests.Provisioning.Implementation { public class NestedResultsProofOfConcept { [Fact] public void Inner_grouping() { /* Step1: GROUP BY (up to) THIS ┐ ˅ ImmutableArray[ Planet, Continent, Country, City, Street, Building ] Grouping[ ImmutableArray[ Planet, Continent, Country, City, Street ], Building ] Tuple[ Planet, Continent, Country, City, Grouping[ Street, Building ] ] Tuple[ Planet, Continent, Country, Tuple[ City, Grouping[ Street, Building ] ] ] Tuple[ Planet, Tuple[ Continent, Country ], Tuple[ City, Grouping[ Street, Building ] ] ] Step2: GROUP BY THIS ┐ ˅ Tuple[ Planet, Tuple[ Continent, Country ], Tuple[ City, Grouping[ Street, Building ] ] ] Grouping[ Tuple[ Planet, Tuple[ Continent, Country ], Tuple[ City, Grouping[ Street, Building ] ] ] ] Tuple[ Planet, Grouping[ Tuple[ Continent, Country ], Tuple[ City, Grouping[ Street, Building ] ] ] ] Tuple< Planet, IGrouping< Tuple<Continent, Country>, Tuple< City, IGrouping<Street, Building> > > > GroupBy Tuple(Item1..Item5) => Item6 Tuple ( LiftOutOfKey Item1 Tuple( LiftOutOfKey Item2, LiftOutOfKey Item3 ) Tuple( LiftOutOfKey Item4, Grouping (LiftOutOfKey Item5) ) ) GroupBy (Tuple (Item1, Item2) => Item3) Tuple( LiftOutOfKey Item1, Grouping LiftOutOfKey Item2) */ var source = Universe.Create(); var step1 = source.GroupBy( x => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5), x => x.Item6, (k, g) => Tuple.Create( k.Item1, Tuple.Create(k.Item2, k.Item3), Tuple.Create(k.Item4, Grouping(k.Item5, g)) ) ); var step2 = step1.GroupBy( x => Tuple.Create(x.Item1, x.Item2), x => x.Item3, (k, g) => Tuple.Create(k.Item1, Grouping(k.Item2, g)) ); } private static IGrouping<TKey, TElement> Grouping<TKey, TElement>(TKey key, IEnumerable<TElement> elements) => HarshGrouping.Create(key, elements); } }
{ "content_hash": "0e93455c29d155f20576085eb3554d35", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 121, "avg_line_length": 39.97260273972603, "alnum_prop": 0.4671007539410555, "repo_name": "HarshPoint/HarshPoint", "id": "cbf6bdf13439e1496c0bb87c9d9043b7307d9abf", "size": "2926", "binary": false, "copies": "3", "ref": "refs/heads/development", "path": "test/HarshPoint.Tests/Provisioning/Implementation/NestedResultsProofOfConcept.cs", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C#", "bytes": "891463" }, { "name": "PowerShell", "bytes": "8864" } ], "symlink_target": "" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.storage.blob.implementation.util; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobUrlParts; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.implementation.credentials.SasTokenCredential; import com.azure.storage.common.implementation.policy.SasTokenCredentialPolicy; import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.RequestRetryPolicy; import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; import com.azure.storage.common.policy.ScrubEtagPolicy; import com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * This class provides helper methods for common builder patterns. * * RESERVED FOR INTERNAL USE. */ public final class BuilderHelper { private static final Map<String, String> PROPERTIES = CoreUtils.getProperties("azure-storage-blob.properties"); private static final String SDK_NAME = "name"; private static final String SDK_VERSION = "version"; /** * Constructs a {@link HttpPipeline} from values passed from a builder. * * @param storageSharedKeyCredential {@link StorageSharedKeyCredential} if present. * @param tokenCredential {@link TokenCredential} if present. * @param sasTokenCredential {@link SasTokenCredential} if present. * @param endpoint The endpoint for the client. * @param retryOptions Retry options to set in the retry policy. * @param logOptions Logging options to set in the logging policy. * @param httpClient HttpClient to use in the builder. * @param additionalPolicies Additional {@link HttpPipelinePolicy policies} to set in the pipeline. * @param configuration Configuration store contain environment settings. * @param logger {@link ClientLogger} used to log any exception. * @return A new {@link HttpPipeline} from the passed values. */ public static HttpPipeline buildPipeline(StorageSharedKeyCredential storageSharedKeyCredential, TokenCredential tokenCredential, SasTokenCredential sasTokenCredential, String endpoint, RequestRetryOptions retryOptions, HttpLogOptions logOptions, HttpClient httpClient, List<HttpPipelinePolicy> additionalPolicies, Configuration configuration, ClientLogger logger) { // Closest to API goes first, closest to wire goes last. List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(getUserAgentPolicy(configuration)); policies.add(new RequestIdPolicy()); policies.add(new AddDatePolicy()); HttpPipelinePolicy credentialPolicy; if (storageSharedKeyCredential != null) { credentialPolicy = new StorageSharedKeyCredentialPolicy(storageSharedKeyCredential); } else if (tokenCredential != null) { httpsValidation(tokenCredential, "bearer token", endpoint, logger); credentialPolicy = new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint)); } else if (sasTokenCredential != null) { credentialPolicy = new SasTokenCredentialPolicy(sasTokenCredential); } else { credentialPolicy = null; } if (credentialPolicy != null) { policies.add(credentialPolicy); } HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RequestRetryPolicy(retryOptions)); policies.addAll(additionalPolicies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(getResponseValidationPolicy()); policies.add(new HttpLoggingPolicy(logOptions)); policies.add(new ScrubEtagPolicy()); return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); } /** * Gets the default http log option for Storage Blob. * * @return the default http log options. */ public static HttpLogOptions getDefaultHttpLogOptions() { HttpLogOptions defaultOptions = new HttpLogOptions(); BlobHeadersAndQueryParameters.getBlobHeaders().forEach(defaultOptions::addAllowedHeaderName); BlobHeadersAndQueryParameters.getBlobQueryParameters().forEach(defaultOptions::addAllowedQueryParamName); return defaultOptions; } /** * Gets the endpoint for the blob service based on the parsed URL. * * @param parts The {@link BlobUrlParts} from the parse URL. * @return The endpoint for the blob service. */ public static String getEndpoint(BlobUrlParts parts) { if (ModelHelper.IP_V4_URL_PATTERN.matcher(parts.getHost()).find()) { return String.format("%s://%s/%s", parts.getScheme(), parts.getHost(), parts.getAccountName()); } else { return String.format("%s://%s", parts.getScheme(), parts.getHost()); } } /** * Validates that the client is properly configured to use https. * * @param objectToCheck The object to check for. * @param objectName The name of the object. * @param endpoint The endpoint for the client. */ public static void httpsValidation(Object objectToCheck, String objectName, String endpoint, ClientLogger logger) { if (objectToCheck != null && !BlobUrlParts.parse(endpoint).getScheme().equals(Constants.HTTPS)) { throw logger.logExceptionAsError(new IllegalArgumentException( "Using a(n) " + objectName + " requires https")); } } /* * Creates a {@link UserAgentPolicy} using the default blob module name and version. * * @param configuration Configuration store used to determine whether telemetry information should be included. * @return The default {@link UserAgentPolicy} for the module. */ private static UserAgentPolicy getUserAgentPolicy(Configuration configuration) { configuration = (configuration == null) ? Configuration.NONE : configuration; String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); return new UserAgentPolicy(getDefaultHttpLogOptions().getApplicationId(), clientName, clientVersion, configuration); } /* * Creates a {@link ResponseValidationPolicyBuilder.ResponseValidationPolicy} used to validate response data from * the service. * * @return The {@link ResponseValidationPolicyBuilder.ResponseValidationPolicy} for the module. */ private static HttpPipelinePolicy getResponseValidationPolicy() { return new ResponseValidationPolicyBuilder() .addOptionalEcho(Constants.HeaderConstants.CLIENT_REQUEST_ID) .addOptionalEcho(Constants.HeaderConstants.ENCRYPTION_KEY_SHA256) .build(); } }
{ "content_hash": "f83a9651b9aeee78382f97b1fec3d790", "timestamp": "", "source": "github", "line_count": 176, "max_line_length": 119, "avg_line_length": 44.88068181818182, "alnum_prop": 0.7249018863147234, "repo_name": "navalev/azure-sdk-for-java", "id": "31bcf0dc84ec5ed8dd4fd892f3ca7b4608e497a4", "size": "7899", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BuilderHelper.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "7230" }, { "name": "CSS", "bytes": "5411" }, { "name": "Groovy", "bytes": "1570436" }, { "name": "HTML", "bytes": "29221" }, { "name": "Java", "bytes": "250218562" }, { "name": "JavaScript", "bytes": "15605" }, { "name": "PowerShell", "bytes": "30924" }, { "name": "Python", "bytes": "42119" }, { "name": "Shell", "bytes": "1408" } ], "symlink_target": "" }
using System; namespace Microsoft.Scripting.Runtime { /// <summary> /// This attribute marks a parameter that is not allowed to be null. /// It is used by the method binding infrastructure to generate better error /// messages and method selection. /// </summary> [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] public sealed class NotNullAttribute : Attribute { } /// <summary> /// This attribute marks a parameter whose type is an array that is not allowed to have null items. /// It is used by the method binding infrastructure to generate better error /// messages and method selection. /// </summary> [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] public sealed class NotNullItemsAttribute : Attribute { } }
{ "content_hash": "634fcb6d9b611a7d71fb886d4ef717c3", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 103, "avg_line_length": 40.95238095238095, "alnum_prop": 0.7058139534883721, "repo_name": "IronLanguages/dlr", "id": "9401b741149cce947a49b8767fd8804824233970", "size": "1071", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Src/Microsoft.Scripting/Runtime/NotNullAttribute.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "716" }, { "name": "C", "bytes": "2637" }, { "name": "C#", "bytes": "3842719" }, { "name": "C++", "bytes": "105271" }, { "name": "PowerShell", "bytes": "7513" }, { "name": "Visual Basic .NET", "bytes": "8443" } ], "symlink_target": "" }
#include <unistd.h> #include <stdio.h> #include <signal.h> #include <upm_utilities.h> #include <guvas12d.h> bool shouldRun = true; // analog voltage, usually 3.3 or 5.0 #define GUVAS12D_AREF 5.0 void sig_handler(int signo) { if (signo == SIGINT) shouldRun = false; } int main() { signal(SIGINT, sig_handler); //! [Interesting] // This was tested with the Grove UV Sensor module. // It has a sensing range from between 240-370nm. It's strongest // response is around 320-360nm. // Instantiate a GUVAS12D on analog pin A0 guvas12d_context uv = guvas12d_init(0, GUVAS12D_AREF); if (!uv) { printf("guvas12d_init() failed\n"); return 1; } // The higher the voltage the more intense the UV radiation. while (shouldRun) { float volts = 0; float intensity = 0; if (guvas12d_get_volts(uv, &volts)) { printf("guvas12d_get_volts() failed\n"); return 1; } if (guvas12d_get_intensity(uv, &intensity)) { printf("guvas12d_get_intensity() failed\n"); return 1; } printf("Volts: %f, Intensity %f mW/m^2\n", volts, intensity); upm_delay(1); } printf("Exiting\n"); guvas12d_close(uv); //! [Interesting] return 0; }
{ "content_hash": "ba9039bacd5637299fb3c99b479d0c9b", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 69, "avg_line_length": 19.940298507462686, "alnum_prop": 0.5763473053892215, "repo_name": "g-vidal/upm", "id": "9c984f43395294c93548ecf303d2ae7e8178e51b", "size": "2503", "binary": false, "copies": "11", "ref": "refs/heads/master", "path": "examples/c/guvas12d.c", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "3305722" }, { "name": "C++", "bytes": "3740016" }, { "name": "CMake", "bytes": "160214" }, { "name": "CSS", "bytes": "18714" }, { "name": "HTML", "bytes": "32376" }, { "name": "JavaScript", "bytes": "7727" }, { "name": "Objective-C", "bytes": "4075" }, { "name": "Python", "bytes": "39715" }, { "name": "Shell", "bytes": "10703" } ], "symlink_target": "" }
<html> <head> <title>Samling</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="public/css/bootstrap.css" rel="stylesheet"> <link href="public/css/samling.css" rel="stylesheet"> <script src="public/js/jquery.min.js"></script> <script src="public/js/bootstrap.min.js"></script> <script src="public/forge.bundle.js"></script> <script src="public/bundle.js"></script> <link rel="icon" type="image/png" href="public/images/logos-scorpion-48.png"> </head> <body> <nav class="navbar navbar-static-top samling-navbar"> <div class="container-fluid"> <span class="navbar-header "> <img class="samling-brand-logo" src="https://capriza.github.io/images/logos/logos-scorpion.svg" > <span class="samling-brand">SAMLING <span class="samling-brand-subtitle">Serverless SAML IDP</span></span> </span> </div> </nav> <nav class="navbar navbar-left"> <div class="container-fluid"> <ul class="nav nav-pills nav-stacked samling-nav-pills" id="navbarSamling" role="tablist"> <li role="presentation" class="active"> <a class="samling-nav-item" href="#samlPropertiesTab" aria-controls="samlPropertiesTab" role="tab" data-toggle="pill">SAML Response Properties</a></li> <li role="presentation" class=""> <a class="samling-nav-item" href="#samlResponseTab" aria-controls="samlResponseTab" role="tab" data-toggle="pill">SAML Response</a></li> <li role="presentation" class=""> <a class="samling-nav-item" href="#userDetailsTab" aria-controls="userDetailsTab" role="tab" data-toggle="pill">User Details</a></li> <li role="presentation" class=""> <a class="samling-nav-item" href="#showMetadata" aria-controls="showMetadata" role="tab" data-toggle="pill">IdP Metadata</a></li> <li role="presentation" class=""> <a class="samling-nav-item" href="#whatsThisTab" aria-controls="whatsThisTab" role="tab" data-toggle="pill">What is this?</a></li> </ul> </div> </nav> <div class="col-md-7 col-md-offset-1"> <!-- Tab panes --> <div class="tab-content"> <div role="tabpanel" class="tab-pane samling-tab active" id="samlPropertiesTab"> <div class="row"> <div class="col-md-9"> <form id="samlProps"> <div class="row"> <div class="col-md-12"> <button id="createResponse" type="button" class="btn btn-lg pull-right">Next > </button> </div> </div> <div class="form-group" id="nameIdentifierControl"> <label class="control-label" for="nameIdentifier">Name Identifier *</label> <input type="text" class="form-control" id="nameIdentifier"> </div> <div class="form-group" id="callbackUrlControl"> <label class="control-label" for="callbackUrl">Assertion Consumer URL (Recipient) *</label> <input type="text" class="form-control" id="callbackUrl"> </div> <div class="form-group"> <label class="control-label" for="nameIdentifierFormat">Name Identifier Format</label> <input type="text" class="form-control" id="nameIdentifierFormat" value="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"> </div> <div class="form-group"> <label class="control-label" for="authnContextClassRef">Authentication Context Class Ref</label> <input type="text" class="form-control" id="authnContextClassRef" value="urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"> </div> <div class="form-group"> <label class="control-label" for="inResponseTo">In Reponse To</label> <input type="text" class="form-control" id="inResponseTo" value=""> </div> <div class="form-group"> <label class="control-label" for="audience">Audience</label> <input type="text" class="form-control" id="audience" value=""> </div> <div class="form-group"> <label class="control-label" for="issuer">Issuer</label> <input type="text" class="form-control" id="issuer" value="https://capriza.github.io/samling/samling.html"> </div> <div class="form-group"> <label class="control-label" for="samlStatusCode">SAML Status Code</label> <input type="text" class="form-control" id="samlStatusCode" value="urn:oasis:names:tc:SAML:2.0:status:Success"> </div> <div class="form-group"> <label class="control-label" for="lifetimeInSeconds">Assertion Lifetime (seconds)</label> <input type="text" class="form-control" id="lifetimeInSeconds" value="600"> </div> <div class="form-group"> <label class="control-label" for="samlStatusMessage">SAML Status Message</label> <input type="text" class="form-control" id="samlStatusMessage"> </div> <div class="form-group"> <label class="control-label" for="samlAttributes">SAML Attributes</label> <small class="form-text text-muted">place each attribute on a separate line</small> <textarea class="form-control" rows="3" id="samlAttributes" placeholder="attr1=value1&#10;attr2=value2"></textarea> </div> <div class="row"> <div class="col-md-12"> <div class="form-check" id="signResponseControl"> <input type="checkbox" class="form-check-input" id="signResponse"> <label class="form-check-label" for="signResponse">Sign Response (in addition to the assertion)</label> </div> </div> </div> <div class="row"> <div class="form-group col-md-6" id="signatureKeyControl"> <label class="control-label" for="signatureKey"> Signature Private Key * </label> <button id="saveKeyAndCert" type="button" class="btn btn-default btn-xs pull-right"> Save </button> <button id="generateKeyAndCert" type="button" class="btn btn-default btn-xs pull-right"> New Pair </button> <textarea class="form-control" rows="14" id="signatureKey" style="font-size: 8px; font-family: monospace; resize: none"></textarea> </div> <div class="form-group col-md-6" id="signatureCertControl"> <label class="control-label" for="signatureCert">Signature Certificate *</label> <textarea class="form-control" rows="14" id="signatureCert" style="font-size: 8px; font-family: monospace; resize: none"></textarea> </div> </div> </form> </div> <div class="col-md-3 samling-sidebar" id="samlPropertiesHelp"> <div class="sidebar-module"> <dl> <dt>Name Identifier</dt> <dd>The user name that will appear in the assertion as logged-in.</dd> <dt>Assertion Consumer URL</dt> <dd>The assertion consumer URL where the SAML Response will be posted back to.</dd> <dt>Sign Response</dt> <dd>If checked, the SAML response will be signed in addition to the assertion.</dd> <dt>Signature Private Key</dt> <dd>The private key that will be used to sign the SAML assertion.</dd> <dt>Signature Certificate</dt> <dd>The Signature certificate to embed into the SAML response to be used by the Service Provider for verifying the signature. </dd> <dt>New Pair</dt> <dd>Generate a new random private/public key pair.</dd> <dt>Save</dt> <dd>Save the private key and certificate to the local storage.</dd> <dt>Next</dt> <dd>Create the SAML Response based on the provided properties. You will be transferred to the <b>SAML Response</b> section. </dd> </dl> </div> </div> </div> </div> <div role="tabpanel" class="tab-pane samling-tab" id="samlResponseTab"> <div class="row"> <div class="col-md-9" role="main"> <form method="POST" id="samlResponseForm"> <div class="row"> <div class="col-md-12"> <button class="btn btn-lg pull-right" type="submit" id="postSAMLResponse">Post Response! </button> </div> </div> <div class="row"> <div class="form-group col-md-12" id="samlResponseControl"> <div class="row"> <div class="col-md-4"> <div class="form-group" id="sessionDurationControl"> <label class="control-label" for="sessionDuration">Session Duration *</label> <input type="text" class="form-control" id="sessionDuration" value="10"> </div> </div> <div class="col-md-8"> <div class="form-group" id="callbackUrlReadOnlyControl"> <label class="control-label" for="callbackUrlReadOnly">Assertion Consumer URL</label> <input type="text" class="form-control" id="callbackUrlReadOnly"> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group" id="relayStateControl"> <label class="control-label" for="relayState">RelayState</label> <input type="text" class="form-control" name="RelayState" id="relayState"> </div> </div> </div> <label class="control-label" for="samlResponse"> SAML Response * </label> <button id="copyResponseToClipboard" type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="Copied" data-trigger="manual" data-placement="top"> Copy to Clipboard </button> <textarea class="form-control" rows="28" name="SAMLResponse" id="samlResponse" style="font-size: 12px; font-family: monospace; resize: none;overflow: auto"></textarea> </div> </div> </form> </div> <div class="col-md-3 samling-sidebar"> <div class="sidebar-module"> <dl> <dt>SAML Response</dt> <dd>This is the saml response the will be posted to the <b>Assertion Consumer URL</b>.</dd> <dt>Copy to Clipboard</dt> <dd>Copy the SAML response XML to the clipboard.</dd> <dt>Session Duration</dt> <dd>The session duration in minutes. Specify "0" to create a session based cookie which means that the cookie will expire after closing the browser tab. </dd> <dt>Assertion Consumer URL</dt> <dd>(readonly) The consumer URL where the SAML Response will be posted.</dd> <dt>RelayState</dt> <dd>The RelayState parameter that will posted back to the Assertion Consumer URL along with the SAML response.</dd> </dl> </div> </div> </div> </div> <div role="tabpanel" class="tab-pane samling-tab" id="userDetailsTab"> <div class="row"> <div class="col-md-9" role="main"> <div class=""> <h2 id="signedInUser"></h2> <h5>You have signed in at: <b id="signedInAt">You have not signed in yet.</b></h5> <div style="margin-top: 32px;"> <a class="btn btn-default" href="#" role="button" id="signedInLogout">Logout</a> </div> </div> </div> <div class="col-md-3 samling-sidebar"> <div class="sidebar-module"> <p>The currently logged in user details. A user is considered <i>logged-in</i> if there is a cookie present that was previously created in the <b>SAML Response</b> section by clicking on <b>Post Response</b>. </p> <dl> <dt>Logout</dt> <dd>Log the user out, erasing the cookie.</dd> </dl> </div> </div> </div> </div> <div role="tabpanel" class="tab-pane samling-tab" id="showMetadata"> <div class="row"> <div class="col-md-9" role="main"> <h2>SAMLING IdP Metadata</h2> <p> <pre id="idpMetadata" style="text-overflow: auto"></pre> </p> <p> <a class="btn btn-primary pull-right" href="#" role="button" id="copyMetadata" data-toggle="tooltip" title="Copied" data-trigger="manual" data-placement="top">Copy Metadata</a> </p> </div> </div> </div> <div role="tabpanel" class="tab-pane samling-tab" id="whatsThisTab"> <div class="row"> <div class="col-md-9" role="main"> <section> <h2>What is SAMLING</h2> <p>SAMLING is a Serverless (as-in client side only) SAML IdP for the purpose of testing SAML integrations.</p> <p>It provides complete control over the SAML response properties that will be sent back to the Service Provider, including simulating errors and the session cookie duration that tracks the logged-in user.</p> <p>If there is a <strong>SAMLRequest</strong> query parameter present, SAMLING will auto populate some of the SAML Response Properties.</p> <p>Generating a SAML Response requires the use of a private key and certificate for signing the SAML Assertion. SAMLING enables to generate a random private/public key and to save them in the local storage so they are used in subsequent SAML responses.</p> </section> <section> <h2>How to Use</h2> <ol> <li>Go to the <strong>SAML Response Properties</strong> section.</li> <li>Fill in the required properties fields. Required fields are marked with an asterisks (*).</li> <li>Click on <strong>Create Response</strong>. You will be be taken the <strong>SAML Response</strong> section.</li> <li>Review the SAML Response then click on <strong>Post Response</strong>.</li> </ol> </section> </div> <div class="col-md-3 samling-sidebar"> <div class="sidebar-module"> </div> </div> </div> </div> </div> </div> </div> </body> </html>
{ "content_hash": "ab851660a269be1703c93e7f8a78088e", "timestamp": "", "source": "github", "line_count": 322, "max_line_length": 178, "avg_line_length": 49.06832298136646, "alnum_prop": 0.5401898734177215, "repo_name": "capriza/samling", "id": "e1160f0a7988764a3438e83450455672b96fd536", "size": "15800", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "samling.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1456" }, { "name": "Dockerfile", "bytes": "380" }, { "name": "HTML", "bytes": "15800" }, { "name": "JavaScript", "bytes": "2524040" }, { "name": "Smarty", "bytes": "1653" } ], "symlink_target": "" }
package com.xjy.op.service; import com.xjy.op.dao.SlideDao; import com.xjy.op.dto.SlideDto; import com.xjy.op.dto.SlidePartDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class SlideService { @Autowired private SlideDao slideDao; public SlideDto getSlideByFileId(int fileId) { return slideDao.getSlideByFileId(fileId); } public int createSlide(String name, int spaceId) { return slideDao.createSlide(name, spaceId); } public void saveSlidePart(SlidePartDto slidePartDto) { slideDao.saveSlidePart(slidePartDto); } public int createSlidePart(int slideId) { return slideDao.insertSlidePart(slideId,""); } }
{ "content_hash": "d95aef1ec0daea7accf3aed231ad1ed2", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 62, "avg_line_length": 26.533333333333335, "alnum_prop": 0.7035175879396985, "repo_name": "xjyaikj/OnlinePreparation", "id": "65ca8c21eab0c25a5205e196a416677489a1b09e", "size": "796", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/main/java/com/xjy/op/service/SlideService.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "390093" }, { "name": "HTML", "bytes": "47057" }, { "name": "Java", "bytes": "205521" }, { "name": "JavaScript", "bytes": "1981787" } ], "symlink_target": "" }
<?php namespace Nietonfir\Google\ReCaptcha; use Nietonfir\Google\ReCaptcha\Api\RequestDataInterface; interface ReCaptchaInterface { /** * Perform the reCAPTCHA validation with the supplied request data * and return a response object for further processing. * * @param RequestDataInterface $requestData * @return ResponseInterface */ public function processRequest(RequestDataInterface $requestData); /** * Just return the provided response object. If the request was already * processed it will contain the necessary data from the API. * * @deprecated 0.1.0 * * @return ResponseInterface */ public function getResponse(); }
{ "content_hash": "de2826197060f4fd8aa01958a032d202", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 75, "avg_line_length": 26.296296296296298, "alnum_prop": 0.6985915492957746, "repo_name": "nietonfir/GoogleReCaptcha", "id": "9bebe31fefb8d236f15a7bbaec4ce582c3e426b2", "size": "710", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/ReCaptchaInterface.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "25382" } ], "symlink_target": "" }
package reactor.rabbitmq; /** * */ public class ReactorRabbitMqException extends RuntimeException { public ReactorRabbitMqException() { } public ReactorRabbitMqException(String message) { super(message); } public ReactorRabbitMqException(String message, Throwable cause) { super(message, cause); } public ReactorRabbitMqException(Throwable cause) { super(cause); } public ReactorRabbitMqException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
{ "content_hash": "84a3d998266c22f7f8115e6bc32c92aa", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 125, "avg_line_length": 22.678571428571427, "alnum_prop": 0.710236220472441, "repo_name": "mailtous/reactor-rabbitmq", "id": "4e9fc4a441f221be0b74be132c1a70faed8809d6", "size": "1266", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/reactor/rabbitmq/ReactorRabbitMqException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "39025" } ], "symlink_target": "" }
from wires import * from models.post import Post from models.user import User from models.comment import Comment from pdb import set_trace as debug def index(parameters): template = open('./templates/posts/index.html').read() posts = Post.all(Post.cxn, "posts") post_template = open('./templates/posts/show.html').read() rendered_posts = "<br><br>".join([TemplateEngine(post_template, definitions(post, {"id": post.id, "comments_link": '<p><a href="/posts/{0}#comments">{1} comments</a></p>'.format(post.id, len(post.comments(globals())))})).render_partial() for post in posts]) index_definitions = {"number_of_pages": str(parameters["number_of_pages"]), "rendered_posts": rendered_posts} index_definitions["login_status_message"] = login_status_message(parameters) return TemplateEngine(template, index_definitions).render() def show(parameters): post = Post.find(Post.cxn, "posts", parameters["id"]) template = open('./templates/posts/show.html').read() comment_template = open('./templates/comments/show.html').read() show_post_script_tag = '<script src="/show_post.js"></script>' comments = post.comments(globals()) if comments: rendered_comments = "<h3>Comments</h3>" + "".join([TemplateEngine(comment_template, comment.attributes).render_partial() for comment in comments]) else: rendered_comments = '<p id="no_comments">No comments yet.</p>' new_comment_link_html = '<a id="new_comment_link" href="#">Make a new comment!</a>' parameters.update({"rendered_comments": rendered_comments, "new_comment_link": new_comment_link_html, "show_post_script_tag": show_post_script_tag}) return TemplateEngine(template, definitions(post, parameters)).render() def new(parameters): template = open('./templates/posts/new.html').read() return TemplateEngine(template, parameters).render() def create(parameters): parameters["body"] = parameters["body"].replace("\n", "<br>") user = current_user(parameters) if user: parameters.update({"author_id": user.id}) new_post = Post(Post.cxn, "posts", parameters) new_post.save() parameters.update({"id": str(new_post.id)}) return show(parameters) else: page = "<html><head></head><body><h2>{0}</h2>{1}</body></html>".format("You must be logged in to submit a new post", "<a href='/'><em>(home)</em></a>") return page # helper method for construction substitution definitions from supplied # object and request parameters def definitions(post, parameters): defns_dict = dict(list(parameters.items()) + list(post.attributes.items())) defns_dict["author_display_name"] = post.author(globals()).display_name defns_dict["author_id"] = post.author(globals()).id return {key: str(defns_dict[key]) for key in defns_dict} def current_user(parameters): if "session_token" in parameters: user = User.find_where(User.cxn, "users", {"session_token": parameters["session_token"]}) return user else: return None def login_status_message(parameters): user = current_user(parameters) if user: return "logged in as {0} ({1})".format(user.display_name, user.username) return "not logged in"
{ "content_hash": "0cf7837dd7205daccc950dd69cad7bb5", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 261, "avg_line_length": 47.80882352941177, "alnum_prop": 0.6748692709935404, "repo_name": "zackmdavis/Wires", "id": "d6510d865568a586caac0046dd29735e2680f74f", "size": "3251", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "blog_engine/controllers/posts_controller.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "105" }, { "name": "JavaScript", "bytes": "1940" }, { "name": "Python", "bytes": "31048" }, { "name": "Shell", "bytes": "291" } ], "symlink_target": "" }
package com.helion3.prism.configuration; import com.helion3.prism.configuration.category.DefaultCategory; import com.helion3.prism.configuration.category.EventCategory; import com.helion3.prism.configuration.category.GeneralCategory; import com.helion3.prism.configuration.category.LimitCategory; import com.helion3.prism.configuration.category.StorageCategory; import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class Config { @Setting(value = "default") private DefaultCategory defaultCategory = new DefaultCategory(); @Setting(value = "event") private EventCategory eventCategory = new EventCategory(); @Setting(value = "general") private GeneralCategory generalCategory = new GeneralCategory(); @Setting(value = "limit") private LimitCategory limitCategory = new LimitCategory(); @Setting(value = "storage") private StorageCategory storageCategory = new StorageCategory(); public DefaultCategory getDefaultCategory() { return defaultCategory; } public EventCategory getEventCategory() { return eventCategory; } public GeneralCategory getGeneralCategory() { return generalCategory; } public LimitCategory getLimitCategory() { return limitCategory; } public StorageCategory getStorageCategory() { return storageCategory; } }
{ "content_hash": "46b0ad9c5d0e6edbc0a367339f7a2799", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 76, "avg_line_length": 29.38, "alnum_prop": 0.7562968005445881, "repo_name": "prism/Prism", "id": "dfbec9220a2f807fc5c78595cf9592cf0064a70c", "size": "2672", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/main/java/com/helion3/prism/configuration/Config.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "399021" }, { "name": "Shell", "bytes": "33" } ], "symlink_target": "" }
#import "RCTImageDownloader.h" #import "RCTImageLoader.h" #import "RCTImageUtils.h" #import "RCTLog.h" #import "RCTNetworking.h" #import "RCTUtils.h" @implementation RCTImageDownloader { NSURLCache *_cache; dispatch_queue_t _processingQueue; } @synthesize bridge = _bridge; RCT_EXPORT_MODULE() - (instancetype)init { if ((self = [super init])) { _cache = [[NSURLCache alloc] initWithMemoryCapacity:5 * 1024 * 1024 diskCapacity:200 * 1024 * 1024 diskPath:@"React/RCTImageDownloader"]; _processingQueue = dispatch_queue_create("com.facebook.React.DownloadProcessingQueue", DISPATCH_QUEUE_SERIAL); } return self; } - (BOOL)canLoadImageURL:(NSURL *)requestURL { // Have to exclude 'file://' from the main bundle, otherwise this would conflict with RCTAssetBundleImageLoader return [requestURL.scheme compare:@"http" options:NSCaseInsensitiveSearch range:NSMakeRange(0, 4)] == NSOrderedSame || ([requestURL.scheme caseInsensitiveCompare:@"file"] == NSOrderedSame && ![requestURL.path hasPrefix:[NSBundle mainBundle].resourcePath]) || [requestURL.scheme caseInsensitiveCompare:@"data"] == NSOrderedSame; } /** * Downloads a block of raw data and returns it. Note that the callback block * will not be executed on the same thread you called the method from, nor on * the main thread. Returns a token that can be used to cancel the download. */ - (RCTImageLoaderCancellationBlock)downloadDataForURL:(NSURL *)url progressHandler:(RCTImageLoaderProgressBlock)progressBlock completionHandler:(RCTImageLoaderCompletionBlock)completionBlock { if (![_bridge respondsToSelector:NSSelectorFromString(@"networking")]) { RCTLogError(@"You need to import the RCTNetworking library in order to download remote images."); return ^{}; } __weak RCTImageDownloader *weakSelf = self; RCTURLRequestCompletionBlock runBlocks = ^(NSURLResponse *response, NSData *data, NSError *error) { if (!error && [response isKindOfClass:[NSHTTPURLResponse class]]) { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; if (httpResponse.statusCode != 200) { data = nil; error = [[NSError alloc] initWithDomain:NSURLErrorDomain code:httpResponse.statusCode userInfo:nil]; } } dispatch_async(_processingQueue, ^{ completionBlock(error, data); }); }; NSURLRequest *request = [NSURLRequest requestWithURL:url]; { NSCachedURLResponse *cachedResponse = [_cache cachedResponseForRequest:request]; if (cachedResponse) { runBlocks(cachedResponse.response, cachedResponse.data, nil); return ^{}; } } RCTDownloadTask *task = [_bridge.networking downloadTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) { if (response && !error) { RCTImageDownloader *strongSelf = weakSelf; NSCachedURLResponse *cachedResponse = [[NSCachedURLResponse alloc] initWithResponse:response data:data userInfo:nil storagePolicy:NSURLCacheStorageAllowed]; [strongSelf->_cache storeCachedResponse:cachedResponse forRequest:request]; } runBlocks(response, data, error); }]; if (progressBlock) { task.downloadProgressBlock = progressBlock; } return ^{ [task cancel]; }; } - (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL size:(CGSize)size scale:(CGFloat)scale resizeMode:(UIViewContentMode)resizeMode progressHandler:(RCTImageLoaderProgressBlock)progressHandler completionHandler:(RCTImageLoaderCompletionBlock)completionHandler { if ([imageURL.scheme.lowercaseString hasPrefix:@"http"]) { __block RCTImageLoaderCancellationBlock decodeCancel = nil; __weak RCTImageDownloader *weakSelf = self; RCTImageLoaderCancellationBlock downloadCancel = [self downloadDataForURL:imageURL progressHandler:progressHandler completionHandler:^(NSError *error, NSData *imageData) { if (error) { completionHandler(error, nil); } else { decodeCancel = [weakSelf.bridge.imageLoader decodeImageData:imageData size:size scale:scale resizeMode:resizeMode completionBlock:completionHandler]; } }]; return ^{ downloadCancel(); if (decodeCancel) { decodeCancel(); } }; } else if ([imageURL.scheme caseInsensitiveCompare:@"data"] == NSOrderedSame) { __block BOOL cancelled = NO; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ if (cancelled) { return; } // Normally -dataWithContentsOfURL: would be bad but this is a data URL. NSData *data = [NSData dataWithContentsOfURL:imageURL]; UIImage *image = [UIImage imageWithData:data]; if (image) { if (progressHandler) { progressHandler(1, 1); } if (completionHandler) { completionHandler(nil, image); } } else { if (completionHandler) { NSString *message = [NSString stringWithFormat:@"Invalid image data for URL: %@", imageURL]; completionHandler(RCTErrorWithMessage(message), nil); } } }); return ^{ cancelled = YES; }; } else if ([imageURL.scheme isEqualToString:@"file"]) { __block BOOL cancelled = NO; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ if (cancelled) { return; } UIImage *image = [UIImage imageWithContentsOfFile:imageURL.resourceSpecifier]; if (image) { if (progressHandler) { progressHandler(1, 1); } if (completionHandler) { completionHandler(nil, image); } } else { if (completionHandler) { NSString *message = [NSString stringWithFormat:@"Could not find image at path: %@", imageURL.absoluteString]; completionHandler(RCTErrorWithMessage(message), nil); } } }); return ^{ cancelled = YES; }; } else { RCTLogError(@"Unexpected image schema %@", imageURL.scheme); return ^{}; } } @end @implementation RCTBridge (RCTImageDownloader) - (RCTImageDownloader *)imageDownloader { return self.modules[RCTBridgeModuleNameForClass([RCTImageDownloader class])]; } @end
{ "content_hash": "e2fbd837ab9204020504a3b6e8e586e9", "timestamp": "", "source": "github", "line_count": 188, "max_line_length": 175, "avg_line_length": 34.920212765957444, "alnum_prop": 0.6591012947448591, "repo_name": "yimouleng/react-native", "id": "f110bd628cdb0e99fdcf15e0ffe09fc799ea4aa8", "size": "6873", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "Libraries/Image/RCTImageDownloader.m", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "1171" }, { "name": "Awk", "bytes": "121" }, { "name": "C", "bytes": "34523" }, { "name": "CSS", "bytes": "15408" }, { "name": "HTML", "bytes": "5392" }, { "name": "JavaScript", "bytes": "1075224" }, { "name": "Makefile", "bytes": "3066" }, { "name": "Objective-C", "bytes": "977150" }, { "name": "Objective-C++", "bytes": "4271" }, { "name": "Ruby", "bytes": "4153" }, { "name": "Shell", "bytes": "5762" } ], "symlink_target": "" }
from django.db.backends import BaseDatabaseIntrospection import pyodbc as Database SQL_AUTOFIELD = -777555 class DatabaseIntrospection(BaseDatabaseIntrospection): # Map type codes to Django Field types. data_types_reverse = { SQL_AUTOFIELD: 'AutoField', Database.SQL_BIGINT: 'IntegerField', #Database.SQL_BINARY: , Database.SQL_BIT: 'BooleanField', Database.SQL_CHAR: 'CharField', Database.SQL_DECIMAL: 'DecimalField', Database.SQL_DOUBLE: 'FloatField', Database.SQL_FLOAT: 'FloatField', Database.SQL_GUID: 'TextField', Database.SQL_INTEGER: 'IntegerField', #Database.SQL_LONGVARBINARY: , #Database.SQL_LONGVARCHAR: , Database.SQL_NUMERIC: 'DecimalField', Database.SQL_REAL: 'FloatField', Database.SQL_SMALLINT: 'SmallIntegerField', Database.SQL_TINYINT: 'SmallIntegerField', Database.SQL_TYPE_DATE: 'DateField', Database.SQL_TYPE_TIME: 'TimeField', Database.SQL_TYPE_TIMESTAMP: 'DateTimeField', #Database.SQL_VARBINARY: , Database.SQL_VARCHAR: 'TextField', Database.SQL_WCHAR: 'CharField', Database.SQL_WLONGVARCHAR: 'TextField', Database.SQL_WVARCHAR: 'TextField', } def get_table_list(self, cursor): """ Returns a list of table names in the current database. """ # TABLES: http://msdn2.microsoft.com/en-us/library/ms186224.aspx cursor.execute("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'") return [row[0] for row in cursor.fetchall()] # Or pyodbc specific: #return [row[2] for row in cursor.tables(tableType='TABLE')] def _is_auto_field(self, cursor, table_name, column_name): """ Checks whether column is Identity """ # COLUMNPROPERTY: http://msdn2.microsoft.com/en-us/library/ms174968.aspx #from django.db import connection #cursor.execute("SELECT COLUMNPROPERTY(OBJECT_ID(%s), %s, 'IsIdentity')", # (connection.ops.quote_name(table_name), column_name)) cursor.execute("SELECT COLUMNPROPERTY(OBJECT_ID(%s), %s, 'IsIdentity')", (self.connection.ops.quote_name(table_name), column_name)) return cursor.fetchall()[0][0] def get_table_description(self, cursor, table_name, identity_check=True): """Returns a description of the table, with DB-API cursor.description interface. The 'auto_check' parameter has been added to the function argspec. If set to True, the function will check each of the table's fields for the IDENTITY property (the IDENTITY property is the MSSQL equivalent to an AutoField). When a field is found with an IDENTITY property, it is given a custom field number of SQL_AUTOFIELD, which maps to the 'AutoField' value in the DATA_TYPES_REVERSE dict. """ # map pyodbc's cursor.columns to db-api cursor description columns = [[c[3], c[4], None, c[6], c[6], c[8], c[10]] for c in cursor.columns(table=table_name)] items = [] for column in columns: if identity_check and self._is_auto_field(cursor, table_name, column[0]): column[1] = SQL_AUTOFIELD if column[1] == Database.SQL_WVARCHAR and column[3] < 4000: column[1] = Database.SQL_WCHAR items.append(column) return items def _name_to_index(self, cursor, table_name): """ Returns a dictionary of {field_name: field_index} for the given table. Indexes are 0-based. """ return dict([(d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name, identity_check=False))]) def get_relations(self, cursor, table_name): """ Returns a dictionary of {field_index: (field_index_other_table, other_table)} representing all relationships to the given table. Indexes are 0-based. """ # CONSTRAINT_COLUMN_USAGE: http://msdn2.microsoft.com/en-us/library/ms174431.aspx # CONSTRAINT_TABLE_USAGE: http://msdn2.microsoft.com/en-us/library/ms179883.aspx # REFERENTIAL_CONSTRAINTS: http://msdn2.microsoft.com/en-us/library/ms179987.aspx # TABLE_CONSTRAINTS: http://msdn2.microsoft.com/en-us/library/ms181757.aspx table_index = self._name_to_index(cursor, table_name) sql = """ SELECT e.COLUMN_NAME AS column_name, c.TABLE_NAME AS referenced_table_name, d.COLUMN_NAME AS referenced_column_name FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS a INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS b ON a.CONSTRAINT_NAME = b.CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE AS c ON b.UNIQUE_CONSTRAINT_NAME = c.CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS d ON c.CONSTRAINT_NAME = d.CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS e ON a.CONSTRAINT_NAME = e.CONSTRAINT_NAME WHERE a.TABLE_NAME = %s AND a.CONSTRAINT_TYPE = 'FOREIGN KEY'""" cursor.execute(sql, (table_name,)) return dict([(table_index[item[0]], (self._name_to_index(cursor, item[1])[item[2]], item[1])) for item in cursor.fetchall()]) def get_indexes(self, cursor, table_name): """ Returns a dictionary of fieldname -> infodict for the given table, where each infodict is in the format: {'primary_key': boolean representing whether it's the primary key, 'unique': boolean representing whether it's a unique index, 'db_index': boolean representing whether it's a non-unique index} """ # CONSTRAINT_COLUMN_USAGE: http://msdn2.microsoft.com/en-us/library/ms174431.aspx # TABLE_CONSTRAINTS: http://msdn2.microsoft.com/en-us/library/ms181757.aspx pk_uk_sql = """ SELECT b.COLUMN_NAME, a.CONSTRAINT_TYPE FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS a INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS b ON a.CONSTRAINT_NAME = b.CONSTRAINT_NAME AND a.TABLE_NAME = b.TABLE_NAME WHERE a.TABLE_NAME = %s AND (CONSTRAINT_TYPE = 'PRIMARY KEY' OR CONSTRAINT_TYPE = 'UNIQUE')""" field_names = [item[0] for item in self.get_table_description(cursor, table_name, identity_check=False)] indexes, results = {}, {} cursor.execute(pk_uk_sql, (table_name,)) data = cursor.fetchall() if data: results.update(data) # non-unique, non-compound indexes, only in SS2005? ix_sql = """ SELECT DISTINCT c.name FROM sys.columns c INNER JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id INNER JOIN sys.indexes ix ON ix.object_id = ic.object_id AND ix.index_id = ic.index_id INNER JOIN sys.tables t ON t.object_id = ix.object_id WHERE ix.object_id IN ( SELECT ix.object_id FROM sys.indexes ix GROUP BY ix.object_id, ix.index_id HAVING count(1) = 1) AND ix.is_primary_key = 0 AND ix.is_unique_constraint = 0 AND t.name = %s""" if self.connection.ops.sql_server_ver >= 2005: cursor.execute(ix_sql, (table_name,)) for column in [r[0] for r in cursor.fetchall()]: if column not in results: results[column] = 'IX' for field in field_names: val = results.get(field, None) indexes[field] = dict(primary_key=(val=='PRIMARY KEY'), unique=(val=='UNIQUE'), db_index=(val=='IX')) return indexes #def get_collations_list(self, cursor): # """ # Returns list of available collations and theirs descriptions. # """ # # http://msdn2.microsoft.com/en-us/library/ms184391.aspx # # http://msdn2.microsoft.com/en-us/library/ms179886.aspx # # cursor.execute("SELECT name, description FROM ::fn_helpcollations()") # return [tuple(row) for row in cursor.fetchall()]
{ "content_hash": "b2622595ce33b48d92147e0efe70ffee", "timestamp": "", "source": "github", "line_count": 182, "max_line_length": 124, "avg_line_length": 45.26923076923077, "alnum_prop": 0.6302949387061536, "repo_name": "chuck211991/django-pyodbc", "id": "128a77cd44b2983e50b4ce0ab16790b9b73abfae", "size": "8239", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "sql_server/pyodbc/introspection.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "220331" }, { "name": "Shell", "bytes": "244" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <g:element xmlns:g="http://www.esri.com/geoportal/gxe" xmlns:h="http://www.esri.com/geoportal/gxe/html" g:extends="$base/schema/gco/xtn/Wrapped_BasicPropertyType.xml"> <g:body> <g:element g:minOccurs="1" g:maxOccurs="1" g:extends="$base/xtn/srv/maintenance/XTN_ScopeDescription.xml"/> </g:body> </g:element>
{ "content_hash": "80012000f5cc20635a1f803055b3f5e4", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 81, "avg_line_length": 43.55555555555556, "alnum_prop": 0.6377551020408163, "repo_name": "Esri/geoportal-server", "id": "7e6fa4f43918b3b35d13f61ed19a63fa2c9c6261", "size": "392", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "geoportal/src/gpt/gxe/iso/iso19139/profiles/inspire_V2.0/xtn/srv/maintenance/XTN_ScopeDescription_PropertyType.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "2507246" }, { "name": "Batchfile", "bytes": "43050" }, { "name": "C#", "bytes": "13257644" }, { "name": "CSS", "bytes": "130628" }, { "name": "HTML", "bytes": "120232" }, { "name": "Java", "bytes": "8401228" }, { "name": "JavaScript", "bytes": "2051512" }, { "name": "PLSQL", "bytes": "5969" }, { "name": "PowerShell", "bytes": "4839" }, { "name": "Shell", "bytes": "12665" }, { "name": "TSQL", "bytes": "12580" }, { "name": "XSLT", "bytes": "2278721" } ], "symlink_target": "" }
#import "MSGraphODataEntities.h" @implementation MSGraphUserOwnedObjectsCollectionWithReferencesRequestBuilder : MSCollectionRequestBuilder - (MSGraphUserOwnedObjectsCollectionWithReferencesRequest*) request { return [self requestWithOptions:nil]; } - (MSGraphUserOwnedObjectsCollectionWithReferencesRequest *)requestWithOptions:(NSArray *)options { return [[MSGraphUserOwnedObjectsCollectionWithReferencesRequest alloc] initWithURL:self.requestURL options:options client:self.client]; } - (MSGraphDirectoryObjectRequestBuilder *)directoryObject:(NSString *)directoryObject { return [[MSGraphDirectoryObjectRequestBuilder alloc] initWithURL:[self.requestURL URLByAppendingPathComponent:directoryObject] client:self.client]; } - (MSGraphUserOwnedObjectsCollectionReferencesRequestBuilder *) references { return [[MSGraphUserOwnedObjectsCollectionReferencesRequestBuilder alloc] initWithURL:[self.requestURL URLByAppendingPathComponent:@"$ref"] client:self.client]; } @end
{ "content_hash": "4b3ffefb10d63a13cd78dfad3b6d3ff2", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 164, "avg_line_length": 39.7037037037037, "alnum_prop": 0.7826492537313433, "repo_name": "shridharmalimca/Shridhar.github.io", "id": "aea37f3e0a06c29cb4ab29405eee3ef62f0b9b8c", "size": "1226", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "iOS/Components/MusicTransition/Pods/MSGraphSDK/MSGraphSDK/MSGraphCoreSDK/requests/MSGraphUserOwnedObjectsCollectionWithReferencesRequestBuilder.m", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "11" }, { "name": "Swift", "bytes": "46146" } ], "symlink_target": "" }
<?php namespace Database\Tester\Models; use Model; class Post extends Model { /** * @var string The database table used by the model. */ public $table = 'database_tester_posts'; /** * @var array Guarded fields */ protected $guarded = ['*']; /** * @var array Fillable fields */ protected $fillable = []; /** * @var array Relations */ public $belongsTo = [ 'author' => 'Database\Tester\Models\Author', ]; public $morphMany = [ 'event_log' => ['Database\Tester\Models\EventLog', 'name' => 'related', 'delete' => true, 'softDelete' => true], ]; public $morphOne = [ 'meta' => ['Database\Tester\Models\Meta', 'name' => 'taggable'], ]; } class NullablePost extends Post { use \October\Rain\Database\Traits\Nullable; /** * @var array Guarded fields */ protected $guarded = []; /** * @var array List of attributes to nullify */ protected $nullable = [ 'author_nickname', ]; } class SluggablePost extends Post { use \October\Rain\Database\Traits\Sluggable; /** * @var array Guarded fields */ protected $guarded = []; /** * @var array List of attributes to automatically generate unique URL names (slugs) for. */ protected $slugs = [ 'slug' => 'title', 'long_slug' => ['title', 'description'] ]; } class RevisionablePost extends Post { use \October\Rain\Database\Traits\Revisionable; use \October\Rain\Database\Traits\SoftDelete; /** * @var array Guarded fields */ protected $guarded = []; /** * @var array Dates */ protected $dates = ['published_at', 'deleted_at']; /** * @var array Monitor these attributes for changes. */ protected $revisionable = [ 'title', 'slug', 'description', 'is_published', 'published_at', 'deleted_at' ]; /** * @var int Maximum number of revision records to keep. */ public $revisionableLimit = 8; /** * @var array Relations */ public $morphMany = [ 'revision_history' => ['System\Models\Revision', 'name' => 'revisionable'] ]; /** * The user who made the revision. */ public function getRevisionableUser() { return 7; } }
{ "content_hash": "9af8e76b05f5c92c59c5b7a233306eb8", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 120, "avg_line_length": 19.274193548387096, "alnum_prop": 0.5497907949790795, "repo_name": "wintersunsunsun/yamada", "id": "f583f303ff5c260f27c6a47aaa7d8860a72e23c2", "size": "2390", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/fixtures/plugins/database/tester/models/Post.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "74305" }, { "name": "HTML", "bytes": "215216" }, { "name": "JavaScript", "bytes": "160018" }, { "name": "PHP", "bytes": "1043128" }, { "name": "Smarty", "bytes": "8578" } ], "symlink_target": "" }
class Mysql # :nodoc: all class Result # :nodoc: all def blank? 0 == num_rows end alias_method :next, :fetch_row def each_row each do |row| yield(row, 0) end end def first_value val = fetch_row[0] free return val end alias_method :close, :free def fields fetch_fields.collect { |f| f.name } end end end
{ "content_hash": "cb03856f41136e664dd33fa15bef1758", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 39, "avg_line_length": 12.620689655172415, "alnum_prop": 0.5901639344262295, "repo_name": "oxywtf/og", "id": "8331f99060d2a55b05eb8e2f4ed80cfc35c48cde", "size": "456", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "lib/og/adapter/mysql/override.rb", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Ruby", "bytes": "263734" } ], "symlink_target": "" }
package unit.com.bitdubai.fermat_dmp_plugin.layer.transaction.outgoing_extra_user.developer.bitdubai.version_1.structure.OutgoingExtraUserTransactionProcessorAgent; import com.bitdubai.fermat_api.layer.dmp_basic_wallet.bitcoin_wallet.interfaces.BitcoinWalletManager; import com.bitdubai.fermat_pip_api.layer.pip_platform_service.error_manager.ErrorManager; import com.bitdubai.fermat_cry_api.layer.crypto_vault.CryptoVaultManager; import com.bitdubai.fermat_dmp_plugin.layer.transaction.outgoing_extra_user.developer.bitdubai.version_1.structure.OutgoingExtraUserDao; import com.bitdubai.fermat_dmp_plugin.layer.transaction.outgoing_extra_user.developer.bitdubai.version_1.structure.OutgoingExtraUserTransactionProcessorAgent; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import static org.fest.assertions.api.Assertions.assertThat; /** * Created by natalia on 10/07/15. */ @RunWith(MockitoJUnitRunner.class) public class StartTest { @Mock private BitcoinWalletManager mockBitcoinWalletManager; @Mock private CryptoVaultManager mockCryptoVaultManager; @Mock private ErrorManager mockErrorManager; @Mock private OutgoingExtraUserDao mockDao; private OutgoingExtraUserTransactionProcessorAgent testMonitorAgent; @Before public void setUp() throws Exception{ testMonitorAgent = new OutgoingExtraUserTransactionProcessorAgent(); testMonitorAgent.setErrorManager(mockErrorManager); testMonitorAgent.setBitcoinWalletManager(mockBitcoinWalletManager); testMonitorAgent.setCryptoVaultManager(mockCryptoVaultManager); mockDao = new OutgoingExtraUserDao(); testMonitorAgent.setOutgoingExtraUserDao(mockDao); } @Test public void Start_ParametersProperlySet_ThreadStarted() throws Exception{ testMonitorAgent.start(); Thread.sleep(100); assertThat(testMonitorAgent.isRunning()).isTrue(); } }
{ "content_hash": "66d24d508ebc3c715cece4ca355ba400", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 164, "avg_line_length": 32.935483870967744, "alnum_prop": 0.7928501469147894, "repo_name": "fvasquezjatar/fermat-unused", "id": "c44dc52c624bf5ac899b36ada9edac34857e2e1d", "size": "2042", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DMP/plugin/transaction/fermat-dmp-plugin-transaction-outgoing-extra-user-bitdubai/src/test/java/unit/com/bitdubai/fermat_dmp_plugin/layer/transaction/outgoing_extra_user/developer/bitdubai/version_1/structure/OutgoingExtraUserTransactionProcessorAgent/StartTest.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1204" }, { "name": "Groovy", "bytes": "76309" }, { "name": "HTML", "bytes": "322840" }, { "name": "Java", "bytes": "14027288" }, { "name": "Scala", "bytes": "1353" } ], "symlink_target": "" }
package roachpb import ( "bytes" "encoding/binary" "encoding/hex" "fmt" "hash" "hash/crc32" "math" "math/rand" "sort" "strconv" "sync" "time" "unicode" "github.com/biogo/store/interval" "github.com/gogo/protobuf/proto" "github.com/pkg/errors" "gopkg.in/inf.v0" "github.com/cockroachdb/cockroach/storage/engine/enginepb" "github.com/cockroachdb/cockroach/util/duration" "github.com/cockroachdb/cockroach/util/encoding" "github.com/cockroachdb/cockroach/util/hlc" "github.com/cockroachdb/cockroach/util/protoutil" "github.com/cockroachdb/cockroach/util/uuid" ) var ( // RKeyMin is a minimum key value which sorts before all other keys. RKeyMin = RKey("") // KeyMin is a minimum key value which sorts before all other keys. KeyMin = Key(RKeyMin) // RKeyMax is a maximum key value which sorts after all other keys. RKeyMax = RKey{0xff, 0xff} // KeyMax is a maximum key value which sorts after all other keys. KeyMax = Key(RKeyMax) // PrettyPrintKey is a function to print key with human readable format // it's implement at package git.com/cockroachdb/cockroach/keys to avoid package circle import PrettyPrintKey func(key Key) string ) // RKey denotes a Key whose local addressing has been accounted for. // A key can be transformed to an RKey by keys.Addr(). type RKey Key // AsRawKey returns the RKey as a Key. This is to be used only in select // situations in which an RKey is known to not contain a wrapped locally- // addressed Key. Whenever the Key which created the RKey is still available, // it should be used instead. func (rk RKey) AsRawKey() Key { return Key(rk) } // Less compares two RKeys. func (rk RKey) Less(otherRK RKey) bool { return bytes.Compare(rk, otherRK) < 0 } // Equal checks for byte-wise equality. func (rk RKey) Equal(other []byte) bool { return bytes.Equal(rk, other) } // Next returns the RKey that sorts immediately after the given one. // The method may only take a shallow copy of the RKey, so both the // receiver and the return value should be treated as immutable after. func (rk RKey) Next() RKey { return RKey(BytesNext(rk)) } // PrefixEnd determines the end key given key as a prefix, that is the // key that sorts precisely behind all keys starting with prefix: "1" // is added to the final byte and the carry propagated. The special // cases of nil and KeyMin always returns KeyMax. func (rk RKey) PrefixEnd() RKey { if len(rk) == 0 { return RKeyMax } return RKey(bytesPrefixEnd(rk)) } func (rk RKey) String() string { return Key(rk).String() } // Key is a custom type for a byte string in proto // messages which refer to Cockroach keys. type Key []byte // BytesNext returns the next possible byte slice, using the extra capacity // of the provided slice if possible, and if not, appending an \x00. func BytesNext(b []byte) []byte { if cap(b) > len(b) { bNext := b[:len(b)+1] if bNext[len(bNext)-1] == 0 { return bNext } } // TODO(spencer): Do we need to enforce KeyMaxLength here? // Switched to "make and copy" pattern in #4963 for performance. bn := make([]byte, len(b)+1) copy(bn, b) bn[len(bn)-1] = 0 return bn } func bytesPrefixEnd(b []byte) []byte { // Switched to "make and copy" pattern in #4963 for performance. end := make([]byte, len(b)) copy(end, b) for i := len(end) - 1; i >= 0; i-- { end[i] = end[i] + 1 if end[i] != 0 { return end } } // This statement will only be reached if the key is already a // maximal byte string (i.e. already \xff...). return b } // Next returns the next key in lexicographic sort order. The method may only // take a shallow copy of the Key, so both the receiver and the return // value should be treated as immutable after. func (k Key) Next() Key { return Key(BytesNext(k)) } // IsPrev is a more efficient version of k.Next().Equal(m). func (k Key) IsPrev(m Key) bool { l := len(m) - 1 return l == len(k) && m[l] == 0 && k.Equal(m[:l]) } // PrefixEnd determines the end key given key as a prefix, that is the // key that sorts precisely behind all keys starting with prefix: "1" // is added to the final byte and the carry propagated. The special // cases of nil and KeyMin always returns KeyMax. func (k Key) PrefixEnd() Key { if len(k) == 0 { return Key(RKeyMax) } return Key(bytesPrefixEnd(k)) } // Equal returns whether two keys are identical. func (k Key) Equal(l Key) bool { return bytes.Equal(k, l) } // Compare implements the interval.Comparable interface for tree nodes. func (k Key) Compare(b interval.Comparable) int { return bytes.Compare(k, b.(Key)) } // String returns a string-formatted version of the key. func (k Key) String() string { if PrettyPrintKey != nil { return PrettyPrintKey(k) } return fmt.Sprintf("%q", []byte(k)) } // Format implements the fmt.Formatter interface. func (k Key) Format(f fmt.State, verb rune) { // Note: this implementation doesn't handle the width and precision // specifiers such as "%20.10s". if PrettyPrintKey != nil { fmt.Fprint(f, PrettyPrintKey(k)) } else { fmt.Fprintf(f, strconv.Quote(string(k))) } } const ( checksumUninitialized = 0 checksumSize = 4 tagPos = checksumSize headerSize = tagPos + 1 ) func (v Value) checksum() uint32 { if len(v.RawBytes) < checksumSize { return 0 } _, u, err := encoding.DecodeUint32Ascending(v.RawBytes[:checksumSize]) if err != nil { panic(err) } return u } func (v *Value) setChecksum(cksum uint32) { if len(v.RawBytes) >= checksumSize { encoding.EncodeUint32Ascending(v.RawBytes[:0], cksum) } } // InitChecksum initializes a checksum based on the provided key and // the contents of the value. If the value contains a byte slice, the // checksum includes it directly. // // TODO(peter): This method should return an error if the Value is corrupted // (e.g. the RawBytes field is > 0 but smaller than the header size). func (v *Value) InitChecksum(key []byte) { if v.RawBytes == nil { return } // Should be uninitialized. if v.checksum() != checksumUninitialized { panic(fmt.Sprintf("initialized checksum = %x", v.checksum())) } v.setChecksum(v.computeChecksum(key)) } // ClearChecksum clears the checksum value. func (v *Value) ClearChecksum() { v.setChecksum(0) } // Verify verifies the value's Checksum matches a newly-computed // checksum of the value's contents. If the value's Checksum is not // set the verification is a noop. func (v Value) Verify(key []byte) error { if n := len(v.RawBytes); n > 0 && n < headerSize { return fmt.Errorf("%s: invalid header size: %d", Key(key), n) } if sum := v.checksum(); sum != 0 { if computedSum := v.computeChecksum(key); computedSum != sum { return fmt.Errorf("%s: invalid checksum (%x) value [%s]", Key(key), computedSum, string(v.RawBytes)) } } return nil } // ShallowClone returns a shallow clone of the receiver. func (v *Value) ShallowClone() *Value { if v == nil { return nil } t := *v return &t } // MakeValueFromString returns a value with bytes and tag set. func MakeValueFromString(s string) Value { v := Value{} v.SetString(s) return v } // MakeValueFromBytes returns a value with bytes and tag set. func MakeValueFromBytes(bs []byte) Value { v := Value{} v.SetBytes(bs) return v } // MakeValueFromBytesAndTimestamp returns a value with bytes, timestamp and // tag set. func MakeValueFromBytesAndTimestamp(bs []byte, t hlc.Timestamp) Value { v := Value{Timestamp: t} v.SetBytes(bs) return v } // GetTag retrieves the value type. func (v Value) GetTag() ValueType { if len(v.RawBytes) <= tagPos { return ValueType_UNKNOWN } return ValueType(v.RawBytes[tagPos]) } func (v *Value) setTag(t ValueType) { v.RawBytes[tagPos] = byte(t) } func (v Value) dataBytes() []byte { return v.RawBytes[headerSize:] } // SetBytes sets the bytes and tag field of the receiver and clears the checksum. func (v *Value) SetBytes(b []byte) { v.RawBytes = make([]byte, headerSize+len(b)) copy(v.dataBytes(), b) v.setTag(ValueType_BYTES) } // SetString sets the bytes and tag field of the receiver and clears the // checksum. This is identical to SetBytes, but specialized for a string // argument. func (v *Value) SetString(s string) { v.RawBytes = make([]byte, headerSize+len(s)) copy(v.dataBytes(), s) v.setTag(ValueType_BYTES) } // SetFloat encodes the specified float64 value into the bytes field of the // receiver, sets the tag and clears the checksum. func (v *Value) SetFloat(f float64) { v.RawBytes = make([]byte, headerSize+8) encoding.EncodeUint64Ascending(v.RawBytes[headerSize:headerSize], math.Float64bits(f)) v.setTag(ValueType_FLOAT) } // SetBool encodes the specified bool value into the bytes field of the // receiver, sets the tag and clears the checksum. func (v *Value) SetBool(b bool) { // 0 or 1 will always encode to a 1-byte long varint. v.RawBytes = make([]byte, headerSize+1) i := int64(0) if b { i = 1 } _ = binary.PutVarint(v.RawBytes[headerSize:], i) v.setTag(ValueType_INT) } // SetInt encodes the specified int64 value into the bytes field of the // receiver, sets the tag and clears the checksum. func (v *Value) SetInt(i int64) { v.RawBytes = make([]byte, headerSize+binary.MaxVarintLen64) n := binary.PutVarint(v.RawBytes[headerSize:], i) v.RawBytes = v.RawBytes[:headerSize+n] v.setTag(ValueType_INT) } // SetProto encodes the specified proto message into the bytes field of the // receiver and clears the checksum. If the proto message is an // InternalTimeSeriesData, the tag will be set to TIMESERIES rather than BYTES. func (v *Value) SetProto(msg proto.Message) error { data, err := protoutil.Marshal(msg) if err != nil { return err } v.SetBytes(data) // Special handling for timeseries data. if _, ok := msg.(*InternalTimeSeriesData); ok { v.setTag(ValueType_TIMESERIES) } return nil } // SetTime encodes the specified time value into the bytes field of the // receiver, sets the tag and clears the checksum. func (v *Value) SetTime(t time.Time) { const encodingSizeOverestimate = 11 v.RawBytes = make([]byte, headerSize, headerSize+encodingSizeOverestimate) v.RawBytes = encoding.EncodeTimeAscending(v.RawBytes, t) v.setTag(ValueType_TIME) } // SetDuration encodes the specified duration value into the bytes field of the // receiver, sets the tag and clears the checksum. func (v *Value) SetDuration(t duration.Duration) error { var err error v.RawBytes = make([]byte, headerSize, headerSize+encoding.EncodedDurationMaxLen) v.RawBytes, err = encoding.EncodeDurationAscending(v.RawBytes, t) if err != nil { return err } v.setTag(ValueType_DURATION) return nil } // SetDecimal encodes the specified decimal value into the bytes field of // the receiver using Gob encoding, sets the tag and clears the checksum. func (v *Value) SetDecimal(dec *inf.Dec) error { decSize := encoding.UpperBoundNonsortingDecimalSize(dec) v.RawBytes = make([]byte, headerSize, headerSize+decSize) v.RawBytes = encoding.EncodeNonsortingDecimal(v.RawBytes, dec) v.setTag(ValueType_DECIMAL) return nil } // SetTuple sets the tuple bytes and tag field of the receiver and clears the // checksum. func (v *Value) SetTuple(data []byte) { // TODO(dan): Reuse this and stop allocating on every SetTuple call. Same for // the other SetFoos. v.RawBytes = make([]byte, headerSize+len(data)) copy(v.dataBytes(), data) v.setTag(ValueType_TUPLE) } // GetBytes returns the bytes field of the receiver. If the tag is not // BYTES an error will be returned. func (v Value) GetBytes() ([]byte, error) { if tag := v.GetTag(); tag != ValueType_BYTES { return nil, fmt.Errorf("value type is not %s: %s", ValueType_BYTES, tag) } return v.dataBytes(), nil } // GetFloat decodes a float64 value from the bytes field of the receiver. If // the bytes field is not 8 bytes in length or the tag is not FLOAT an error // will be returned. func (v Value) GetFloat() (float64, error) { if tag := v.GetTag(); tag != ValueType_FLOAT { return 0, fmt.Errorf("value type is not %s: %s", ValueType_FLOAT, tag) } dataBytes := v.dataBytes() if len(dataBytes) != 8 { return 0, fmt.Errorf("float64 value should be exactly 8 bytes: %d", len(dataBytes)) } _, u, err := encoding.DecodeUint64Ascending(dataBytes) if err != nil { return 0, err } return math.Float64frombits(u), nil } // GetBool decodes a bool value from the bytes field of the receiver. If the // tag is not INT (the tag used for bool values) or the value cannot be decoded // an error will be returned. func (v Value) GetBool() (bool, error) { if tag := v.GetTag(); tag != ValueType_INT { return false, fmt.Errorf("value type is not %s: %s", ValueType_INT, tag) } i, n := binary.Varint(v.dataBytes()) if n <= 0 { return false, fmt.Errorf("int64 varint decoding failed: %d", n) } if i > 1 || i < 0 { return false, fmt.Errorf("invalid bool: %d", i) } return i != 0, nil } // GetInt decodes an int64 value from the bytes field of the receiver. If the // tag is not INT or the value cannot be decoded an error will be returned. func (v Value) GetInt() (int64, error) { if tag := v.GetTag(); tag != ValueType_INT { return 0, fmt.Errorf("value type is not %s: %s", ValueType_INT, tag) } i, n := binary.Varint(v.dataBytes()) if n <= 0 { return 0, fmt.Errorf("int64 varint decoding failed: %d", n) } return i, nil } // GetProto unmarshals the bytes field of the receiver into msg. If // unmarshalling fails or the tag is not BYTES, an error will be // returned. func (v Value) GetProto(msg proto.Message) error { expectedTag := ValueType_BYTES // Special handling for ts data. if _, ok := msg.(*InternalTimeSeriesData); ok { expectedTag = ValueType_TIMESERIES } if tag := v.GetTag(); tag != expectedTag { return fmt.Errorf("value type is not %s: %s", expectedTag, tag) } return proto.Unmarshal(v.dataBytes(), msg) } // GetTime decodes a time value from the bytes field of the receiver. If the // tag is not TIME an error will be returned. func (v Value) GetTime() (time.Time, error) { if tag := v.GetTag(); tag != ValueType_TIME { return time.Time{}, fmt.Errorf("value type is not %s: %s", ValueType_TIME, tag) } _, t, err := encoding.DecodeTimeAscending(v.dataBytes()) return t, err } // GetDuration decodes a duration value from the bytes field of the receiver. If // the tag is not DURATION an error will be returned. func (v Value) GetDuration() (duration.Duration, error) { if tag := v.GetTag(); tag != ValueType_DURATION { return duration.Duration{}, fmt.Errorf("value type is not %s: %s", ValueType_DURATION, tag) } _, t, err := encoding.DecodeDurationAscending(v.dataBytes()) return t, err } // GetDecimal decodes a decimal value from the bytes of the receiver. If the // tag is not DECIMAL an error will be returned. func (v Value) GetDecimal() (*inf.Dec, error) { if tag := v.GetTag(); tag != ValueType_DECIMAL { return nil, fmt.Errorf("value type is not %s: %s", ValueType_DECIMAL, tag) } return encoding.DecodeNonsortingDecimal(v.dataBytes(), nil) } // GetTimeseries decodes an InternalTimeSeriesData value from the bytes // field of the receiver. An error will be returned if the tag is not // TIMESERIES or if decoding fails. func (v Value) GetTimeseries() (InternalTimeSeriesData, error) { ts := InternalTimeSeriesData{} return ts, v.GetProto(&ts) } // GetTuple returns the tuple bytes of the receiver. If the tag is not TUPLE an // error will be returned. func (v Value) GetTuple() ([]byte, error) { if tag := v.GetTag(); tag != ValueType_TUPLE { return nil, fmt.Errorf("value type is not %s: %s", ValueType_TUPLE, tag) } return v.dataBytes(), nil } var crc32Pool = sync.Pool{ New: func() interface{} { return crc32.NewIEEE() }, } // computeChecksum computes a checksum based on the provided key and // the contents of the value. func (v Value) computeChecksum(key []byte) uint32 { if len(v.RawBytes) < headerSize { return 0 } crc := crc32Pool.Get().(hash.Hash32) if _, err := crc.Write(key); err != nil { panic(err) } if _, err := crc.Write(v.RawBytes[checksumSize:]); err != nil { panic(err) } sum := crc.Sum32() crc.Reset() crc32Pool.Put(crc) // We reserved the value 0 (checksumUninitialized) to indicate that a checksum // has not been initialized. This reservation is accomplished by folding a // computed checksum of 0 to the value 1. if sum == checksumUninitialized { return 1 } return sum } // PrettyPrint returns the value in a human readable format. // e.g. `Put /Table/51/1/1/0 -> /TUPLE/2:2:Int/7/1:3:Float/6.28` // In `1:3:Float/6.28`, the `1` is the column id diff as stored, `3` is the // computed (i.e. not stored) actual column id, `Float` is the type, and `6.28` // is the encoded value. func (v Value) PrettyPrint() string { var buf bytes.Buffer t := v.GetTag() buf.WriteRune('/') buf.WriteString(t.String()) buf.WriteRune('/') var err error switch t { case ValueType_TUPLE: b := v.dataBytes() var colID uint32 for i := 0; len(b) > 0; i++ { if i != 0 { buf.WriteRune('/') } _, _, colIDDiff, typ, err := encoding.DecodeValueTag(b) if err != nil { break } colID += colIDDiff var s string b, s, err = encoding.PrettyPrintValueEncoded(b) if err != nil { break } fmt.Fprintf(&buf, "%d:%d:%s/%s", colIDDiff, colID, typ, s) } case ValueType_INT: var i int64 i, err = v.GetInt() buf.WriteString(strconv.FormatInt(i, 10)) case ValueType_FLOAT: var f float64 f, err = v.GetFloat() buf.WriteString(strconv.FormatFloat(f, 'g', -1, 64)) case ValueType_BYTES: var data []byte data, err = v.GetBytes() printable := len(bytes.TrimLeftFunc(data, unicode.IsPrint)) == 0 if printable { buf.WriteString(string(data)) } else { buf.WriteString(hex.EncodeToString(data)) } case ValueType_TIME: var t time.Time t, err = v.GetTime() buf.WriteString(t.UTC().Format(time.RFC3339Nano)) case ValueType_DECIMAL: var d *inf.Dec d, err = v.GetDecimal() buf.WriteString(d.String()) case ValueType_DURATION: var d duration.Duration d, err = v.GetDuration() buf.WriteString(d.String()) default: err = errors.Errorf("unknown tag: %s", t) } if err != nil { // Ignore the contents of buf and return directly. return fmt.Sprintf("/<err: %s>", err) } return buf.String() } // NewTransaction creates a new transaction. The transaction key is // composed using the specified baseKey (for locality with data // affected by the transaction) and a random ID to guarantee // uniqueness. The specified user-level priority is combined with a // randomly chosen value to yield a final priority, used to settle // write conflicts in a way that avoids starvation of long-running // transactions (see Replica.PushTxn). func NewTransaction(name string, baseKey Key, userPriority UserPriority, isolation enginepb.IsolationType, now hlc.Timestamp, maxOffset int64) *Transaction { // Compute priority by adjusting based on userPriority factor. priority := MakePriority(userPriority) // Compute timestamp and max timestamp. max := now max.WallTime += maxOffset return &Transaction{ TxnMeta: enginepb.TxnMeta{ Key: baseKey, ID: uuid.NewV4(), Isolation: isolation, Timestamp: now, Priority: priority, Sequence: 1, }, Name: name, OrigTimestamp: now, MaxTimestamp: max, } } // LastActive returns the last timestamp at which client activity definitely // occurred, i.e. the maximum of OrigTimestamp and LastHeartbeat. func (t Transaction) LastActive() hlc.Timestamp { candidate := t.OrigTimestamp if t.LastHeartbeat != nil && candidate.Less(*t.LastHeartbeat) { candidate = *t.LastHeartbeat } return candidate } // Clone creates a copy of the given transaction. The copy is "mostly" deep, // but does share pieces of memory with the original such as Key, ID and the // keys with the intent spans. func (t Transaction) Clone() Transaction { if t.LastHeartbeat != nil { h := *t.LastHeartbeat t.LastHeartbeat = &h } mt := t.ObservedTimestamps if mt != nil { t.ObservedTimestamps = make(map[NodeID]hlc.Timestamp) for k, v := range mt { t.ObservedTimestamps[k] = v } } // Note that we're not cloning the span keys under the assumption that the // keys themselves are not mutable. t.Intents = append([]Span(nil), t.Intents...) return t } // Equal tests two transactions for equality. They are equal if they are // either simultaneously nil or their IDs match. func (t *Transaction) Equal(s *Transaction) bool { if t == nil && s == nil { return true } if (t == nil && s != nil) || (t != nil && s == nil) { return false } return TxnIDEqual(t.ID, s.ID) } // IsInitialized returns true if the transaction has been initialized. func (t *Transaction) IsInitialized() bool { return t.ID != nil } // MakePriority generates a random priority value, biased by the // specified userPriority. If userPriority=100, the random priority // will be 100x more likely to be greater than if userPriority=1. If // userPriority = 0.1, the random priority will be 1/10th as likely to // be greater than if userPriority=1. Balance is achieved when // userPriority=1, in which case the priority chosen is unbiased. func MakePriority(userPriority UserPriority) int32 { // A currently undocumented feature allows an explicit priority to // be set by specifying priority < 1. The explicit priority is // simply -userPriority in this case. This is hacky, but currently // used for unittesting. Perhaps this should be documented and allowed. if userPriority < 0 { if -userPriority > UserPriority(math.MaxInt32) { panic(fmt.Sprintf("cannot set explicit priority to a value less than -%d", math.MaxInt32)) } return int32(-userPriority) } else if userPriority == 0 { userPriority = 1 } else if userPriority > MaxUserPriority { userPriority = MaxUserPriority } else if userPriority < MinUserPriority { userPriority = MinUserPriority } // We generate random values which are biased according to priorities. If v1 is a value // generated for priority p1 and v2 is a value of priority v2, we want the ratio of wins vs // losses to be the same with the ratio of priorities: // // P[ v1 > v2 ] p1 p1 // ------------ = -- or, equivalently: P[ v1 > v2 ] = ------- // P[ v2 < v1 ] p2 p1 + p2 // // // For example, priority 10 wins 10 out of 11 times over priority 1, and it wins 100 out of 101 // times over priority 0.1. // // // We use the exponential distribution. This distribution has the probability density function // PDF_lambda(x) = lambda * exp(-lambda * x) // and the cumulative distribution function (i.e. probability that a random value is smaller // than x): // CDF_lambda(x) = Integral_0^x PDF_lambda(x) dx // = 1 - exp(-lambda * x) // // Let's assume we generate x from the exponential distribution with the lambda rate set to // l1 and we generate y from the distribution with the rate set to l2. The probability that x // wins is: // P[ x > y ] = Integral_0^inf Integral_0^x PDF_l1(x) PDF_l2(y) dy dx // = Integral_0^inf PDF_l1(x) Integral_0^x PDF_l2(y) dy dx // = Integral_0^inf PDF_l1(x) CDF_l2(x) dx // = Integral_0^inf PDF_l1(x) (1 - exp(-l2 * x)) dx // = 1 - Integral_0^inf l1 * exp(-(l1+l2) * x) dx // = 1 - l1 / (l1 + l2) * Integral_0^inf PDF_(l1+l2)(x) dx // = 1 - l1 / (l1 + l2) // = l2 / (l1 + l2) // // We want this probability to be p1 / (p1 + p2) which we can get by setting // l1 = 1 / p1 // l2 = 1 / p2 // It's easy to verify that (1/p2) / (1/p1 + 1/p2) = p1 / (p2 + p1). // // We can generate an exponentially distributed value using (rand.ExpFloat64() / lambda). // In our case this works out to simply rand.ExpFloat64() * userPriority. val := rand.ExpFloat64() * float64(userPriority) // To convert to an integer, we scale things to accommodate a few (5) standard deviations for // the maximum priority. The choice of the value is a trade-off between loss of resolution for // low priorities and overflow (capping the value to MaxInt32) for high priorities. // // For userPriority=MaxUserPriority, the probability of overflow is 0.7%. // For userPriority=(MaxUserPriority/2), the probability of overflow is 0.005%. val = (val / (5 * MaxUserPriority)) * math.MaxInt32 if val >= math.MaxInt32 { return math.MaxInt32 } return int32(val) } // TxnIDEqual returns whether the transaction IDs are equal. func TxnIDEqual(a, b *uuid.UUID) bool { if a == nil && b == nil { return true } else if a != nil && b != nil { return *a == *b } return false } // Restart reconfigures a transaction for restart. The epoch is // incremented for an in-place restart. The timestamp of the // transaction on restart is set to the maximum of the transaction's // timestamp and the specified timestamp. func (t *Transaction) Restart(userPriority UserPriority, upgradePriority int32, timestamp hlc.Timestamp) { t.Epoch++ if t.Timestamp.Less(timestamp) { t.Timestamp = timestamp } // Set original timestamp to current timestamp on restart. t.OrigTimestamp = t.Timestamp // Upgrade priority to the maximum of: // - the current transaction priority // - a random priority created from userPriority // - the conflicting transaction's upgradePriority t.UpgradePriority(MakePriority(userPriority)) t.UpgradePriority(upgradePriority) t.WriteTooOld = false t.RetryOnPush = false } // Update ratchets priority, timestamp and original timestamp values (among // others) for the transaction. If t.ID is empty, then the transaction is // copied from o. func (t *Transaction) Update(o *Transaction) { if o == nil { return } if t.ID == nil { *t = o.Clone() return } if len(t.Key) == 0 { t.Key = o.Key } if o.Status != PENDING { t.Status = o.Status } if t.Epoch < o.Epoch { t.Epoch = o.Epoch } t.Timestamp.Forward(o.Timestamp) t.OrigTimestamp.Forward(o.OrigTimestamp) t.MaxTimestamp.Forward(o.MaxTimestamp) if o.LastHeartbeat != nil { if t.LastHeartbeat == nil { t.LastHeartbeat = &hlc.Timestamp{} } t.LastHeartbeat.Forward(*o.LastHeartbeat) } // Absorb the collected clock uncertainty information. for k, v := range o.ObservedTimestamps { t.UpdateObservedTimestamp(k, v) } t.UpgradePriority(o.Priority) // We can't assert against regression here since it can actually happen // that we update from a transaction which isn't Writing. t.Writing = t.Writing || o.Writing // This isn't or'd (similar to Writing) because we want WriteTooOld // and RetryOnPush to be set each time according to "o". This allows // a persisted txn to have its WriteTooOld flag reset on update. // TODO(tschottdorf): reset in a central location when it's certifiably // a new request. Update is called in many situations and shouldn't // reset anything. t.WriteTooOld = o.WriteTooOld t.RetryOnPush = o.RetryOnPush if t.Sequence < o.Sequence { t.Sequence = o.Sequence } if len(o.Intents) > 0 { t.Intents = o.Intents } } // UpgradePriority sets transaction priority to the maximum of current // priority and the specified minPriority. func (t *Transaction) UpgradePriority(minPriority int32) { if minPriority > t.Priority { t.Priority = minPriority } } // String formats transaction into human readable string. func (t Transaction) String() string { var buf bytes.Buffer // Compute priority as a floating point number from 0-100 for readability. floatPri := 100 * float64(t.Priority) / float64(math.MaxInt32) if len(t.Name) > 0 { fmt.Fprintf(&buf, "%q ", t.Name) } fmt.Fprintf(&buf, "id=%s key=%s rw=%t pri=%.8f iso=%s stat=%s epo=%d ts=%s orig=%s max=%s wto=%t rop=%t", t.ID.Short(), Key(t.Key), t.Writing, floatPri, t.Isolation, t.Status, t.Epoch, t.Timestamp, t.OrigTimestamp, t.MaxTimestamp, t.WriteTooOld, t.RetryOnPush) return buf.String() } // ResetObservedTimestamps clears out all timestamps recorded from individual // nodes. func (t *Transaction) ResetObservedTimestamps() { t.ObservedTimestamps = nil } // UpdateObservedTimestamp stores a timestamp off a node's clock for future // operations in the transaction. When multiple calls are made for a single // nodeID, the lowest timestamp prevails. func (t *Transaction) UpdateObservedTimestamp(nodeID NodeID, maxTS hlc.Timestamp) { if t.ObservedTimestamps == nil { t.ObservedTimestamps = make(map[NodeID]hlc.Timestamp) } if ts, ok := t.ObservedTimestamps[nodeID]; !ok || maxTS.Less(ts) { t.ObservedTimestamps[nodeID] = maxTS } } // GetObservedTimestamp returns the lowest HLC timestamp recorded from the // given node's clock during the transaction. The returned boolean is false if // no observation about the requested node was found. Otherwise, MaxTimestamp // can be lowered to the returned timestamp when reading from nodeID. func (t Transaction) GetObservedTimestamp(nodeID NodeID) (hlc.Timestamp, bool) { ts, ok := t.ObservedTimestamps[nodeID] return ts, ok } var _ fmt.Stringer = &Lease{} func (l Lease) String() string { start := time.Unix(0, l.Start.WallTime).UTC() expiration := time.Unix(0, l.Expiration.WallTime).UTC() return fmt.Sprintf("replica %s %s %s", l.Replica, start, expiration.Sub(start)) } // Covers returns true if the given timestamp can be served by the Lease. // This is the case if the timestamp precedes the Lease's stasis period. // Note that the fact that a lease convers a timestamp is not enough for the // holder of the lease to be able to serve a read with that timestamp; // pendingLeaderLeaseRequest.TransferInProgress() should also be consulted to // account for possible lease transfers. func (l Lease) Covers(timestamp hlc.Timestamp) bool { return timestamp.Less(l.StartStasis) } // OwnedBy returns whether the given store is the lease owner. func (l Lease) OwnedBy(storeID StoreID) bool { return l.Replica.StoreID == storeID } // AsIntents takes a slice of spans and returns it as a slice of intents for // the given transaction. func AsIntents(spans []Span, txn *Transaction) []Intent { ret := make([]Intent, len(spans)) for i := range spans { ret[i] = Intent{ Span: spans[i], Txn: txn.TxnMeta, Status: txn.Status, } } return ret } // Equal compares for equality. func (s Span) Equal(o Span) bool { return s.Key.Equal(o.Key) && s.EndKey.Equal(o.EndKey) } // Overlaps returns whether the two spans overlap. func (s Span) Overlaps(o Span) bool { if len(s.EndKey) == 0 && len(o.EndKey) == 0 { return s.Key.Equal(o.Key) } else if len(s.EndKey) == 0 { return bytes.Compare(s.Key, o.Key) >= 0 && bytes.Compare(s.Key, o.EndKey) < 0 } else if len(o.EndKey) == 0 { return bytes.Compare(o.Key, s.Key) >= 0 && bytes.Compare(o.Key, s.EndKey) < 0 } return bytes.Compare(s.EndKey, o.Key) > 0 && bytes.Compare(s.Key, o.EndKey) < 0 } // RSpan is a key range with an inclusive start RKey and an exclusive end RKey. type RSpan struct { Key, EndKey RKey } // Equal compares for equality. func (rs RSpan) Equal(o RSpan) bool { return rs.Key.Equal(o.Key) && rs.EndKey.Equal(o.EndKey) } // ContainsKey returns whether this span contains the specified key. func (rs RSpan) ContainsKey(key RKey) bool { return bytes.Compare(key, rs.Key) >= 0 && bytes.Compare(key, rs.EndKey) < 0 } // ContainsExclusiveEndKey returns whether this span contains the specified (exclusive) end key // (e.g., span ["a", b") contains "b" as exclusive end key). func (rs RSpan) ContainsExclusiveEndKey(key RKey) bool { return bytes.Compare(key, rs.Key) > 0 && bytes.Compare(key, rs.EndKey) <= 0 } // ContainsKeyRange returns whether this span contains the specified // key range from start (inclusive) to end (exclusive). // If end is empty or start is equal to end, returns ContainsKey(start). func (rs RSpan) ContainsKeyRange(start, end RKey) bool { if len(end) == 0 { return rs.ContainsKey(start) } if comp := bytes.Compare(end, start); comp < 0 { return false } else if comp == 0 { return rs.ContainsKey(start) } return bytes.Compare(start, rs.Key) >= 0 && bytes.Compare(rs.EndKey, end) >= 0 } // Intersect returns the intersection of the current span and the // descriptor's range. Returns an error if the span and the // descriptor's range do not overlap. // TODO(nvanbenschoten) Investigate why this returns an endKey when // rs.EndKey is nil. This gives the method unexpected behavior. func (rs RSpan) Intersect(desc *RangeDescriptor) (RSpan, error) { if !rs.Key.Less(desc.EndKey) || !desc.StartKey.Less(rs.EndKey) { return rs, errors.Errorf("span and descriptor's range do not overlap") } key := rs.Key if key.Less(desc.StartKey) { key = desc.StartKey } endKey := rs.EndKey if !desc.ContainsKeyRange(desc.StartKey, endKey) || endKey == nil { endKey = desc.EndKey } return RSpan{key, endKey}, nil } // KeyValueByKey implements sorting of a slice of KeyValues by key. type KeyValueByKey []KeyValue // Len implements sort.Interface. func (kv KeyValueByKey) Len() int { return len(kv) } // Less implements sort.Interface. func (kv KeyValueByKey) Less(i, j int) bool { return bytes.Compare(kv[i].Key, kv[j].Key) < 0 } // Swap implements sort.Interface. func (kv KeyValueByKey) Swap(i, j int) { kv[i], kv[j] = kv[j], kv[i] } var _ sort.Interface = KeyValueByKey{}
{ "content_hash": "20de9ae89ada282fb36e82a5df919f74", "timestamp": "", "source": "github", "line_count": 1036, "max_line_length": 106, "avg_line_length": 32.197876447876446, "alnum_prop": 0.6969151902149474, "repo_name": "arjun4084346/cockroach", "id": "c24719e3d3b2712173502f70dc55202cc50aa168", "size": "34015", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "roachpb/data.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "1029" }, { "name": "C", "bytes": "7858" }, { "name": "C++", "bytes": "70832" }, { "name": "CSS", "bytes": "33770" }, { "name": "Go", "bytes": "6501732" }, { "name": "HCL", "bytes": "40889" }, { "name": "HTML", "bytes": "17847" }, { "name": "JavaScript", "bytes": "197416" }, { "name": "Makefile", "bytes": "17728" }, { "name": "Protocol Buffer", "bytes": "179122" }, { "name": "Ruby", "bytes": "2554" }, { "name": "Shell", "bytes": "54307" }, { "name": "Smarty", "bytes": "4799" }, { "name": "TypeScript", "bytes": "234129" }, { "name": "Yacc", "bytes": "115573" } ], "symlink_target": "" }
package peas_test import ( "errors" "io/ioutil" "os" "code.cloudfoundry.org/guardian/gardener" "code.cloudfoundry.org/guardian/rundmc/peas" "code.cloudfoundry.org/guardian/rundmc/peas/peasfakes" "code.cloudfoundry.org/guardian/rundmc/peas/processwaiter/processwaiterfakes" "code.cloudfoundry.org/lager/lagertest" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("PeaCleaner", func() { var ( fakeDeleter *peasfakes.FakeDeleter fakeVolumizer *peasfakes.FakeVolumizer fakeProcWaiter *processwaiterfakes.FakeProcessWaiter fakeRuntime *peasfakes.FakeRuntime fakePeaPidGetter *peasfakes.FakePeaPidGetter cleaner gardener.PeaCleaner logger *lagertest.TestLogger processID string = "proccess-id" cleanErr error ) BeforeEach(func() { fakeDeleter = new(peasfakes.FakeDeleter) fakeVolumizer = new(peasfakes.FakeVolumizer) fakeProcWaiter = new(processwaiterfakes.FakeProcessWaiter) fakeRuntime = new(peasfakes.FakeRuntime) fakePeaPidGetter = new(peasfakes.FakePeaPidGetter) cleaner = &peas.PeaCleaner{ Deleter: fakeDeleter, Volumizer: fakeVolumizer, Waiter: fakeProcWaiter.Spy, Runtime: fakeRuntime, PeaPidGetter: fakePeaPidGetter, } logger = lagertest.NewTestLogger("peas-unit-tests") }) Describe("Clean", func() { JustBeforeEach(func() { cleanErr = cleaner.Clean(logger, processID) }) It("deletes the container", func() { Expect(fakeDeleter.DeleteCallCount()).To(Equal(1)) _, id := fakeDeleter.DeleteArgsForCall(0) Expect(id).To(Equal(processID)) }) Context("when deleting container fails", func() { BeforeEach(func() { fakeDeleter.DeleteReturns(errors.New("failky")) }) It("returns an error", func() { Expect(cleanErr).To(MatchError(ContainSubstring("failky"))) }) It("still destroys rootfs", func() { Expect(fakeVolumizer.DestroyCallCount()).To(Equal(1)) }) }) It("destroys the volume", func() { Expect(fakeVolumizer.DestroyCallCount()).To(Equal(1)) _, id := fakeVolumizer.DestroyArgsForCall(0) Expect(id).To(Equal(processID)) }) Context("when deleting container fails", func() { BeforeEach(func() { fakeVolumizer.DestroyReturns(errors.New("abracadabrakaboom")) }) It("returns an error", func() { Expect(cleanErr).To(MatchError(ContainSubstring("abracadabrakaboom"))) }) }) }) Describe("CleanAll", func() { BeforeEach(func() { fakeRuntime.ContainerHandlesReturns([]string{"container-handle"}, nil) fakeRuntime.ContainerPeaHandlesReturns([]string{"pea-00"}, nil) fakePeaPidGetter.GetPeaPidReturns(17, nil) }) JustBeforeEach(func() { cleanErr = cleaner.CleanAll(logger) }) It("gets all container handles", func() { Expect(fakeRuntime.ContainerHandlesCallCount()).To(Equal(1)) }) It("gets the peas for the container", func() { Expect(fakeRuntime.ContainerPeaHandlesCallCount()).To(Equal(1)) _, actualSandboxHandle := fakeRuntime.ContainerPeaHandlesArgsForCall(0) Expect(actualSandboxHandle).To(Equal("container-handle")) }) It("waits for the pea to complete", func() { Eventually(fakeProcWaiter.CallCount).Should(Equal(1)) Expect(fakeProcWaiter.ArgsForCall(0)).To(Equal(17)) }) It("cleans up the pea", func() { Eventually(fakeVolumizer.DestroyCallCount).Should(Equal(1)) _, actualID := fakeVolumizer.DestroyArgsForCall(0) Expect(actualID).To(Equal("pea-00")) }) Context("when there is more than one container", func() { BeforeEach(func() { fakeRuntime.ContainerHandlesReturns([]string{"first", "second"}, nil) }) It("gets the peas for each of the containers", func() { Expect(fakeRuntime.ContainerPeaHandlesCallCount()).To(Equal(2)) _, actualSandboxHandle := fakeRuntime.ContainerPeaHandlesArgsForCall(0) Expect(actualSandboxHandle).To(Equal("first")) _, actualSandboxHandle = fakeRuntime.ContainerPeaHandlesArgsForCall(1) Expect(actualSandboxHandle).To(Equal("second")) }) Context("when getting the peas for a container fails", func() { BeforeEach(func() { fakeRuntime.ContainerPeaHandlesReturnsOnCall(0, nil, errors.New("BOOM")) }) It("proceeds with the next container", func() { Expect(cleanErr).NotTo(HaveOccurred()) Expect(fakeRuntime.ContainerPeaHandlesCallCount()).To(Equal(2)) }) }) }) Context("when there are more than one pea", func() { BeforeEach(func() { fakeRuntime.ContainerPeaHandlesReturnsOnCall(0, []string{"pea-11", "pea-12"}, nil) }) It("gets the PID of each pea", func() { Expect(fakePeaPidGetter.GetPeaPidCallCount()).To(Equal(2)) _, actualSandboxHandle, actualPeaHandle := fakePeaPidGetter.GetPeaPidArgsForCall(0) Expect(actualSandboxHandle).To(Equal("container-handle")) Expect(actualPeaHandle).To(Equal("pea-11")) _, actualSandboxHandle, actualPeaHandle = fakePeaPidGetter.GetPeaPidArgsForCall(1) Expect(actualSandboxHandle).To(Equal("container-handle")) Expect(actualPeaHandle).To(Equal("pea-12")) }) Context("when getting the pea pid fails", func() { BeforeEach(func() { fakePeaPidGetter.GetPeaPidReturnsOnCall(0, -1, errors.New("nopid")) fakePeaPidGetter.GetPeaPidReturnsOnCall(1, 43, nil) }) It("proceeds with the next pea", func() { Expect(cleanErr).NotTo(HaveOccurred()) Expect(fakePeaPidGetter.GetPeaPidCallCount()).To(Equal(2)) }) It("does not try to clean the pea", func() { Eventually(fakeProcWaiter.CallCount).Should(Equal(1)) Expect(fakeProcWaiter.ArgsForCall(0)).To(Equal(43)) Consistently(fakeProcWaiter.CallCount).Should(Equal(1)) }) }) }) Context("when getting the container handles fails", func() { BeforeEach(func() { fakeRuntime.ContainerHandlesReturns(nil, errors.New("faily")) }) It("propagates the error", func() { Expect(cleanErr).To(MatchError("faily")) }) }) }) Context("when waiting on the pea fails", func() { BeforeEach(func() { fakeProcWaiter.Returns(errors.New("NOPE")) }) It("doesn't clean it up", func() { Consistently(fakeVolumizer.DestroyCallCount).Should(Equal(0)) }) }) }) func tempDir() string { dir, err := ioutil.TempDir("", "") Expect(err).NotTo(HaveOccurred()) return dir } func writeFile(path, content string) { err := ioutil.WriteFile(path, []byte(content), os.ModePerm) Expect(err).NotTo(HaveOccurred()) } func mkdirAll(path string) { Expect(os.MkdirAll(path, os.ModePerm)).To(Succeed()) }
{ "content_hash": "2f54fc401f297ab063e4c6cbd66ce466", "timestamp": "", "source": "github", "line_count": 223, "max_line_length": 87, "avg_line_length": 29.32286995515695, "alnum_prop": 0.6968955497782535, "repo_name": "cloudfoundry-incubator/guardian", "id": "768a84ac42c910a713a4f5eb33c6054eeedaf099", "size": "6539", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "rundmc/peas/pea_cleaner_test.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "8291" }, { "name": "Go", "bytes": "1066618" }, { "name": "Makefile", "bytes": "207" }, { "name": "Shell", "bytes": "335" } ], "symlink_target": "" }
using System; using System.Data; using System.Data.SqlClient; using Csla; using Csla.Data; using DocStore.Business.Util; namespace DocStore.Business { /// <summary> /// Active document types (name value list).<br/> /// This is a generated <see cref="DocTypeNVL"/> business object. /// </summary> [Serializable] public partial class DocTypeNVL : NameValueListBase<int, string> { #region Private Fields private static DocTypeNVL _list; #endregion #region Cache Management Methods /// <summary> /// Clears the in-memory DocTypeNVL cache so it is reloaded on the next request. /// </summary> public static void InvalidateCache() { _list = null; } /// <summary> /// Used by async loaders to load the cache. /// </summary> /// <param name="list">The list to cache.</param> internal static void SetCache(DocTypeNVL list) { _list = list; } internal static bool IsCached { get { return _list != null; } } #endregion #region Factory Methods /// <summary> /// Factory method. Loads a <see cref="DocTypeNVL"/> object. /// </summary> /// <returns>A reference to the fetched <see cref="DocTypeNVL"/> object.</returns> public static DocTypeNVL GetDocTypeNVL() { if (_list == null) _list = DataPortal.Fetch<DocTypeNVL>(); return _list; } /// <summary> /// Factory method. Asynchronously loads a <see cref="DocTypeNVL"/> object. /// </summary> /// <param name="callback">The completion callback method.</param> public static void GetDocTypeNVL(EventHandler<DataPortalResult<DocTypeNVL>> callback) { if (_list == null) DataPortal.BeginFetch<DocTypeNVL>((o, e) => { _list = e.Object; callback(o, e); }); else callback(null, new DataPortalResult<DocTypeNVL>(_list, null, null)); } #endregion #region Constructor /// <summary> /// Initializes a new instance of the <see cref="DocTypeNVL"/> class. /// </summary> /// <remarks> Do not use to create a Csla object. Use factory methods instead.</remarks> [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public DocTypeNVL() { // Use factory methods and do not use direct creation. } #endregion #region Data Access /// <summary> /// Loads a <see cref="DocTypeNVL"/> collection from the database or from the cache. /// </summary> protected void DataPortal_Fetch() { if (IsCached) { LoadCachedList(); return; } using (var cn = new SqlConnection(Database.DocStoreConnection)) { using (var cmd = new SqlCommand("GetDocTypeNVL", cn)) { cmd.CommandType = CommandType.StoredProcedure; cn.Open(); var args = new DataPortalHookArgs(cmd); OnFetchPre(args); LoadCollection(cmd); OnFetchPost(args); } } _list = this; } private void LoadCachedList() { IsReadOnly = false; var rlce = RaiseListChangedEvents; RaiseListChangedEvents = false; AddRange(_list); RaiseListChangedEvents = rlce; IsReadOnly = true; } private void LoadCollection(SqlCommand cmd) { IsReadOnly = false; var rlce = RaiseListChangedEvents; RaiseListChangedEvents = false; using (var dr = new SafeDataReader(cmd.ExecuteReader())) { while (dr.Read()) { Add(new NameValuePair( dr.GetInt32("DocTypeID"), dr.GetString("DocTypeName"))); } } RaiseListChangedEvents = rlce; IsReadOnly = true; } #endregion #region DataPortal Hooks /// <summary> /// Occurs after setting query parameters and before the fetch operation. /// </summary> partial void OnFetchPre(DataPortalHookArgs args); /// <summary> /// Occurs after the fetch operation (object or collection is fully loaded and set up). /// </summary> partial void OnFetchPost(DataPortalHookArgs args); #endregion } }
{ "content_hash": "cbda3892195e72b1333c3fb0b5411711", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 97, "avg_line_length": 29.71345029239766, "alnum_prop": 0.503247392245621, "repo_name": "CslaGenFork/CslaGenFork", "id": "5bf45a99c9304c765b5b20a61f74e5e65e761f57", "size": "5245", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "trunk/CoverageTest/Plain/Plain-WIN-CS/DocStore.Business/DocTypeNVL.Designer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "4816094" }, { "name": "Assembly", "bytes": "73066" }, { "name": "C#", "bytes": "12314305" }, { "name": "C++", "bytes": "313681" }, { "name": "HTML", "bytes": "30950" }, { "name": "PHP", "bytes": "35716" }, { "name": "PLpgSQL", "bytes": "2164471" }, { "name": "Pascal", "bytes": "1244" }, { "name": "PowerShell", "bytes": "1687" }, { "name": "SourcePawn", "bytes": "500196" }, { "name": "Visual Basic", "bytes": "3027224" } ], "symlink_target": "" }
package org.springframework.security.web.server.authentication.logout; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import reactor.core.publisher.Mono; import org.springframework.core.log.LogMessage; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.context.ReactiveSecurityContextHolder; import org.springframework.security.web.server.WebFilterExchange; import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher; import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatchers; import org.springframework.util.Assert; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebFilter; import org.springframework.web.server.WebFilterChain; /** * If the request matches, logs an authenticated user out by delegating to a * {@link ServerLogoutHandler}. * * @author Rob Winch * @author Mathieu Ouellet * @since 5.0 */ public class LogoutWebFilter implements WebFilter { private static final Log logger = LogFactory.getLog(LogoutWebFilter.class); private AnonymousAuthenticationToken anonymousAuthenticationToken = new AnonymousAuthenticationToken("key", "anonymous", AuthorityUtils.createAuthorityList("ROLE_ANONYMOUS")); private ServerLogoutHandler logoutHandler = new SecurityContextServerLogoutHandler(); private ServerLogoutSuccessHandler logoutSuccessHandler = new RedirectServerLogoutSuccessHandler(); private ServerWebExchangeMatcher requiresLogout = ServerWebExchangeMatchers.pathMatchers(HttpMethod.POST, "/logout"); @Override public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { return this.requiresLogout.matches(exchange).filter((result) -> result.isMatch()) .switchIfEmpty(chain.filter(exchange).then(Mono.empty())).map((result) -> exchange) .flatMap(this::flatMapAuthentication).flatMap((authentication) -> { WebFilterExchange webFilterExchange = new WebFilterExchange(exchange, chain); return logout(webFilterExchange, authentication); }); } private Mono<Authentication> flatMapAuthentication(ServerWebExchange exchange) { return exchange.getPrincipal().cast(Authentication.class).defaultIfEmpty(this.anonymousAuthenticationToken); } private Mono<Void> logout(WebFilterExchange webFilterExchange, Authentication authentication) { logger.debug(LogMessage.format("Logging out user '%s' and transferring to logout destination", authentication)); return this.logoutHandler.logout(webFilterExchange, authentication) .then(this.logoutSuccessHandler.onLogoutSuccess(webFilterExchange, authentication)) .subscriberContext(ReactiveSecurityContextHolder.clearContext()); } /** * Sets the {@link ServerLogoutSuccessHandler}. The default is * {@link RedirectServerLogoutSuccessHandler}. * @param logoutSuccessHandler the handler to use */ public void setLogoutSuccessHandler(ServerLogoutSuccessHandler logoutSuccessHandler) { Assert.notNull(logoutSuccessHandler, "logoutSuccessHandler cannot be null"); this.logoutSuccessHandler = logoutSuccessHandler; } /** * Sets the {@link ServerLogoutHandler}. The default is * {@link SecurityContextServerLogoutHandler}. * @param logoutHandler The handler to use */ public void setLogoutHandler(ServerLogoutHandler logoutHandler) { Assert.notNull(logoutHandler, "logoutHandler must not be null"); this.logoutHandler = logoutHandler; } public void setRequiresLogoutMatcher(ServerWebExchangeMatcher requiresLogoutMatcher) { Assert.notNull(requiresLogoutMatcher, "requiresLogoutMatcher must not be null"); this.requiresLogout = requiresLogoutMatcher; } }
{ "content_hash": "8bf15bd21a7a63c1fb977383e7d9e187", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 114, "avg_line_length": 42.84615384615385, "alnum_prop": 0.8153372659656322, "repo_name": "djechelon/spring-security", "id": "5f888db0f9417d65e80be1e480658f0dd634378f", "size": "4520", "binary": false, "copies": "3", "ref": "refs/heads/bugfix/20214-principal-claim-name-null", "path": "web/src/main/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AspectJ", "bytes": "3352" }, { "name": "Groovy", "bytes": "87440" }, { "name": "HTML", "bytes": "115" }, { "name": "Java", "bytes": "10726244" }, { "name": "JavaScript", "bytes": "10" }, { "name": "PLSQL", "bytes": "3180" }, { "name": "Python", "bytes": "129" }, { "name": "Shell", "bytes": "809" }, { "name": "XSLT", "bytes": "2344" } ], "symlink_target": "" }
$('#form_presupuestos').validate({ errorElement: 'span', //default input error message container errorClass: 'help-inline', // default input error message class focusInvalid: false, // do not focus the last invalid input ignore: "", rules: { presupuesto_id: { required: true }, unidad_id: { required: true }, status_id: { required: true }, descripcion: { required: true }, cantidad: { number: true, required: true }, rendimiento: { number: true, required: true } }, invalidHandler: function (event, validator) { //display error alert on form submit $('.alert-success').hide(); $('.alert-error').show(); //App.scrollTo(error1, -200); }, submitHandler: function (form) { //$('.alert-success').show(); $('.alert-error').hide(); form.submit(); }, highlight: function (element) { // hightlight error inputs $(element).closest('.help-inline').removeClass('ok'); // display OK icon $(element).closest('.control-group').removeClass('success').addClass('error'); // set error class to the control group }, unhighlight: function (element) { // revert the change dony by hightlight $(element).closest('.control-group').removeClass('error'); // set error class to the control group }, success: function (label) { label.addClass('valid').addClass('help-inline ok') // mark the current input as valid and display OK icon .closest('.control-group').removeClass('error').addClass('success'); // set success class to the control group } });
{ "content_hash": "2380cec1af8b24f5f9905137164fa372", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 126, "avg_line_length": 33.074074074074076, "alnum_prop": 0.5615901455767077, "repo_name": "zentraedi/vialda-ci3", "id": "57dbb830499d6fefe638e70f51bf4cbbd903454c", "size": "1786", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/modules/partidas/views/validacion_nuevo.php", "mode": "33261", "license": "mit", "language": [ { "name": "ASP", "bytes": "298" }, { "name": "ApacheConf", "bytes": "772" }, { "name": "CSS", "bytes": "2617265" }, { "name": "CoffeeScript", "bytes": "83631" }, { "name": "Erlang", "bytes": "5336" }, { "name": "HTML", "bytes": "4240037" }, { "name": "JavaScript", "bytes": "5895360" }, { "name": "PHP", "bytes": "5116974" }, { "name": "Shell", "bytes": "444" } ], "symlink_target": "" }
.custom-navbar { border-radius: 0 !important; border: none !important; margin-bottom: 0 !important; position: absolute !important; width: 100% !important; z-index: 10 !important; } .custom-navbar ul{ text-align: right; margin-right: -6vw; float: right; } .custom-navbar ul li{ display: inline-block; font-size: 14px; font-weight: 300; text-transform: uppercase; } .custom-navbar ul li:last-child{ margin-right: 0; } .custom-navbar ul li a{ color: #878787 !important; display: block; } .custom-navbar ul li a:hover{ color: #fff; border-bottom: 2px solid #158dd3; } .custom-navbar ul .active a{ color: #fff !important; border-bottom: 2px solid #158dd3 !important; } .custom-navbar ul .active > a{ border: none; background-color: transparent !important; } .logo { float: left; width: 305px; padding: 23px 0; margin-left: -1vw; } .nav-bar-items{ padding: 10px 0 }
{ "content_hash": "7cfe7d585e2197195f5927122cfaa917", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 48, "avg_line_length": 19.510204081632654, "alnum_prop": 0.647489539748954, "repo_name": "ahsan-virani/react-gcd-portal", "id": "0602a55c82656d34469427556750fe4cc88cea6e", "size": "956", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/components/AppHeader/styles.css", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1787" }, { "name": "CSS", "bytes": "4853" }, { "name": "HTML", "bytes": "9994" }, { "name": "JavaScript", "bytes": "136152" } ], "symlink_target": "" }
require 'spec_helper' describe Eve::API::Services::Eve do context "#conquerable_station_list" do subject { mock_service(:eve, :conquerable_station_list).outposts } it "follows expected structure" do subject.should behave_like_rowset("stationID,stationName,stationTypeID,solarSystemID,corporationID,corporationName") end end end
{ "content_hash": "b027e7e93080b40269f78a29f71dff4f", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 122, "avg_line_length": 32, "alnum_prop": 0.7556818181818182, "repo_name": "sinisterchipmunk/eve", "id": "8f546ee5cb6c957a8bdf030af5b7e18639cbd7ac", "size": "352", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "spec/lib/eve/api/calls/eve/conquerable_station_list_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "148973" } ], "symlink_target": "" }
class Room < ActiveRecord::Base end
{ "content_hash": "d29b8c377ebf6b47b34dd27cdc80c123", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 31, "avg_line_length": 18, "alnum_prop": 0.7777777777777778, "repo_name": "joshjeong/playlist.en-sinatra", "id": "b9632b1cb7b9fa88777972e4e1c7ca26e6fdc72d", "size": "36", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "app/models/room.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "7664" }, { "name": "JavaScript", "bytes": "2903" }, { "name": "Ruby", "bytes": "11908" } ], "symlink_target": "" }
/* * Maps (thread-safe). * * Maps do not allow duplicate items in the domain. Adding a mapping for an * item already in the domain overwrites the old mapping for that item. */ #ifndef COLLECTIONS__MAP_HH #define COLLECTIONS__MAP_HH #include "collections/abstract/collection.hh" #include "collections/abstract/map.hh" #include "collections/list.hh" #include "collections/pointers/auto_collection.hh" #include "collections/set.hh" #include "concurrent/threads/synchronization/locks/auto_read_lock.hh" #include "concurrent/threads/synchronization/locks/auto_write_lock.hh" #include "concurrent/threads/synchronization/synchronizables/unsynchronized.hh" #include "functors/comparable_functors.hh" #include "lang/exceptions/ex_invalid_argument.hh" #include "lang/iterators/iterator.hh" #include "lang/null.hh" #include "lang/pointers/auto_ptr.hh" namespace collections { /* * Imports. */ using collections::abstract::collection; using collections::pointers::auto_collection; using concurrent::threads::synchronization::locks::auto_read_lock; using concurrent::threads::synchronization::locks::auto_write_lock; using concurrent::threads::synchronization::synchronizables::unsynchronized; using functors::comparable_functor; using functors::compare_functors; using lang::exceptions::ex_invalid_argument; using lang::iterators::iterator; using lang::pointers::auto_ptr; /* * Declare classes for iterators over elements in the domain of the map. */ template <typename T, typename U, typename Syn> class map_iterator; template <typename T, typename U, typename Syn> class map_iterator_reverse; /* * Maps. */ template <typename T, typename U, typename Syn = unsynchronized> class map : public abstract::map<T,U>, protected Syn { public: /* * Friend classes. */ friend class map_iterator<T,U,Syn>; friend class map_iterator_reverse<T,U,Syn>; /* * Define the iterator types. */ typedef map_iterator<T,U,Syn> iterator_t; typedef map_iterator_reverse<T,U,Syn> iterator_reverse_t; /* * Constructor. * Return an empty map. * Optionally specify the comparison function to use for domain elements. */ map( const comparable_functor<T>& = compare_functors<T>::f_compare() ); /* * Constructor. * Create a map containing the mappings t -> u for corresponding elements * of the given collections. Optionally specify the comparison function * to use for domain elements. */ explicit map( const collection<T>&, const collection<U>&, const comparable_functor<T>& = compare_functors<T>::f_compare() ); /* * Constructor. * Create a map with the same contents as the given map. * Optionally specify the comparison function to use for domain elements. */ explicit map( const abstract::map<T,U>&, const comparable_functor<T>& = compare_functors<T>::f_compare() ); /* * Copy constructor. */ map(const map<T,U,Syn>&); /* * Destructor. */ virtual ~map(); /* * Add the mapping t -> u, overwriting any existing mapping for t. * Return a reference to the map. */ map<T,U,Syn>& add(T& /* t */, U& /* u */); /* * Add the mapping t -> u for corresponding elements of the collections. * Overwriting previous mappings if they exist. * The collections must have the same size. * Return a reference to the map. */ map<T,U,Syn>& add(const collection<T>&, const collection<U>&); /* * Add all mappings in the given map to the current map. * Overwriting previous mappings if they exist. * Return a reference to the map. */ map<T,U,Syn>& add(const abstract::map<T,U>&); /* * Remove element(s) and their corresponding images from the map. * Return a reference to the map. */ map<T,U,Syn>& remove(const T&); map<T,U,Syn>& remove(const collection<T>&); /* * Clear the map, resetting it to the empty map. * Return a reference to the map. */ map<T,U,Syn>& clear(); /* * Search. * Return the element in the domain matching the given element. * Throw an exception (ex_not_found) when attempting to find an element not * contained in the map. */ bool contains(const T&) const; T& find(const T&) const; /* * Search. * Return the image of the given domain element under the map. * Throw an exception (ex_not_found) when attempting to find the image of * an element not contained in the map. */ U& find_image(const T&) const; /* * Size. * Return the number of elements in the domain. */ unsigned long size() const; /* * Return a list of elements in the domain of the map and a list of their * corresponding images in the range. Hence, range() does not necessarily * return a unique list of elements as two or more elements of the domain * might have the same image. */ list<T> domain() const; list<U> range() const; /* * Return lists of elements in the domain and range. * This method allows one to atomically capture the contents of a map if * there is a potential for the map to change between calls of the above * domain() and range() methods. */ void contents( auto_ptr< collections::list<T> >&, /* domain */ auto_ptr< collections::list<U> >& /* range */ ) const; /* * Return iterators over elements in the domain. */ auto_ptr< iterator<T> > iter_create() const; auto_ptr< iterator<T> > iter_reverse_create() const; protected: /************************************************************************ * Map data structures. ************************************************************************/ /* * Image of an element under a map. */ class map_image { public: /* * Constructor. */ explicit map_image(U& item) : u(item) { } /* * Copy constructor. */ map_image(const map_image& m) : u(m.u) { } /* * Destructor. */ ~map_image() { /* do nothing */ } /* * Data. */ U& u; }; /* * Mapping between elements. */ class mapping { public: /* * Constructor. * Create a t -> NULL mapping. */ explicit mapping(T& t_item) : t(t_item), img(NULL) { } /* * Constructor. * Create a t -> u mapping. */ explicit mapping(T& t_item, U& u_item) : t(t_item), img(new map_image(u_item)) { } /* * Copy constructor. */ mapping(const mapping& m) : t(m.t), img((m.img.get() != NULL) ? (new map_image(*(m.img))) : NULL) { } /* * Destructor. */ ~mapping() { /* do nothing */ } /* * Data. */ T& t; auto_ptr<map_image> img; }; /* * Comparison functor on mappings. * Call the given compare functor on the corresponding domain elements. */ class mapping_compare_functor : public comparable_functor<mapping> { public: /* * Constructor. */ explicit mapping_compare_functor(const comparable_functor<T>& f) : _f(f) { } /* * Copy constructor. */ explicit mapping_compare_functor(const mapping_compare_functor& f) : _f(f._f) { } /* * Comparison function. */ int operator()(const mapping& m0, const mapping& m1) const { return _f(m0.t, m1.t); } protected: const comparable_functor<T>& _f; }; /* * Map data. */ const mapping_compare_functor _f_compare; /* comparison functor */ auto_collection< mapping, set<mapping> > _set; /* set of mappings */ /************************************************************************ * Map helper functions. ************************************************************************/ /* * Add a mapping to the map. */ void add_mapping(T&, U&); /* * Remove an element and its image from the map. */ void remove_item(const T&); }; /* * Map iterator. */ template <typename T, typename U, typename Syn = unsynchronized> class map_iterator : public iterator<T> { public: /* * Constructor. */ explicit map_iterator(const map<T,U,Syn>&); /* * Copy constructor. */ map_iterator(const map_iterator<T,U,Syn>&); /* * Destructor. */ virtual ~map_iterator(); /* * Check if there is another item available. */ bool has_next() const; /* * Return the next item. * Throw an exception (ex_not_found) if there are no more items. */ T& next(); protected: /* * Iterator data. */ const map<T,U,Syn>& _m; /* map being iterated over */ auto_read_lock<const Syn> _rlock; /* read lock on map */ set_iterator<typename map<T,U,Syn>::mapping> _map_iter; /* iterator over mappings */ }; /* * Map reverse iterator. */ template <typename T, typename U, typename Syn = unsynchronized> class map_iterator_reverse : public iterator<T> { public: /* * Constructor. */ explicit map_iterator_reverse(const map<T,U,Syn>&); /* * Copy constructor. */ map_iterator_reverse(const map_iterator_reverse<T,U,Syn>&); /* * Destructor. */ virtual ~map_iterator_reverse(); /* * Check if there is another item available. */ bool has_next() const; /* * Return the next item. * Throw an exception (ex_not_found) if there are no more items. */ T& next(); protected: /* * Iterator data. */ const map<T,U,Syn>& _m; /* map being iterated over */ auto_read_lock<const Syn> _rlock; /* read lock on map */ set_iterator_reverse<typename map<T,U,Syn>::mapping> _map_iter; /* iterator over mappings */ }; /*************************************************************************** * Map iterator implementation. ***************************************************************************/ /* * Constructors. * Initialize iterator over mappings. */ template <typename T, typename U, typename Syn> map_iterator<T,U,Syn>::map_iterator(const map<T,U,Syn>& m) : _m(m), _rlock(_m), _map_iter(*(_m._set)) { } template <typename T, typename U, typename Syn> map_iterator_reverse<T,U,Syn>::map_iterator_reverse(const map<T,U,Syn>& m) : _m(m), _rlock(_m), _map_iter(*(_m._set)) { } /* * Copy constructors. */ template <typename T, typename U, typename Syn> map_iterator<T,U,Syn>::map_iterator( const map_iterator<T,U,Syn>& i) : _m(i._m), _rlock(_m), _map_iter(i._map_iter) { } template <typename T, typename U, typename Syn> map_iterator_reverse<T,U,Syn>::map_iterator_reverse( const map_iterator_reverse<T,U,Syn>& i) : _m(i._m), _rlock(_m), _map_iter(i._map_iter) { } /* * Destructors. * Do nothing as the map is automatically unlocked upon destruction of the * read lock. */ template <typename T, typename U, typename Syn> map_iterator<T,U,Syn>::~map_iterator() { /* do nothing */ } template <typename T, typename U, typename Syn> map_iterator_reverse<T,U,Syn>::~map_iterator_reverse() { /* do nothing */ } /* * Check if there is another item available. */ template <typename T, typename U, typename Syn> bool map_iterator<T,U,Syn>::has_next() const { return _map_iter.has_next(); } template <typename T, typename U, typename Syn> bool map_iterator_reverse<T,U,Syn>::has_next() const { return _map_iter.has_next(); } /* * Return the next item. * Throw an exception (ex_not_found) if there are no more items. */ template <typename T, typename U, typename Syn> T& map_iterator<T,U,Syn>::next() { return _map_iter.next().t; } template <typename T, typename U, typename Syn> T& map_iterator_reverse<T,U,Syn>::next() { return _map_iter.next().t; } /*************************************************************************** * Map implementation. ***************************************************************************/ /* * Constructor. * Return an empty map that uses the given comparison function for domain * elements. */ template <typename T, typename U, typename Syn> map<T,U,Syn>::map(const comparable_functor<T>& f) : Syn(), _f_compare(f), _set(new set<mapping>(_f_compare)) { } /* * Constructor. * Create a map containing the mappings t -> u for corresponding elements * of the given collections. Specify the comparison function to use for * domain elements. */ template <typename T, typename U, typename Syn> map<T,U,Syn>::map( const collection<T>& c_t, const collection<U>& c_u, const comparable_functor<T>& f) : Syn(), _f_compare(f), _set(new set<mapping>(_f_compare)) { this->add(c_t, c_u); } /* * Constructor. * Create a map with the same contents as the given map. * Specify the comparison function to use for domain elements. */ template <typename T, typename U, typename Syn> map<T,U,Syn>::map( const abstract::map<T,U>& m, const comparable_functor<T>& f) : Syn(), _f_compare(f), _set(new set<mapping>(_f_compare)) { this->add(m); } /* * Copy constructor. */ template <typename T, typename U, typename Syn> map<T,U,Syn>::map(const map<T,U,Syn>& m) : Syn(), _f_compare(m._f_compare), _set(new set<mapping>(_f_compare)) { typename set<mapping>::iterator_t i(*(m._set)); while (i.has_next()) { mapping& mppng = i.next(); this->add_mapping(mppng.t, mppng.img->u); } } /* * Destructor. */ template <typename T, typename U, typename Syn> map<T,U,Syn>::~map() { /* do nothing */ } /* * Add a mapping to the map. */ template <typename T, typename U, typename Syn> void map<T,U,Syn>::add_mapping(T& t, U& u) { auto_ptr<mapping> m(new mapping(t,u)); if (_set->contains(*m)) { mapping& m_match = _set->find(*m); _set->remove(m_match); delete &m_match; } _set->add(*m); m.release(); } /* * Add the mapping t -> u, overwriting any existing mapping for t. * Return a reference to the map. */ template <typename T, typename U, typename Syn> map<T,U,Syn>& map<T,U,Syn>::add(T& t, U& u) { auto_write_lock<const Syn> wlock(*this); this->add_mapping(t, u); return *this; } /* * Add the mapping t -> u for corresponding elements of the collections. * Overwriting previous mappings if they exist. * The collections must have the same size. * Return a reference to the map. */ template <typename T, typename U, typename Syn> map<T,U,Syn>& map<T,U,Syn>::add( const collection<T>& c_t, const collection<U>& c_u) { list<T> lst_t(c_t); list<U> lst_u(c_u); if (c_t.size() != c_u.size()) throw ex_invalid_argument( "collections being add to map must have the same size" ); typename list<T>::iterator_t i_t(lst_t); typename list<U>::iterator_t i_u(lst_u); auto_write_lock<const Syn> wlock(*this); while (i_t.has_next()) this->add_mapping(i_t.next(), i_u.next()); return *this; } /* * Add all mappings in the given map to the current map. * Overwriting previous mappings if they exist. * Return a reference to the map. */ template <typename T, typename U, typename Syn> map<T,U,Syn>& map<T,U,Syn>::add(const abstract::map<T,U>& m) { auto_ptr< list<T> > domain; auto_ptr< list<U> > range; m.contents(domain, range); return this->add(*domain, *range); } /* * Remove an element and its image from the map. */ template <typename T, typename U, typename Syn> void map<T,U,Syn>::remove_item(const T& t) { mapping m(const_cast<T&>(t)); /* const_cast is safe here */ if (_set->contains(m)) { mapping& m_match = _set->find(m); _set->remove(m_match); delete &m_match; } } /* * Remove element(s) and their corresponding images from the map. * Return a reference to the map. */ template <typename T, typename U, typename Syn> map<T,U,Syn>& map<T,U,Syn>::remove(const T& t) { auto_write_lock<const Syn> wlock(*this); this->remove_item(t); return *this; } template <typename T, typename U, typename Syn> map<T,U,Syn>& map<T,U,Syn>::remove(const collection<T>& c_t) { list<T> lst(c_t); auto_write_lock<const Syn> wlock(*this); for (typename list<T>::iterator_t i(lst); i.has_next(); ) this->remove_item(i.next()); return *this; } /* * Clear the map, resetting it to the empty map. * Return a reference to the map. */ template <typename T, typename U, typename Syn> map<T,U,Syn>& map<T,U,Syn>::clear() { auto_write_lock<const Syn> wlock(*this); _set.reset(new set<mapping>(_f_compare)); return *this; } /* * Search. * Return the element in the domain matching the given element. * Throw an exception (ex_not_found) when attempting to find an element not * contained in the map. */ template <typename T, typename U, typename Syn> bool map<T,U,Syn>::contains(const T& t) const { mapping m(const_cast<T&>(t)); /* const_cast is safe here */ auto_read_lock<const Syn> rlock(*this); return _set->contains(m); } template <typename T, typename U, typename Syn> T& map<T,U,Syn>::find(const T& t) const { mapping m(const_cast<T&>(t)); /* const_cast is safe here */ auto_read_lock<const Syn> rlock(*this); mapping& m_match = _set->find(m); return m_match.t; } /* * Search. * Return the image of the given domain element under the map. * Throw an exception (ex_not_found) when attempting to find the image of an * element not contained in the map. */ template <typename T, typename U, typename Syn> U& map<T,U,Syn>::find_image(const T& t) const { mapping m(const_cast<T&>(t)); /* const_cast is safe here */ auto_read_lock<const Syn> rlock(*this); mapping& m_match = _set->find(m); return m_match.img->u; } /* * Size. * Return the number of elements in the domain. */ template <typename T, typename U, typename Syn> unsigned long map<T,U,Syn>::size() const { auto_read_lock<const Syn> rlock(*this); return _set->size(); } /* * Return a list of elements in the domain of the map and a list of their * corresponding images in the range. Hence, range() does not necessarily * return a unique list of elements as two or more elements of the domain * might have the same image. */ template <typename T, typename U, typename Syn> list<T> map<T,U,Syn>::domain() const { list<T> lst; auto_read_lock<const Syn> rlock(*this); typename set<mapping>::iterator_t i(*_set); while (i.has_next()) lst.add(i.next().t); return lst; } template <typename T, typename U, typename Syn> list<U> map<T,U,Syn>::range() const { list<U> lst; auto_read_lock<const Syn> rlock(*this); typename set<mapping>::iterator_t i(*_set); while (i.has_next()) lst.add(i.next().img->u); return lst; } /* * Return lists of elements in the domain and range. */ template <typename T, typename U, typename Syn> void map<T,U,Syn>::contents( auto_ptr< collections::list<T> >& domain, auto_ptr< collections::list<U> >& range) const { domain.reset(new list<T>()); range.reset(new list<U>()); auto_read_lock<const Syn> rlock(*this); typename set<mapping>::iterator_t i(*_set); while (i.has_next()) { mapping& m = i.next(); domain->add(m.t); range->add(m.img->u); } } /* * Return iterators over elements in the domain. */ template <typename T, typename U, typename Syn> auto_ptr< iterator<T> > map<T,U,Syn>::iter_create() const { return auto_ptr< iterator<T> >(new map_iterator<T,U,Syn>(*this)); } template <typename T, typename U, typename Syn> auto_ptr< iterator<T> > map<T,U,Syn>::iter_reverse_create() const { return auto_ptr< iterator<T> >(new map_iterator_reverse<T,U,Syn>(*this)); } } /* namespace collections */ #endif
{ "content_hash": "263b991fdfc1bd071af843a2c7d9863f", "timestamp": "", "source": "github", "line_count": 769, "max_line_length": 98, "avg_line_length": 25.94408322496749, "alnum_prop": 0.6013733647436219, "repo_name": "CVML/rcnn-depth", "id": "12b3c6cc38985fde679fdaf198bac15aa21bcbd3", "size": "19951", "binary": false, "copies": "18", "ref": "refs/heads/master", "path": "mcg/src/external/BSR/include/collections/map.hh", "mode": "33261", "license": "bsd-2-clause", "language": [ { "name": "C++", "bytes": "179274" }, { "name": "M", "bytes": "1622" }, { "name": "Matlab", "bytes": "358588" }, { "name": "Shell", "bytes": "689" } ], "symlink_target": "" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Azure.Identity { internal interface IFileSystemService { bool FileExists(string path); string ReadAllText(string path); } }
{ "content_hash": "452a7aa1d5e5b346b634d63937fbd4d7", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 61, "avg_line_length": 23.636363636363637, "alnum_prop": 0.6961538461538461, "repo_name": "hyonholee/azure-sdk-for-net", "id": "a6b2366cd9d7f079f0b8abba516c1cc987e6b730", "size": "262", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "sdk/identity/Azure.Identity/src/IFileSystemService.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "16774" }, { "name": "C#", "bytes": "37415276" }, { "name": "HTML", "bytes": "234899" }, { "name": "JavaScript", "bytes": "7875" }, { "name": "PowerShell", "bytes": "273940" }, { "name": "Shell", "bytes": "13061" }, { "name": "Smarty", "bytes": "11135" }, { "name": "TypeScript", "bytes": "143209" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <sem:triples uri="http://www.lds.org/vrl/specific-people/latter-day-figures/brimhall-preston" xmlns:sem="http://marklogic.com/semantics"> <sem:triple> <sem:subject>http://www.lds.org/vrl/specific-people/latter-day-figures/brimhall-preston</sem:subject> <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate> <sem:object datatype="xsd:string" xml:lang="eng">Brimhall, Preston</sem:object> </sem:triple> <sem:triple> <sem:subject>http://www.lds.org/vrl/specific-people/latter-day-figures/brimhall-preston</sem:subject> <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate> <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object> </sem:triple> <sem:triple> <sem:subject>http://www.lds.org/vrl/specific-people/latter-day-figures/brimhall-preston</sem:subject> <sem:predicate>http://www.lds.org/core#entityType</sem:predicate> <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object> </sem:triple> </sem:triples>
{ "content_hash": "94627e886243cdcf13242f3ce57e22d0", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 137, "avg_line_length": 60, "alnum_prop": 0.7222222222222222, "repo_name": "freshie/ml-taxonomies", "id": "9771dbf308b97d6cdfad84fd366adc35100b1b55", "size": "1080", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "roxy/data/gospel-topical-explorer-v2/taxonomies/vrl/specific-people/latter-day-figures/brimhall-preston.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4422" }, { "name": "CSS", "bytes": "38665" }, { "name": "HTML", "bytes": "356" }, { "name": "JavaScript", "bytes": "411651" }, { "name": "Ruby", "bytes": "259121" }, { "name": "Shell", "bytes": "7329" }, { "name": "XQuery", "bytes": "857170" }, { "name": "XSLT", "bytes": "13753" } ], "symlink_target": "" }
<APIManager> <!-- JNDI name of the data source to be used by the API publisher, API store and API key manager. This data source should be defined in the master-datasources.xml file in conf/datasources directory. --> <DataSourceName>jdbc/WSO2AM_DB</DataSourceName> <!-- This parameter is used when adding api management capability to other products like GReg, AS, DSS etc.--> <GatewayType>Synapse</GatewayType> <!-- This parameter is used to enable the securevault support when try to publish endpoint secured APIs. Values should be "true" or "false". By default secure vault is disabled.--> <EnableSecureVault>false</EnableSecureVault> <!-- Authentication manager configuration for API publisher and API store. This is a required configuration for both web applications as their user authentication logic relies on this. --> <AuthManager> <!-- Server URL of the Authentication service --> <ServerURL>https://${carbon.local.ip}:${mgt.transport.https.port}${carbon.context}/services/</ServerURL> <!-- Admin username for the Authentication manager. --> <Username>${admin.username}</Username> <!-- Admin password for the Authentication manager. --> <Password>${admin.password}</Password> <!-- Indicates whether the permissions checking of the user (on the Publisher and Store) should be done via a remote service. The check will be done on the local server when false. --> <CheckPermissionsRemotely>false</CheckPermissionsRemotely> </AuthManager> <JWTConfiguration> <!-- Enable/Disable JWT generation. Default is false. --> <!-- EnableJWTGeneration>false</EnableJWTGeneration--> <!-- Name of the security context header to be added to the validated requests. --> <JWTHeader>X-JWT-Assertion</JWTHeader> <!-- Fully qualified name of the class that will retrieve additional user claims to be appended to the JWT. If not specified no claims will be appended.If user wants to add all user claims in the jwt token, he needs to enable this parameter. The DefaultClaimsRetriever class adds user claims from the default carbon user store. --> <!--ClaimsRetrieverImplClass>org.wso2.carbon.apimgt.impl.token.DefaultClaimsRetriever</ClaimsRetrieverImplClass--> <!-- The dialectURI under which the claimURIs that need to be appended to the JWT are defined. Not used with custom ClaimsRetriever implementations. The same value is used in the keys for appending the default properties to the JWT. --> <!--ConsumerDialectURI>http://wso2.org/claims</ConsumerDialectURI--> <!-- Signature algorithm. Accepts "SHA256withRSA" or "NONE". To disable signing explicitly specify "NONE". --> <!--SignatureAlgorithm>SHA256withRSA</SignatureAlgorithm--> <!-- This parameter specifies which implementation should be used for generating the Token. JWTGenerator is the default implementation provided. --> <JWTGeneratorImpl>org.wso2.carbon.apimgt.keymgt.token.JWTGenerator</JWTGeneratorImpl> <!-- This parameter specifies which implementation should be used for generating the Token. For URL safe JWT Token generation the implementation is provided in URLSafeJWTGenerator --> <!--<JWTGeneratorImpl>org.wso2.carbon.apimgt.keymgt.token.URLSafeJWTGenerator</JWTGeneratorImpl>--> <!-- Remove UserName from JWT Token --> <!-- <RemoveUserNameFromJWTForApplicationToken>true</RemoveUserNameFromJWTForApplicationToken>--> </JWTConfiguration> <!-- Primary/secondary login configuration for APIstore. If user likes to keep two login attributes in a distributed setup, to login the APIstore, he should configure this section. Primary login doesn't have a claimUri associated with it. But secondary login, which is a claim attribute, is associated with a claimuri.--> <LoginConfig> <UserIdLogin primary="true"> <ClaimUri></ClaimUri> </UserIdLogin> <EmailLogin primary="false"> <ClaimUri>http://wso2.org/claims/emailaddress</ClaimUri> </EmailLogin> </LoginConfig> <!-- Credentials for the API gateway admin server. This configuration is mainly used by the API publisher and store to connect to the API gateway and create/update published API configurations. --> <APIGateway> <!-- The environments to which an API will be published --> <Environments> <!-- Environments can be of different types. Allowed values are 'hybrid', 'production' and 'sandbox'. An API deployed on a 'production' type gateway will only support production keys An API deployed on a 'sandbox' type gateway will only support sandbox keys An API deployed on a 'hybrid' type gateway will support both production and sandbox keys. --> <!-- api-console element specifies whether the environment should be listed in API Console or not --> <Environment type="hybrid" api-console="true"> <Name>Production and Sandbox</Name> <Description> Description of environment</Description> <!-- Server URL of the API gateway --> <ServerURL>https://${carbon.local.ip}:${mgt.transport.https.port}${carbon.context}/services/</ServerURL> <!-- Admin username for the API gateway. --> <Username>${admin.username}</Username> <!-- Admin password for the API gateway.--> <Password>${admin.password}</Password> <!-- Endpoint URLs for the APIs hosted in this API gateway.--> <GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port}</GatewayEndpoint> </Environment> </Environments> </APIGateway> <CacheConfigurations> <!-- Enable/Disable token caching at the Gateway--> <EnableGatewayTokenCache>true</EnableGatewayTokenCache> <!-- Enable/Disable API resource caching at the Gateway--> <EnableGatewayResourceCache>true</EnableGatewayResourceCache> <!-- Enable/Disable API key validation information caching at key-management server --> <EnableKeyManagerTokenCache>false</EnableKeyManagerTokenCache> <!-- This parameter specifies whether Recently Added APIs will be loaded from the cache or not. If there are multiple API modification during a short time period, better to disable cache. --> <EnableRecentlyAddedAPICache>false</EnableRecentlyAddedAPICache> <!-- JWT claims Cache expiry in seconds --> <!--JWTClaimCacheExpiry>900</JWTClaimCacheExpiry--> <!-- Expiry time for the apim key mgt validation info cache --> <!--TokenCacheExpiry>900</TokenCacheExpiry--> <!-- This parameter specifies the expiration time of the TagCache. TagCache will only be created when this element is uncommented. When the specified time duration gets elapsed ,tag cache will get re-generated. --> <!--TagCacheDuration>120000</TagCacheDuration--> </CacheConfigurations> <!-- API usage tracker configuration used by the DAS data publisher and Google Analytics publisher in API gateway. --> <Analytics> <!-- Enable Analytics for API Manager --> <!--Enabled>false</Enabled--> <!-- Server URL of the remote DAS/CEP server used to collect statistics. Must be specified in protocol://hostname:port/ format. An event can also be published to multiple Receiver Groups each having 1 or more receivers. Receiver Groups are delimited by curly braces whereas receivers are delimited by commas. Ex - Multiple Receivers within a single group tcp://localhost:7612/,tcp://localhost:7613/,tcp://localhost:7614/ Ex - Multiple Receiver Groups with two receivers each {tcp://localhost:7612/,tcp://localhost:7613},{tcp://localhost:7712/,tcp://localhost:7713/} --> <DASServerURL>{tcp://localhost:7612}</DASServerURL> <!-- Administrator username to login to the remote DAS server. --> <DASUsername>admin</DASUsername> <!-- Administrator password to login to the remote DAS server. --> <DASPassword>admin</DASPassword> <!-- For APIM implemented Statistic client for DAS REST API --> <StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatsProviderImpl> <!-- For APIM implemented Statistic client for RDBMS --> <!--StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRdbmsClientImpl</StatsProviderImpl--> <!-- DAS REST API configuration Set the values if .'org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl' is used as Statistic Client --> <DASRestApiURL>https://localhost:9444</DASRestApiURL> <DASRestApiUsername>admin</DASRestApiUsername> <DASRestApiPassword>admin</DASRestApiPassword> <!-- Below property is used to skip trying to connect to event receiver nodes when publishing events even if the stats enabled flag is set to true. --> <SkipEventReceiverConnection>false</SkipEventReceiverConnection> <!-- API Usage Data Publisher. --> <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass> <!-- If below property set to true,then the response message size will be calculated and publish with each successful API invocation event. --> <PublishResponseMessageSize>false</PublishResponseMessageSize> <!-- Data publishing stream names and versions of API requests, responses and faults. If the default values are changed, the toolbox also needs to be changed accordingly. --> <Streams> <Request> <Name>org.wso2.apimgt.statistics.request</Name> <Version>1.1.0</Version> </Request> <Response> <Name>org.wso2.apimgt.statistics.response</Name> <Version>1.1.0</Version> </Response> <Fault> <Name>org.wso2.apimgt.statistics.fault</Name> <Version>1.0.0</Version> </Fault> <Destination> <Name>org_wso2_apimgt_statistics_destination</Name> <Version>1.0.0</Version> <BAMProfileName>bam-profile</BAMProfileName> </Destination> <Throttle> <Name>org.wso2.apimgt.statistics.throttle</Name> <Version>1.0.0</Version> </Throttle> <Workflow> <Name>org.wso2.apimgt.statistics.workflow</Name> <Version>1.0.0</Version> </Workflow> <ExecutionTime> <Name>org.wso2.apimgt.statistics.execution.time</Name> <Version>1.0.0</Version> </ExecutionTime> </Streams> </Analytics> <NotificationsEnabled>false</NotificationsEnabled> <!-- API key validator configuration used by API key manager (IS), API store and API gateway. API gateway uses it to validate and authenticate users against the provided API keys. --> <APIKeyValidator> <!-- Server URL of the API key manager --> <ServerURL>https://${carbon.local.ip}:${mgt.transport.https.port}${carbon.context}/services/</ServerURL> <!-- Admin username for API key manager. --> <Username>${admin.username}</Username> <!-- Admin password for API key manager. --> <Password>${admin.password}</Password> <!-- Configurations related to enable thrift support for key-management related communication. If you want to switch back to Web Service Client, change the value of "KeyValidatorClientType" to "WSClient". In a distributed environment; -If you are at the Gateway node, you need to point "ThriftClientPort" value to the "ThriftServerPort" value given at KeyManager node. -If you need to start two API Manager instances in the same machine, you need to give different ports to "ThriftServerPort" value in two nodes. -ThriftServerHost - Allows to configure a hostname for the thrift server. It uses the carbon hostname by default. -The Gateway uses this parameter to connect to the key validation thrift service. --> <KeyValidatorClientType>ThriftClient</KeyValidatorClientType> <ThriftClientPort>10397</ThriftClientPort> <ThriftClientConnectionTimeOut>10000</ThriftClientConnectionTimeOut> <ThriftServerPort>10397</ThriftServerPort> <!--ThriftServerHost>localhost</ThriftServerHost--> <EnableThriftServer>true</EnableThriftServer> <!-- Specifies the implementation to be used for KeyValidationHandler. Steps for validating a token can be controlled by plugging in a custom KeyValidation Handler --> <KeyValidationHandlerClassName>org.wso2.carbon.apimgt.keymgt.handlers.DefaultKeyValidationHandler</KeyValidationHandlerClassName> </APIKeyValidator> <!-- Uncomment this section only if you are going to have an instance other than KeyValidator as your KeyManager. Unless a ThirdParty KeyManager is used, you don't need to configure this section. --> <!--APIKeyManager> <KeyManagerClientImpl>org.wso2.carbon.apimgt.keymgt.AMDefaultKeyManagerImpl</KeyManagerClientImpl> <Configuration> <ServerURL>https://${carbon.local.ip}:${mgt.transport.https.port}${carbon.context}/services/</ServerURL> <Username>${admin.username}</Username> <Password>${admin.password}</Password> <TokenURL>https://${carbon.local.ip}:${https.nio.port}/token</TokenURL> <RevokeURL>https://${carbon.local.ip}:${https.nio.port}/revoke</RevokeURL> </Configuration> </APIKeyManager--> <OAuthConfigurations> <!-- Remove OAuth headers from outgoing message. --> <!--RemoveOAuthHeadersFromOutMessage>true</RemoveOAuthHeadersFromOutMessage--> <!-- Scope used for marking Application Tokens. If a token is generated with this scope, they will be treated as Application Access Tokens --> <ApplicationTokenScope>am_application_scope</ApplicationTokenScope> <!-- All scopes under the ScopeWhitelist element are not validating against roles that has assigned to it. By default ^device_.* and openid scopes have been white listed internally. --> <!--ScopeWhitelist> <Scope>^device_.*</Scope> <Scope>openid</Scope> </ScopeWhitelist--> <!-- Name of the token API --> <TokenEndPointName>/oauth2/token</TokenEndPointName> <!-- This the API URL for revoke API. When we revoke tokens revoke requests should go through this API deployed in API gateway. Then it will do cache invalidations related to revoked tokens. In distributed deployment we should configure this property in key manager node by pointing gateway https( /http, we recommend users to use 'https' endpoints for security purpose) url. Also please note that we should point gateway revoke service to key manager --> <RevokeAPIURL>https://${carbon.local.ip}:${https.nio.port}/revoke</RevokeAPIURL> <!-- Whether to encrypt tokens when storing in the Database Note: If changing this value to true, change the value of <TokenPersistenceProcessor> to org.wso2.carbon.identity.oauth.tokenprocessor.EncryptionDecryptionPersistenceProcessor in the identity.xml --> <EncryptPersistedTokens>false</EncryptPersistedTokens> </OAuthConfigurations> <!-- Settings related to managing API access tiers. --> <TierManagement> <!-- Enable the providers to expose their APIs over the special 'Unlimited' tier which basically disables tier based throttling for the specified APIs. --> <EnableUnlimitedTier>true</EnableUnlimitedTier> </TierManagement> <!-- API Store Related Configurations --> <APIStore> <!--GroupingExtractor>org.wso2.carbon.apimgt.impl.DefaultGroupIDExtractorImpl</GroupingExtractor--> <!--This property is used to indicate how we do user name comparision for token generation https://wso2.org/jira/browse/APIMANAGER-2225--> <CompareCaseInsensitively>true</CompareCaseInsensitively> <DisplayURL>false</DisplayURL> <URL>https://${carbon.local.ip}:${mgt.transport.https.port}/store</URL> <!-- Server URL of the API Store. --> <ServerURL>https://${carbon.local.ip}:${mgt.transport.https.port}${carbon.context}/services/</ServerURL> <!-- Admin username for API Store. --> <Username>${admin.username}</Username> <!-- Admin password for API Store. --> <Password>${admin.password}</Password> <!-- This parameter specifies whether to display multiple versions of same API or only showing the latest version of an API. --> <DisplayMultipleVersions>false</DisplayMultipleVersions> <!-- This parameter specifies whether to display all the APIs [which are having DEPRECATED/PUBLISHED status] or only display the APIs with having their status is as 'PUBLISHED' --> <DisplayAllAPIs>false</DisplayAllAPIs> <!-- Uncomment this to limit the number of APIs in api the API Store --> <!--APIsPerPage>5</APIsPerPage--> <!-- This parameter specifies whether to display the comment editing facility or not. Default is "true". If user wants to disable, he must set this param as "false" --> <DisplayComments>true</DisplayComments> <!-- This parameter specifies whether to display the ratings or not. Default is "true". If user wants to disable, he must set this param as "false" --> <DisplayRatings>true</DisplayRatings> </APIStore> <APIPublisher> <DisplayURL>false</DisplayURL> <URL>https://${carbon.local.ip}:${mgt.transport.https.port}/publisher</URL> <!-- This parameter specifies enabling the capability of setting API documentation level granular visibility levels. By default any document associate with an API will have the same permissions set as the API.With enabling below property,it will show two additional permission levels as visible only to all registered users in a particular domain or only visible to API doc creator --> <!--EnableAPIDocVisibilityLevels>true</EnableAPIDocVisibilityLevels--> <!-- Uncomment this to limit the number of APIs in api the API Publisher --> <!--APIsPerPage>30</APIsPerPage--> </APIPublisher> <!-- Status observers can be registered against the API Publisher to listen for API status update events. Each observer must implement the APIStatusObserver interface. Multiple observers can be engaged if necessary and in such situations they will be notified in the order they are defined here. This configuration is unused from API Manager version 1.10.0 --> <!--StatusObservers> <Observer>org.wso2.carbon.apimgt.impl.observers.SimpleLoggingObserver</Observer> </StatusObservers--> <!-- Use this configuration Create APIs at the Server startup --> <StartupAPIPublisher> <!-- Enable/Disable the API Startup Publisher --> <Enabled>false</Enabled> <!-- Configuration to create APIs for local endpoints. Endpoint will be computed as http://${carbon.local.ip}:${mgt.transport.http.port}/Context. Define many LocalAPI elements as below to create many APIs for local Endpoints. IconPath should be relative to CARBON_HOME. --> <LocalAPIs> <LocalAPI> <Context>/resource</Context> <Provider>admin</Provider> <Version>1.0.0</Version> <IconPath>none</IconPath> <DocumentURL>none</DocumentURL> <AuthType>Any</AuthType> </LocalAPI> </LocalAPIs> <!-- Configuration to create APIs for remote endpoints. When Endpoint need to be defined use this configuration. Define many API elements as below to create many APIs for external Endpoints. If you do not need to add Icon or Documentation set 'none' as the value for IconPath & DocumentURL. --> <!--APIs> <API> <Context>/resource</Context> <Endpoint>http://localhost:9764/resource</Endpoint> <Provider>admin</Provider> <Version>1.0.0</Version> <IconPath>none</IconPath> <DocumentURL>none</DocumentURL> <AuthType>Any</AuthType> </API> </APIs--> </StartupAPIPublisher> <!-- Configuration to enable/disable sending CORS headers in the Gateway response and define the Access-Control-Allow-Origin header value.--> <CORSConfiguration> <!-- Configuration to enable/disable sending CORS headers from the Gateway--> <Enabled>true</Enabled> <!-- The value of the Access-Control-Allow-Origin header. Default values are API Store addresses, which is needed for swagger to function. --> <Access-Control-Allow-Origin>*</Access-Control-Allow-Origin> <!-- Configure Access-Control-Allow-Methods --> <Access-Control-Allow-Methods>GET,PUT,POST,DELETE,PATCH,OPTIONS</Access-Control-Allow-Methods> <!-- Configure Access-Control-Allow-Headers --> <Access-Control-Allow-Headers>authorization,Access-Control-Allow-Origin,Content-Type</Access-Control-Allow-Headers> <!-- Configure Access-Control-Allow-Credentials --> <!-- Specifying this header to true means that the server allows cookies (or other user credentials) to be included on cross-origin requests. It is false by default and if you set it to true then make sure that the Access-Control-Allow-Origin header does not contain the wildcard (*) --> <Access-Control-Allow-Credentials>false</Access-Control-Allow-Credentials> </CORSConfiguration> <!-- This property is there to configure velocity log output into existing Log4j carbon Logger. You can enable this and set preferable Logger name. --> <!-- VelocityLogger>VELOCITY</VelocityLogger --> <RESTAPI> <!--Configure white-listed URIs of REST API. Accessing white-listed URIs does not require credentials (does not require Authorization header). --> <WhiteListedURIs> <WhiteListedURI> <URI>/api/am/store/{version}/apis</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/apis/{apiId}</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/apis/{apiId}/swagger</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/apis/{apiId}/documents</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/apis/{apiId}/documents/{documentId}</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/apis/{apiId}/documents/{documentId}/content</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/tags</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/tiers/{tierLevel}</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> <WhiteListedURI> <URI>/api/am/store/{version}/tiers/{tierLevel}/{tierName}</URI> <HTTPMethods>GET,HEAD</HTTPMethods> </WhiteListedURI> </WhiteListedURIs> </RESTAPI> </APIManager>
{ "content_hash": "ca3b09765842168dfc5c085e150d128e", "timestamp": "", "source": "github", "line_count": 443, "max_line_length": 158, "avg_line_length": 56.207674943566595, "alnum_prop": 0.6552610441767068, "repo_name": "thilinicooray/product-apim", "id": "b5ad9446322f4bd9a0b118b74981932046a6e34f", "size": "24900", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "modules/integration/tests-platform/src/test/resources/artifacts/AM/configFiles/emailusernametest/api-manager.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "11443" }, { "name": "CSS", "bytes": "69611" }, { "name": "HTML", "bytes": "52067" }, { "name": "Java", "bytes": "3359437" }, { "name": "JavaScript", "bytes": "327461" }, { "name": "PLSQL", "bytes": "76784" }, { "name": "Shell", "bytes": "14704" }, { "name": "XSLT", "bytes": "3161" } ], "symlink_target": "" }
<?php namespace Traction\Test\Request; use Traction\Request\PromotionGroupReport; class PromotionGroupReportTest extends \PHPUnit_Framework_TestCase { public function testPackable() { $this->assertInstanceOf('Traction\Request\PackableInterface', new PromotionGroupReport); } public function testRequestable() { $this->assertInstanceOf('Traction\Request\RequestableInterface', new PromotionGroupReport); } public function testValidPath() { $obj = new PromotionGroupReport; $this->assertTrue(is_string($obj->getPath())); $this->assertStringStartsWith('/', $obj->getPath()); } }
{ "content_hash": "a8ab75e4ec613dd61bb0cb402eeddc9d", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 99, "avg_line_length": 25.26923076923077, "alnum_prop": 0.6971080669710806, "repo_name": "noetix/traction-php", "id": "b6c1447244801b9f73127f1ea914df04b35c7d53", "size": "657", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/Traction/Test/Request/PromotionGroupReportTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "64084" } ], "symlink_target": "" }
<bill session="110" type="h" number="3795" updated="2009-01-09T00:48:43-05:00"> <status><introduced date="1191988800" datetime="2007-10-10"/></status> <introduced date="1191988800" datetime="2007-10-10"/> <titles> <title type="short" as="introduced">You Were There, You Get Care Act of 2007</title> <title type="official" as="introduced">To amend title 38, United States Code, to provide that veterans of service in the 1991 Persian Gulf War and subsequent conflicts shall be considered to be radiation-exposed veterans for purposes of the service-connection of certain diseases and disabilities, and for other purposes.</title> </titles> <sponsor id="400133"/> <cosponsors> </cosponsors> <actions> <action date="1191988800" datetime="2007-10-10"><text>Sponsor introductory remarks on measure. (CR E2120)</text></action> <action date="1191988800" datetime="2007-10-10"><text>Referred to the House Committee on Veterans' Affairs.</text></action> <action date="1192420800" datetime="2007-10-15"><text>Referred to the Subcommittee on Disability Assistance and Memorial Affairs.</text></action> <action date="1213243200" datetime="2008-06-12"><text>Subcommittee Hearings Held.</text></action> </actions> <committees> </committees> <relatedbills> </relatedbills> <subjects> </subjects> <amendments> </amendments> <summary> 10/10/2007--Introduced.<br/>You Were There, You Get Care Act of 2007 - Presumes specified diseases, and any other disease found by the Secretary of Veterans Affairs to result from exposure to depleted uranium or the byproducts of the burn-off that occurs when a depleted uranium munition penetrates a target, among those diseases that will be presumed to be service-connected (and therefore compensable) when appearing in radiation-exposed veterans. Includes, for purposes of such coverage, service during the Persian Gulf War or any subsequent conflict in which depleted uranium munitions are used. Directs the Secretary to provide for an independent medical study to determine other diseases that may result from exposure to depleted uranium. Requires study results to be submitted to the congressional veterans' committees.<br/> </summary> </bill>
{ "content_hash": "69dbea9329da02e8667ca7297f88446e", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 832, "avg_line_length": 64.91176470588235, "alnum_prop": 0.7680108744902583, "repo_name": "hashrocket/localpolitics.in", "id": "9692e59150f9104f22b823b2c2c6ad4b7d95e85c", "size": "2207", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/govtrack/110_bills/h3795.xml", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "155887" }, { "name": "Ruby", "bytes": "147059" } ], "symlink_target": "" }
module MnAuthorizers class TestAuthorizer def self.for_create 'Create Authorizer in Engine. ' end def test_method 'instance method in engine. ' end end end
{ "content_hash": "775f5a5b59ce014f0ae424837d5fb071", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 39, "avg_line_length": 17.363636363636363, "alnum_prop": 0.6544502617801047, "repo_name": "shobhit-m/meta_notification", "id": "88f35bb47aaa6c92f83531ca8d1b9651c7b99ebf", "size": "191", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/mn_authorizers/test_authorizer.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1372" }, { "name": "HTML", "bytes": "7818" }, { "name": "JavaScript", "bytes": "1192" }, { "name": "Ruby", "bytes": "80196" } ], "symlink_target": "" }
package com.example.friendlybeijing.Utils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Bitmap.CompressFormat; import android.os.Environment; public class LocalCacheUtils { public static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath(); private MemoryCacheUtils memoryCacheUtils; public LocalCacheUtils(MemoryCacheUtils memoryCacheUtils) { // TODO Auto-generated constructor stub this.memoryCacheUtils = memoryCacheUtils; } public void setBitmapToLocal(String url,Bitmap bitmap) { String filename = MD5Utils.enCode(url); File file = new File(CACHE_PATH + "/friendlybeijing/"+filename);//创建一个文件夹放置图片 try { bitmap.compress(CompressFormat.JPEG, 100, new FileOutputStream(file)); memoryCacheUtils.setBitmapToMemory(url, bitmap); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public Bitmap getBitmapFromLocal(String url) { String filename = MD5Utils.enCode(url); File file = new File(CACHE_PATH + "/friendlybeijing/"+filename); if(file.exists()) { try { return BitmapFactory.decodeStream(new FileInputStream(file)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } else { return null; } } }
{ "content_hash": "dfadaf8193950222315cc2cbe7c9f301", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 101, "avg_line_length": 29.235294117647058, "alnum_prop": 0.7565392354124748, "repo_name": "lsmtty/FriendlyBeijing", "id": "f50f07a7e31588764f44457ff477f6559208fc54", "size": "1513", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/com/example/friendlybeijing/Utils/LocalCacheUtils.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "216301" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using FluentAssertions; using Newtonsoft.Json.Linq; namespace CSharpLiteWriterUnitTests { public static class ObjectExtensions { public static JObject ToJObject(this object @object) { return JObject.FromObject(@object); } public static object GetPropertyValue(this object @object, string propertyName) { return GetPropertyValue<object>(@object, propertyName); } public static T GetPropertyValue<T>(this object @object, string propertyName) { return (T) @object.GetType().GetProperty(propertyName).GetValue(@object); } public static object GetPropertyValue(this object @object, Type @interface, string propertyName) { return GetPropertyValue<object>(@object, @interface, propertyName); } public static T GetPropertyValue<T>(this object @object, Type @interface, string propertyName) { return (T) @interface.GetProperty(propertyName).GetValue(@object); } public static void SetPropertyValue(this object @object, string propertyName, object value) { @object.GetType().GetProperty(propertyName).SetValue(@object, value); } public static void SetPropertyValues(this object @object, IEnumerable<Tuple<string, object>> propertyValues) { foreach (var propertyValue in propertyValues) { if (propertyValue.Item2 != null) @object.SetPropertyValue(propertyValue.Item1, propertyValue.Item2); } } public static object InvokeMethod(this object @object, string methodName, object[] args = null) { return InvokeMethod<object>(@object, methodName, args: args); } public static T InvokeMethod<T>(this object @object, string methodName, object[] args = null, Type[] types = null, string @interface = null) { args = args ?? new object[0]; var type = @object.GetType(); var method = string.IsNullOrEmpty(@interface) ? @object.GetType().GetMethod(methodName) : type.GetInterface(@interface).GetMethod(methodName); if (types != null) method = method.MakeGenericMethod(types); return (T) method.Invoke(@object, args); } public static object GetIndexerValue(this object @object, object[] args = null) { return @object.InvokeMethod("get_Item", args); } public static T GetIndexerValue<T>(this object @object, object[] args = null, string @interface = null) { return @object.InvokeMethod<T>("get_Item", args: args, @interface: @interface); } public static void ValidateCollectionPropertyValues(this object collection, IList<IEnumerable<Tuple<string, object>>> entitiesProperties) { var responses = ((IEnumerable<object>)collection).ToList(); responses.Count.Should().Be(entitiesProperties.Count()); for (int x = 0; x < responses.Count; x++) { ValidatePropertyValues(responses[x], entitiesProperties[x]); } } public static void ValidatePropertyValues(this object instance, IEnumerable<Tuple<string, object>> propertyValues) { foreach (var keyValue in propertyValues) { instance.GetPropertyValue(keyValue.Item1) .Should().Be(keyValue.Item2); } } } }
{ "content_hash": "f6f5e620e304c8b803f7e79d78e4f839", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 145, "avg_line_length": 35.94174757281554, "alnum_prop": 0.6121015667206915, "repo_name": "v-am/Vipr", "id": "f77f6d8cbc513592aebad6c3f55c117c50a3f88a", "size": "3704", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/CSharpLiteWriterUnitTests/ObjectExtensions.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "227" }, { "name": "Batchfile", "bytes": "2367" }, { "name": "C#", "bytes": "2258157" }, { "name": "Groovy", "bytes": "949" } ], "symlink_target": "" }
<?php defined('_JEXEC') or die; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.formvalidation'); // Load chosen.css JHtml::_('formbehavior.chosen', 'select'); // Get the form fieldsets. $fieldsets = $this->form->getFieldsets(); ?> <script type="text/javascript"> Joomla.submitbutton = function(task) { if (task == 'profile.cancel' || document.formvalidator.isValid(document.id('profile-form'))) { Joomla.submitform(task, document.getElementById('profile-form')); } } </script> <form action="<?php echo JRoute::_('index.php?option=com_admin&view=profile&layout=edit&id='.$this->item->id); ?>" method="post" name="adminForm" id="profile-form" class="form-validate form-horizontal" enctype="multipart/form-data"> <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'account')); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'account', JText::_('COM_ADMIN_USER_ACCOUNT_DETAILS', true)); ?> <?php foreach ($this->form->getFieldset('user_details') as $field) : ?> <div class="control-group"> <div class="control-label"><?php echo $field->label; ?></div> <div class="controls"><?php echo $field->input; ?></div> </div> <?php endforeach; ?> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php foreach ($fieldsets as $fieldset) : if ($fieldset->name == 'user_details') : continue; endif; ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', $fieldset->name, JText::_($fieldset->label, true)); ?> <?php foreach ($this->form->getFieldset($fieldset->name) as $field) : ?> <?php if ($field->hidden) : ?> <div class="control-group"> <div class="controls"><?php echo $field->input; ?></div> </div> <?php else: ?> <div class="control-group"> <div class="control-label"><?php echo $field->label; ?></div> <div class="controls"><?php echo $field->input; ?></div> </div> <?php endif; ?> <?php endforeach; ?> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php endforeach; ?> <?php echo JHtml::_('bootstrap.endTabSet'); ?> <input type="hidden" name="task" value="" /> <?php echo JHtml::_('form.token'); ?> </form>
{ "content_hash": "3eeb854fb8b0773a784ce40ce8bd3571", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 232, "avg_line_length": 33.96923076923077, "alnum_prop": 0.6259057971014492, "repo_name": "OscarMesa/ascolsa", "id": "afe7d95599c80969db495c859a9685d760c26796", "size": "2449", "binary": false, "copies": "101", "ref": "refs/heads/master", "path": "administrator/components/com_admin/views/profile/tmpl/edit.php", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "2477904" }, { "name": "JavaScript", "bytes": "2038053" }, { "name": "PHP", "bytes": "14142843" }, { "name": "Perl", "bytes": "56400" }, { "name": "XSLT", "bytes": "21232" } ], "symlink_target": "" }
<?php namespace Tests\AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DefaultControllerTest extends WebTestCase { public function testIndex() { $client = static::createClient(); $crawler = $client->request('GET', '/fr/'); $container = $client->getContainer(); $this->assertEquals(200, $client->getResponse()->getStatusCode()); //on teste si la balise qui a l'id #container1 qui contient la balise h1 contient bien le dontenue "Welcome to Symfony " $this->assertContains('Welcome to Symfony', $crawler->filter('#container1 h1')->text()); // $this->assertGreaterThan(0, $crawler->filter('h1 ul li')); //on teste un lien sur la page d'accueil, on cible le texte du lien $link = $crawler->selectLink('peinture')->link(); //a partir du contenu recuperer on va sur un autre lien /* $crawler=$crawler->click($link); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertContains('exempleTestASaisir', $crawler->filter('le selecteur du text')->text());*/ dump($crawler); } }
{ "content_hash": "6d2c3f6fb4aa876b483175c7ab85ca1b", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 129, "avg_line_length": 34.11764705882353, "alnum_prop": 0.646551724137931, "repo_name": "jpitard/my_first_symfony", "id": "f0405d0b37a80accc682745880acd7f0db947a91", "size": "1160", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/AppBundle/Controller/DefaultControllerTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3605" }, { "name": "CSS", "bytes": "389251" }, { "name": "HTML", "bytes": "2108730" }, { "name": "JavaScript", "bytes": "2847980" }, { "name": "PHP", "bytes": "192977" } ], "symlink_target": "" }
import List from "src/dataTypes/lists/List"; Polygon3D.prototype = new List(); Polygon3D.prototype.constructor = Polygon3D; /** * @classdesc Polygon3D brings the {@link Polygon} concept into three * dimensions through the use of {@link Point3D}. * * @description Creates a new Polygon3D. * @constructor * @category geometry */ function Polygon3D() { var array = List.apply(this, arguments); array = Polygon3D.fromArray(array); return array; } export default Polygon3D; /** * @todo write docs */ Polygon3D.fromArray = function(array) { var result = List.fromArray(array); result.type = "Polygon3D"; //assign methods to array: return result; };
{ "content_hash": "73b305399eff82a6ad4e3e21be5699db", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 69, "avg_line_length": 23.06896551724138, "alnum_prop": 0.7115097159940209, "repo_name": "fmacias64/moebio_framework", "id": "5a478629368b596aeccdd48cdd5663cbbccedb6c", "size": "669", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "src/dataTypes/geometry/Polygon3D.js", "mode": "33261", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "2641029" } ], "symlink_target": "" }
<?php /* @WebProfiler/Profiler/toolbar_item.html.twig */ class __TwigTemplate_1c73766759537d650dd26c477bda6731e6ec9f9b41b3ac48a5306d9f9900374b extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); $this->parent = false; $this->blocks = array( ); } protected function doDisplay(array $context, array $blocks = array()) { $__internal_94e2fcbe4fb1c7a08d3f247cc4e8cf50c46a337354188f6f148c870ae5e2e78d = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"); $__internal_94e2fcbe4fb1c7a08d3f247cc4e8cf50c46a337354188f6f148c870ae5e2e78d->enter($__internal_94e2fcbe4fb1c7a08d3f247cc4e8cf50c46a337354188f6f148c870ae5e2e78d_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "@WebProfiler/Profiler/toolbar_item.html.twig")); $__internal_be258556d7824ead690df787bbb5e0dea52dd6a16e43477683f767c572eda12e = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $__internal_be258556d7824ead690df787bbb5e0dea52dd6a16e43477683f767c572eda12e->enter($__internal_be258556d7824ead690df787bbb5e0dea52dd6a16e43477683f767c572eda12e_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "@WebProfiler/Profiler/toolbar_item.html.twig")); // line 1 echo "<div class=\"sf-toolbar-block sf-toolbar-block-"; echo twig_escape_filter($this->env, (isset($context["name"]) ? $context["name"] : $this->getContext($context, "name")), "html", null, true); echo " sf-toolbar-status-"; echo twig_escape_filter($this->env, ((array_key_exists("status", $context)) ? (_twig_default_filter((isset($context["status"]) ? $context["status"] : $this->getContext($context, "status")), "normal")) : ("normal")), "html", null, true); echo " "; echo twig_escape_filter($this->env, ((array_key_exists("additional_classes", $context)) ? (_twig_default_filter((isset($context["additional_classes"]) ? $context["additional_classes"] : $this->getContext($context, "additional_classes")), "")) : ("")), "html", null, true); echo "\" "; echo ((array_key_exists("block_attrs", $context)) ? (_twig_default_filter((isset($context["block_attrs"]) ? $context["block_attrs"] : $this->getContext($context, "block_attrs")), "")) : ("")); echo "> "; // line 2 if (( !array_key_exists("link", $context) || (isset($context["link"]) ? $context["link"] : $this->getContext($context, "link")))) { echo "<a href=\""; echo twig_escape_filter($this->env, $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("_profiler", array("token" => (isset($context["token"]) ? $context["token"] : $this->getContext($context, "token")), "panel" => (isset($context["name"]) ? $context["name"] : $this->getContext($context, "name")))), "html", null, true); echo "\">"; } // line 3 echo " <div class=\"sf-toolbar-icon\">"; echo twig_escape_filter($this->env, ((array_key_exists("icon", $context)) ? (_twig_default_filter((isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon")), "")) : ("")), "html", null, true); echo "</div> "; // line 4 if (((array_key_exists("link", $context)) ? (_twig_default_filter((isset($context["link"]) ? $context["link"] : $this->getContext($context, "link")), false)) : (false))) { echo "</a>"; } // line 5 echo " <div class=\"sf-toolbar-info\">"; echo twig_escape_filter($this->env, ((array_key_exists("text", $context)) ? (_twig_default_filter((isset($context["text"]) ? $context["text"] : $this->getContext($context, "text")), "")) : ("")), "html", null, true); echo "</div> </div> "; $__internal_94e2fcbe4fb1c7a08d3f247cc4e8cf50c46a337354188f6f148c870ae5e2e78d->leave($__internal_94e2fcbe4fb1c7a08d3f247cc4e8cf50c46a337354188f6f148c870ae5e2e78d_prof); $__internal_be258556d7824ead690df787bbb5e0dea52dd6a16e43477683f767c572eda12e->leave($__internal_be258556d7824ead690df787bbb5e0dea52dd6a16e43477683f767c572eda12e_prof); } public function getTemplateName() { return "@WebProfiler/Profiler/toolbar_item.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 51 => 5, 47 => 4, 42 => 3, 36 => 2, 25 => 1,); } /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ public function getSource() { @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); return $this->getSourceContext()->getCode(); } public function getSourceContext() { return new Twig_Source("<div class=\"sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }} {{ additional_classes|default('') }}\" {{ block_attrs|default('')|raw }}> {% if link is not defined or link %}<a href=\"{{ path('_profiler', { token: token, panel: name }) }}\">{% endif %} <div class=\"sf-toolbar-icon\">{{ icon|default('') }}</div> {% if link|default(false) %}</a>{% endif %} <div class=\"sf-toolbar-info\">{{ text|default('') }}</div> </div> ", "@WebProfiler/Profiler/toolbar_item.html.twig", "C:\\wamp64\\www\\Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bundle\\WebProfilerBundle\\Resources\\views\\Profiler\\toolbar_item.html.twig"); } }
{ "content_hash": "2ec3e67703d5b25363c5d7b962a3b8e4", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 366, "avg_line_length": 58.79381443298969, "alnum_prop": 0.6379098719971945, "repo_name": "Salimghb/Symfony_OC", "id": "749e42386b16457d69274308904296e1a8ef9550", "size": "5703", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "var/cache/dev/twig/2b/2b6c72d6160ff803cef9b781b8b6aef9b2cc9cfd7addff34f0bd2315a4142fb0.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3605" }, { "name": "HTML", "bytes": "11567" }, { "name": "PHP", "bytes": "99444" } ], "symlink_target": "" }
<?php class frameworkError { private $error_types = array( 1 => array('name' => 'Database Connection Error', 'report' => true), 2 => array('name' => 'Framework Usage Error', 'report' => false), 3 => array('name' => 'MySQL Error', 'report' => true) ); protected $error_msg_snippets = array( 1 => "The first argument should be your SQL statement with each input value as a '?' and then each subsequent argument as the type:value. EXAMPLE: fw::prep('SELECT * FROM products WHERE cat_name = ? AND online = ?', 'text:house wares', 'int:1')->select();" ); public function error($message, $type, $line, $file, $shutdown=false) { $output = "<strong>ERROR: "; $output .= $this->error_types[$type]['name'] . "</strong> - $message (Line: <strong>$line</strong> in File: <strong>$file</strong>)"; echo $output; //Report database connection errors to idesign central. if(!App::get('debug.set') && $type == 1) firebridge::reportError(2, $output, 100, 'N/A', $line, $file); if($shutdown) exit(); } public function traceOutError() { $back_report = debug_backtrace(); $framework_root = stristr(__FILE__, "/framework/", true) . "/framework/"; $found = false; $return['line'] = __LINE__; $return['file'] = __FILE__; foreach($back_report as $report) { $check_file = substr($report['file'], 0, strlen($framework_root)); if($check_file != $framework_root && !$found) { $found = true; $return['line'] = $report['line']; $return['file'] = $report['file']; } } return $return; } public function logSqlError($sqlStatement, $type, $error_msg) { //Check if error_sql tabel exists and if not then create table $this->checkErrorTableExists(); $uri_parts = explode('?',$_SERVER['REQUEST_URI']); $uri = $uri_parts[0]; $this->prep(array("INSERT INTO " . FRAME_SQL_ERROR_TABLE . "(`sql`, `type`, uri, userIP, errorMsg, getVars, postVars, `date`) VALUES (?,?,?,?,?,?,?,CURRENT_TIMESTAMP)", "text:" . $sqlStatement, "text:" . $type, "text:" . $uri, "text:" . $_SERVER['REMOTE_ADDR'], "text:" . $error_msg, "text:" . serialize($_GET), "text:" . serialize($_POST)))->query($this->sql, "ERROR"); if(!App::get('debug.set')) { $level = ($type = 'SELECT') ? 25 : 75 ; $error = $this->traceOutError(); firebridge::reportError(2, $error_msg, $level, $uri, $error['line'], $error['file']); } } public function checkErrorTableExists() { $this->preparedStatement = false; $this->result = $this->query("SELECT COUNT(*) AS count FROM information_schema.tables WHERE table_schema = '" .FRAME_DB_NAME . "' AND table_name = '" . FRAME_SQL_ERROR_TABLE . "'", null, true); $this->advanceRow(); if (!$this->row['count']){ //table_name doesn't exist so create table $this->query("CREATE TABLE ".FRAME_SQL_ERROR_TABLE." ( `errorID` int(11) unsigned NOT NULL auto_increment, `sql` text, `type` varchar(50) default NULL, `uri` text default NULL, `userIP` varchar(50) default NULL, `errorMsg` text, `getVars` text default NULL, `postVars` text default NULL, `date` timestamp NULL default NULL, PRIMARY KEY (`errorID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;", null, true); } } }
{ "content_hash": "f3f1d977c14a62b5197952975b0d1d47", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 202, "avg_line_length": 37.42574257425743, "alnum_prop": 0.5264550264550265, "repo_name": "imphatic/webapplight", "id": "d335a6f3be921b840c2efed1b8b4d323d37654de", "size": "3780", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "www.webapplight.dev/_app/modules/framework/lib/error.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1815" }, { "name": "CSS", "bytes": "7597" }, { "name": "JavaScript", "bytes": "1836" }, { "name": "PHP", "bytes": "174313" } ], "symlink_target": "" }
<?php class Google_Service_Vault_DriveOptions extends Google_Model { public $includeTeamDrives; public $versionDate; public function setIncludeTeamDrives($includeTeamDrives) { $this->includeTeamDrives = $includeTeamDrives; } public function getIncludeTeamDrives() { return $this->includeTeamDrives; } public function setVersionDate($versionDate) { $this->versionDate = $versionDate; } public function getVersionDate() { return $this->versionDate; } }
{ "content_hash": "c2b656fe9b2d097914caf3e4ed8ff83e", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 60, "avg_line_length": 19.92, "alnum_prop": 0.7228915662650602, "repo_name": "philnewman/scoutbook", "id": "43a489284bf2be6ac2c100e7458b0e7c01102094", "size": "1088", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "includes/vendor/google/apiclient-services/src/Google/Service/Vault/DriveOptions.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "266" }, { "name": "JavaScript", "bytes": "1177" }, { "name": "PHP", "bytes": "61859" } ], "symlink_target": "" }
<?php /** * Afrikaans language file * * @author Shaun Adlam <[email protected]> */ $this->language = array( 'clear_date' => 'Maak datum skoon', 'csrf_detected' => 'Daar was "n probleem met jou voorlegging ! <br> Moontlike oorsake kan wees dat die voorlegging te lank geneem het , of dit word dubbel versoek. <br> Probeer asseblief weer..', 'days' => array('Sondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrydag','Saterdag'), 'days_abbr' => false, // sal die eerste 2 letters te gebruik van die volle naam 'months' => array('Januarie','Februarie','Maart','April','Mei','Junie','Julie','Augustus','September','Oktober','November','Desember'), 'months_abbr' => false, // sal gebruik om die eerste 3 letters van die volle naam 'new_captcha' => 'Kry nuwe kode', 'other' => 'Ander...', 'select' => '- Kies Opsie -', 'spam_detected' => 'Moontlike plapos poging opgemerk . Die geposte vorm data is verwerp.', 'today' => 'Vandag', ); ?>
{ "content_hash": "2240224b7638d0ad1699f26376aa3e1e", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 199, "avg_line_length": 41.84, "alnum_prop": 0.6080305927342257, "repo_name": "marti3961/cwa", "id": "6be35adc1d27b876175598907fe26c829586a345", "size": "1046", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "application/libraries/Zebra_Form/languages/afrikaans.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "240" }, { "name": "CSS", "bytes": "46668" }, { "name": "HTML", "bytes": "8794" }, { "name": "JavaScript", "bytes": "167840" }, { "name": "PHP", "bytes": "2394522" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="dpl-info" content="status=complete"> <title>手风琴</title> <link href="../../Controls/Core/assets/styles/Base.css" rel="stylesheet" type="text/css"> <link href="../../Controls/Tab/assets/styles/Accordion.css" rel="stylesheet" type="text/css" /> <script src="../../System/Core/assets/scripts/Base.js" type="text/javascript"></script> <script src="../../System/Dom/assets/scripts/Base.js" type="text/javascript"></script> <script src="../../System/Utils/assets/scripts/Deferrable.js" type="text/javascript"></script> <script src="../../System/Fx/assets/scripts/Base.js" type="text/javascript"></script> <script src="../../System/Fx/assets/scripts/Tween.js" type="text/javascript"></script> <script src="../../System/Fx/assets/scripts/Animate.js" type="text/javascript"></script> <script src="../../Controls/Core/assets/scripts/Base.js" type="text/javascript"></script> <script src="../../Controls/Core/assets/scripts/TabbableControl.js" type="text/javascript"></script> <script src="../../Controls/Tab/assets/scripts/Accordion.js" type="text/javascript"></script> <script src="../../../assets/demo/demo.js" type="text/javascript"></script> </head> <body> <article class="demo"> <aside class="demo"> <div class="x-accordion" id="accordion"> <div class="x-accordion-panel"> <div class="x-accordion-header"> <a href="javascript:;">标题 title 1 </a> </div> <div class="x-accordion-body"> <div class="x-accordion-content"> 正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content </div> </div> </div> <div class="x-accordion-panel x-accordion-collapsed"> <div class="x-accordion-header"> <a href="javascript:;" class="x-accordion-toggle">标题 title 2 </a> </div> <div class="x-accordion-body"> <div class="x-accordion-content"> 正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content </div> </div> </div> <div class="x-accordion-panel x-accordion-collapsed"> <div class="x-accordion-header"> <a href="javascript:;" class="x-accordion-toggle">标题 title 3 </a> </div> <div class="x-accordion-body collapse"> <div class="x-accordion-content"> 正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content正文content </div> </div> </div> </div> <script> var accordion = new Accordion('accordion'); </script> </aside> <section class="demo"> <script> Demo.writeExamples({ '切换到第2个面板': 'accordion.setSelectedIndex(1)', '增加一个面板': 'accordion.add("标题", "<div class=\'x-tabpage-content\'>内容</div>")', '插入一个面板到第一个位置': 'accordion.addAt(0, "标题", "<div class=\'x-tabpage-content\'>内容</div>")', '删除第1个面板': 'accordion.removeAt(0)' }); </script> </section> </article> </body> </html>
{ "content_hash": "51a8a7d34d75d942f797ecc0191c4842", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 199, "avg_line_length": 44.8, "alnum_prop": 0.5357142857142857, "repo_name": "jplusui/jplusui.github.com", "id": "2b712bd6d6d4271a3d82152a8c2d52567ba5ff14", "size": "4344", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Controls/Tab/Accordion.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "224" }, { "name": "Batchfile", "bytes": "3203" }, { "name": "C#", "bytes": "79170" }, { "name": "CSS", "bytes": "930584" }, { "name": "HTML", "bytes": "3404396" }, { "name": "JavaScript", "bytes": "9327029" }, { "name": "Shell", "bytes": "957" }, { "name": "XSLT", "bytes": "4668" } ], "symlink_target": "" }
namespace sdm { class Subgrad_method : virtual public PrimalSolver { public: Subgrad_method(const std::string &train_libsvm_format, const double &c = 1.0, const double &stpctr = 1e-128, const unsigned int &max_iter = 100); Subgrad_method(const std::string &train_libsvm_format, const std::string &valid_libsvm_format, const double &c = 1.0, const double &stpctr = 1e-128, const unsigned int &max_iter = 300); ~Subgrad_method(); void set_regularized_parameter(const double &c); int get_train_l(void); int get_valid_l(void); int get_valid_n(void); double predict(const Eigen::VectorXd &w) const; Eigen::VectorXd train_warm_start(const Eigen::VectorXd &w); double get_primal_func(const Eigen::VectorXd &w); Eigen::VectorXd get_grad(const Eigen::VectorXd &w); double get_grad_norm(const Eigen::VectorXd &w); std::vector<double> get_c_set_right_opt(const Eigen::VectorXd &w, const double &c_now, double &valid_err); // Eigen::VectorXd train_warm_start_inexact(const Eigen::VectorXd &alpha, // const double inexact_level, // double &ub_validerr, // double &lb_validerr); private: Eigen::SparseMatrix<double, 1, std::ptrdiff_t> train_x_; Eigen::ArrayXd train_y_; int train_l_; int train_n_; double C; double stopping_criterion; unsigned int max_iteration; Eigen::SparseMatrix<double, 1, std::ptrdiff_t> valid_x_; Eigen::ArrayXd valid_y_; int valid_l_; int valid_n_; }; } // namespace sdm #endif
{ "content_hash": "d9dde95244a173b7cfa61321c865e5d5", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 79, "avg_line_length": 33.32692307692308, "alnum_prop": 0.5891517599538373, "repo_name": "takeuchi-lab/RPCVELB", "id": "ba2c1a8d811587697f2553cb79853f63326d5472", "size": "1859", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "problem1/src/Subgrad_method.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "41012" }, { "name": "C++", "bytes": "3287271" }, { "name": "CMake", "bytes": "10563" }, { "name": "Makefile", "bytes": "12946" } ], "symlink_target": "" }
package com.amazonaws.services.kms.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.kms.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import static com.fasterxml.jackson.core.JsonToken.*; /** * RetireGrantResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class RetireGrantResultJsonUnmarshaller implements Unmarshaller<RetireGrantResult, JsonUnmarshallerContext> { public RetireGrantResult unmarshall(JsonUnmarshallerContext context) throws Exception { RetireGrantResult retireGrantResult = new RetireGrantResult(); return retireGrantResult; } private static RetireGrantResultJsonUnmarshaller instance; public static RetireGrantResultJsonUnmarshaller getInstance() { if (instance == null) instance = new RetireGrantResultJsonUnmarshaller(); return instance; } }
{ "content_hash": "f65cb1216abb13c27bb20a2d64d989f5", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 116, "avg_line_length": 30.03030303030303, "alnum_prop": 0.7739656912209889, "repo_name": "dagnir/aws-sdk-java", "id": "342f6dcbe7be906d044a0ede1bc54ea0f1658d88", "size": "1571", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/transform/RetireGrantResultJsonUnmarshaller.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "FreeMarker", "bytes": "157317" }, { "name": "Gherkin", "bytes": "25556" }, { "name": "Java", "bytes": "165755153" }, { "name": "Scilab", "bytes": "3561" } ], "symlink_target": "" }
/* This file is part of cpp-ethereum. cpp-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. cpp-ethereum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. */ /** * @file CommonSubexpressionEliminator.h * @author Christian <[email protected]> * @date 2015 * Optimizer step for common subexpression elimination and stack reorganisation. */ #pragma once #include <vector> #include <map> #include <set> #include <tuple> #include <ostream> #include <libdevcore/CommonIO.h> #include <libdevcore/Exceptions.h> #include <libevmasm/ExpressionClasses.h> #include <libevmasm/SemanticInformation.h> #include <libevmasm/KnownState.h> namespace dev { namespace eth { class AssemblyItem; using AssemblyItems = std::vector<AssemblyItem>; /** * Optimizer step that performs common subexpression elimination and stack reorganisation, * i.e. it tries to infer equality among expressions and compute the values of two expressions * known to be equal only once. * * The general workings are that for each assembly item that is fed into the eliminator, an * equivalence class is derived from the operation and the equivalence class of its arguments. * DUPi, SWAPi and some arithmetic instructions are used to infer equivalences while these * classes are determined. * * When the list of optimized items is requested, they are generated in a bottom-up fashion, * adding code for equivalence classes that were not yet computed. */ class CommonSubexpressionEliminator { public: using Id = ExpressionClasses::Id; using StoreOperation = KnownState::StoreOperation; CommonSubexpressionEliminator(KnownState const& _state): m_initialState(_state), m_state(_state) {} /// Feeds AssemblyItems into the eliminator and @returns the iterator pointing at the first /// item that must be fed into a new instance of the eliminator. template <class _AssemblyItemIterator> _AssemblyItemIterator feedItems(_AssemblyItemIterator _iterator, _AssemblyItemIterator _end); /// @returns the resulting items after optimization. AssemblyItems getOptimizedItems(); private: /// Feeds the item into the system for analysis. void feedItem(AssemblyItem const& _item, bool _copyItem = false); /// Tries to optimize the item that breaks the basic block at the end. void optimizeBreakingItem(); KnownState m_initialState; KnownState m_state; /// Keeps information about which storage or memory slots were written to at which sequence /// number with what instruction. std::vector<StoreOperation> m_storeOperations; /// The item that breaks the basic block, can be nullptr. /// It is usually appended to the block but can be optimized in some cases. AssemblyItem const* m_breakingItem = nullptr; }; /** * Unit that generates code from current stack layout, target stack layout and information about * the equivalence classes. */ class CSECodeGenerator { public: using StoreOperation = CommonSubexpressionEliminator::StoreOperation; using StoreOperations = std::vector<StoreOperation>; using Id = ExpressionClasses::Id; /// Initializes the code generator with the given classes and store operations. /// The store operations have to be sorted by sequence number in ascending order. CSECodeGenerator(ExpressionClasses& _expressionClasses, StoreOperations const& _storeOperations); /// @returns the assembly items generated from the given requirements /// @param _initialSequenceNumber starting sequence number, do not generate sequenced operations /// before this number. /// @param _initialStack current contents of the stack (up to stack height of zero) /// @param _targetStackContents final contents of the stack, by stack height relative to initial /// @note should only be called once on each object. AssemblyItems generateCode( unsigned _initialSequenceNumber, int _initialStackHeight, std::map<int, Id> const& _initialStack, std::map<int, Id> const& _targetStackContents ); private: /// Recursively discovers all dependencies to @a m_requests. void addDependencies(Id _c); /// Produce code that generates the given element if it is not yet present. /// @param _allowSequenced indicates that sequence-constrained operations are allowed void generateClassElement(Id _c, bool _allowSequenced = false); /// @returns the position of the representative of the given id on the stack. /// @note throws an exception if it is not on the stack. int classElementPosition(Id _id) const; /// @returns true if the copy of @a _element can be removed from stack position _fromPosition /// - in general or, if given, while computing @a _result. bool canBeRemoved(Id _element, Id _result = Id(-1), int _fromPosition = c_invalidPosition); /// Appends code to remove the topmost stack element if it can be removed. bool removeStackTopIfPossible(); /// Appends a dup instruction to m_generatedItems to retrieve the element at the given stack position. void appendDup(int _fromPosition, SourceLocation const& _location); /// Appends a swap instruction to m_generatedItems to retrieve the element at the given stack position. /// @note this might also remove the last item if it exactly the same swap instruction. void appendOrRemoveSwap(int _fromPosition, SourceLocation const& _location); /// Appends the given assembly item. void appendItem(AssemblyItem const& _item); static const int c_invalidPosition = -0x7fffffff; AssemblyItems m_generatedItems; /// Current height of the stack relative to the start. int m_stackHeight; /// If (b, a) is in m_requests then b is needed to compute a. std::multimap<Id, Id> m_neededBy; /// Current content of the stack. std::map<int, Id> m_stack; /// Current positions of equivalence classes, equal to the empty set if already deleted. std::map<Id, std::set<int>> m_classPositions; /// The actual eqivalence class items and how to compute them. ExpressionClasses& m_expressionClasses; /// Keeps information about which storage or memory slots were written to by which operations. /// The operations are sorted ascendingly by sequence number. std::map<std::pair<StoreOperation::Target, Id>, StoreOperations> m_storeOperations; /// The set of equivalence classes that should be present on the stack at the end. std::set<Id> m_finalClasses; std::map<int, Id> m_targetStack; }; template <class _AssemblyItemIterator> _AssemblyItemIterator CommonSubexpressionEliminator::feedItems( _AssemblyItemIterator _iterator, _AssemblyItemIterator _end ) { assertThrow(!m_breakingItem, OptimizerException, "Invalid use of CommonSubexpressionEliminator."); for (; _iterator != _end && !SemanticInformation::breaksCSEAnalysisBlock(*_iterator); ++_iterator) feedItem(*_iterator); if (_iterator != _end) m_breakingItem = &(*_iterator++); return _iterator; } } }
{ "content_hash": "d3383c5eba667da4c139e5d2e1f74041", "timestamp": "", "source": "github", "line_count": 183, "max_line_length": 104, "avg_line_length": 39.5792349726776, "alnum_prop": 0.7646003037415435, "repo_name": "xeddmc/cpp-ethereum", "id": "f6c43c57a800d4ea1aeb4d14e46113e77c9d713d", "size": "7243", "binary": false, "copies": "40", "ref": "refs/heads/develop", "path": "libevmasm/CommonSubexpressionEliminator.h", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "7531" }, { "name": "Batchfile", "bytes": "1125" }, { "name": "C", "bytes": "465479" }, { "name": "C++", "bytes": "3347135" }, { "name": "CMake", "bytes": "47756" }, { "name": "HTML", "bytes": "20956" }, { "name": "JavaScript", "bytes": "953260" }, { "name": "Python", "bytes": "2819" }, { "name": "Shell", "bytes": "3981" } ], "symlink_target": "" }
.class Lcom/android/internal/policy/impl/sec/TickerWidget$9; .super Ljava/lang/Object; .source "TickerWidget.java" # interfaces .implements Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer$OnDrawerCloseListener; # annotations .annotation system Ldalvik/annotation/EnclosingMethod; value = Lcom/android/internal/policy/impl/sec/TickerWidget;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/policy/impl/KeyguardScreenCallback;Lcom/android/internal/policy/impl/sec/CircleUnlockWidget;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;)V .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x0 name = null .end annotation # instance fields .field final synthetic this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; # direct methods .method constructor <init>(Lcom/android/internal/policy/impl/sec/TickerWidget;)V .locals 0 .parameter .prologue .line 440 iput-object p1, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V return-void .end method # virtual methods .method public onDrawerClosed()V .locals 2 .prologue .line 443 const-string v0, "TickerWidget" const-string v1, "onDrawerClosed" invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I .line 445 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mUnlockWidget:Lcom/android/internal/policy/impl/sec/CircleUnlockRipple; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$2200(Lcom/android/internal/policy/impl/sec/TickerWidget;)Lcom/android/internal/policy/impl/sec/CircleUnlockRipple; move-result-object v0 if-eqz v0, :cond_0 .line 446 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mUnlockWidget:Lcom/android/internal/policy/impl/sec/CircleUnlockRipple; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$2200(Lcom/android/internal/policy/impl/sec/TickerWidget;)Lcom/android/internal/policy/impl/sec/CircleUnlockRipple; move-result-object v0 invoke-virtual {v0}, Lcom/android/internal/policy/impl/sec/CircleUnlockRipple;->tikerRippleForClose()V .line 449 :cond_0 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mHandleArrowImage:Landroid/widget/ImageView; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$2300(Lcom/android/internal/policy/impl/sec/TickerWidget;)Landroid/widget/ImageView; move-result-object v0 const v1, #android:drawable@keyguard_ticker_handler_ic_arrow_up#t invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V .line 450 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mHandleRefreshImage:Landroid/widget/ImageView; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$1000(Lcom/android/internal/policy/impl/sec/TickerWidget;)Landroid/widget/ImageView; move-result-object v0 const/16 v1, 0x8 invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V .line 452 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mIsDataReady:Z invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$2100(Lcom/android/internal/policy/impl/sec/TickerWidget;)Z move-result v0 if-eqz v0, :cond_1 .line 454 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mHorizontalScrollView:Lcom/android/internal/policy/impl/sec/TickerHorizontalScrollView; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$2000(Lcom/android/internal/policy/impl/sec/TickerWidget;)Lcom/android/internal/policy/impl/sec/TickerHorizontalScrollView; move-result-object v0 const/4 v1, 0x0 invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/sec/TickerHorizontalScrollView;->setVisibility(I)V .line 455 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mHorizontalScrollView:Lcom/android/internal/policy/impl/sec/TickerHorizontalScrollView; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$2000(Lcom/android/internal/policy/impl/sec/TickerWidget;)Lcom/android/internal/policy/impl/sec/TickerHorizontalScrollView; move-result-object v0 invoke-virtual {v0}, Lcom/android/internal/policy/impl/sec/TickerHorizontalScrollView;->startAutoScroll()V .line 456 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mTickerSlidingDrawer:Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$900(Lcom/android/internal/policy/impl/sec/TickerWidget;)Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer; move-result-object v0 iget-object v1, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mTickerSlidingDrawer:Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer; invoke-static {v1}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$900(Lcom/android/internal/policy/impl/sec/TickerWidget;)Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer; move-result-object v1 invoke-virtual {v1}, Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer;->getDefaultBottomOffset()I move-result v1 invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer;->setBottomOffset(I)V .line 457 iget-object v0, p0, Lcom/android/internal/policy/impl/sec/TickerWidget$9;->this$0:Lcom/android/internal/policy/impl/sec/TickerWidget; #getter for: Lcom/android/internal/policy/impl/sec/TickerWidget;->mTickerSlidingDrawer:Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer; invoke-static {v0}, Lcom/android/internal/policy/impl/sec/TickerWidget;->access$900(Lcom/android/internal/policy/impl/sec/TickerWidget;)Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer; move-result-object v0 invoke-virtual {v0}, Lcom/android/internal/policy/impl/sec/TickerSlidingDrawer;->invalidate()V .line 459 :cond_1 return-void .end method
{ "content_hash": "ece3ac7c425646a0ae154e02a2a48b61", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 304, "avg_line_length": 46.78395061728395, "alnum_prop": 0.7755640585829265, "repo_name": "baidurom/devices-n7108", "id": "d414d7983d0f8d7c99bb0e4399fe8b27b35876ff", "size": "7579", "binary": false, "copies": "1", "ref": "refs/heads/coron-4.1", "path": "android.policy.jar.out/smali/com/android/internal/policy/impl/sec/TickerWidget$9.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "12697" }, { "name": "Shell", "bytes": "1974" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_03) on Tue Nov 06 09:34:23 CST 2012 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class org.eclipse.jetty.client.webdav.WebdavSupportedExchange (Jetty :: Aggregate :: All core Jetty 8.1.8.v20121106 API)</title> <meta name="date" content="2012-11-06"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.eclipse.jetty.client.webdav.WebdavSupportedExchange (Jetty :: Aggregate :: All core Jetty 8.1.8.v20121106 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/eclipse/jetty/client/webdav/WebdavSupportedExchange.html" title="class in org.eclipse.jetty.client.webdav">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/eclipse/jetty/client/webdav//class-useWebdavSupportedExchange.html" target="_top">Frames</a></li> <li><a href="WebdavSupportedExchange.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.eclipse.jetty.client.webdav.WebdavSupportedExchange" class="title">Uses of Class<br>org.eclipse.jetty.client.webdav.WebdavSupportedExchange</h2> </div> <div class="classUseContainer">No usage of org.eclipse.jetty.client.webdav.WebdavSupportedExchange</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/eclipse/jetty/client/webdav/WebdavSupportedExchange.html" title="class in org.eclipse.jetty.client.webdav">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/eclipse/jetty/client/webdav//class-useWebdavSupportedExchange.html" target="_top">Frames</a></li> <li><a href="WebdavSupportedExchange.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 1995-2012 <a href="http://www.mortbay.com">Mort Bay Consulting</a>. All Rights Reserved.</small></p> </body> </html>
{ "content_hash": "a4dda2fcb5da144fdb39d8e038a55177", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 173, "avg_line_length": 40.23931623931624, "alnum_prop": 0.6265930331350892, "repo_name": "yayaratta/TP6_MVC", "id": "b0f31f4a2c2f1dce15172d60cb41f975ac0a5657", "size": "4708", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "javadoc/org/eclipse/jetty/client/webdav/class-use/WebdavSupportedExchange.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1706" }, { "name": "HTML", "bytes": "25501" }, { "name": "Java", "bytes": "55668" }, { "name": "JavaScript", "bytes": "28308" }, { "name": "Shell", "bytes": "33033" } ], "symlink_target": "" }
package mblog.core.persist.dao; import java.util.Collection; import java.util.List; import mblog.base.lang.EnumPrivacy; import mblog.core.data.Post; import mblog.core.persist.entity.PostPO; import mtons.modules.persist.BaseRepository; import mtons.modules.pojos.Paging; /** * @author langhsu * */ public interface PostDao extends BaseRepository<PostPO> { /** * 前台查询 * @param paging * @param group * @param ord * @return */ List<PostPO> paging(Paging paging, int group, String ord); /** * 后台查询 * @param paging * @param id * @param title * @param group * @return */ List<PostPO> paging4Admin(Paging paging, long id, String title, int group); /** * 查询指定用户 * @param paging * @param userId * @return */ List<PostPO> pagingByAuthorId(Paging paging, long userId, EnumPrivacy privacy); List<PostPO> findLatests(int maxResults, long ignoreUserId); List<PostPO> findHots(int maxResults, long ignoreUserId); List<PostPO> findByIds(Collection<Long> ids); int maxFeatured(); List<Post> search(Paging paging, String q) throws Exception; List<PostPO> searchByTag(Paging paigng, String tag); void resetIndexs(); }
{ "content_hash": "826381826fcdbcc30561025719987369", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 80, "avg_line_length": 21.10909090909091, "alnum_prop": 0.7131782945736435, "repo_name": "alsolang/mblog", "id": "d59aefd27c1d75459efd05eff882db87d614d0f6", "size": "1505", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "mblog-core/src/main/java/mblog/core/persist/dao/PostDao.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "100042" }, { "name": "HTML", "bytes": "8489" }, { "name": "Java", "bytes": "478746" }, { "name": "JavaScript", "bytes": "73990" } ], "symlink_target": "" }
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M22 6h-3v9H6v3h12l4 4V6zm-5 7V2H2v15l4-4h11z" }), 'QuestionAnswerSharp'); exports.default = _default;
{ "content_hash": "454279b01f617422363e1ddb2c0e83da", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 87, "avg_line_length": 28.833333333333332, "alnum_prop": 0.7167630057803468, "repo_name": "mbrookes/material-ui", "id": "f86c93b66552cffafb7698e8e5109da2db9a3611", "size": "519", "binary": false, "copies": "3", "ref": "refs/heads/next", "path": "packages/material-ui-icons/lib/QuestionAnswerSharp.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2092" }, { "name": "JavaScript", "bytes": "16089809" }, { "name": "TypeScript", "bytes": "1788737" } ], "symlink_target": "" }
ennaji
{ "content_hash": "8622fef75eb55266d8d99ed496c6cb30", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 6, "avg_line_length": 7, "alnum_prop": 0.8571428571428571, "repo_name": "ENNAJI12/ennaji", "id": "4a2866143475b4e9256c49e4fd7a2e934964d8fc", "size": "16", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis { internal partial struct SymbolKey { private static class PropertySymbolKey { public static void Create(IPropertySymbol symbol, SymbolKeyWriter visitor) { visitor.WriteString(symbol.MetadataName); visitor.WriteSymbolKey(symbol.ContainingSymbol); visitor.WriteBoolean(symbol.IsIndexer); visitor.WriteRefKindArray(symbol.Parameters); visitor.WriteParameterTypesArray(symbol.OriginalDefinition.Parameters); } public static int GetHashCode(GetHashCodeReader reader) { return Hash.Combine(reader.ReadString(), Hash.Combine(reader.ReadSymbolKey(), Hash.Combine(reader.ReadBoolean(), Hash.Combine(reader.ReadRefKindArrayHashCode(), reader.ReadSymbolKeyArrayHashCode())))); } public static SymbolKeyResolution Resolve(SymbolKeyReader reader) { var metadataName = reader.ReadString(); var containingSymbolResolution = reader.ReadSymbolKey(); var isIndexer = reader.ReadBoolean(); var refKinds = reader.ReadRefKindArray(); var originalParameterTypes = reader.ReadSymbolKeyArray().Select( r => GetFirstSymbol<ITypeSymbol>(r)).ToArray(); if (originalParameterTypes.Any(s_typeIsNull)) { return default(SymbolKeyResolution); } var properties = containingSymbolResolution.GetAllSymbols().OfType<INamedTypeSymbol>() .SelectMany(t => t.GetMembers()) .OfType<IPropertySymbol>() .Where(p => p.Parameters.Length == refKinds.Length && p.MetadataName == metadataName && p.IsIndexer == isIndexer); var matchingProperties = properties.Where(p => ParameterRefKindsMatch(p.OriginalDefinition.Parameters, refKinds) && reader.ParameterTypesMatch(p.OriginalDefinition.Parameters, originalParameterTypes)); return CreateSymbolInfo(matchingProperties); } } } }
{ "content_hash": "9707f49e380d29f240b52f152dfbc98a", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 161, "avg_line_length": 44.827586206896555, "alnum_prop": 0.5842307692307692, "repo_name": "natidea/roslyn", "id": "d4a2dc1091188a3f89cd37940e802b48f7be6547", "size": "2602", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "src/Workspaces/Core/Portable/SymbolKey/SymbolKey.PropertySymbolKey.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "1C Enterprise", "bytes": "289100" }, { "name": "Batchfile", "bytes": "17269" }, { "name": "C#", "bytes": "83958534" }, { "name": "C++", "bytes": "4865" }, { "name": "F#", "bytes": "3632" }, { "name": "Groovy", "bytes": "9664" }, { "name": "Makefile", "bytes": "3606" }, { "name": "PowerShell", "bytes": "57654" }, { "name": "Shell", "bytes": "7239" }, { "name": "Visual Basic", "bytes": "62285530" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.6.0_27) on Thu Jan 23 20:13:24 EST 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>Message (Lucene 4.6.1 API)</title> <meta name="date" content="2014-01-23"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Message (Lucene 4.6.1 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Message.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>PREV CLASS</li> <li><a href="../../../../../../org/apache/lucene/queryparser/flexible/messages/MessageImpl.html" title="class in org.apache.lucene.queryparser.flexible.messages"><span class="strong">NEXT CLASS</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/lucene/queryparser/flexible/messages/Message.html" target="_top">FRAMES</a></li> <li><a href="Message.html" target="_top">NO FRAMES</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>SUMMARY:&nbsp;</li> <li>NESTED&nbsp;|&nbsp;</li> <li>FIELD&nbsp;|&nbsp;</li> <li>CONSTR&nbsp;|&nbsp;</li> <li><a href="#method_summary">METHOD</a></li> </ul> <ul class="subNavList"> <li>DETAIL:&nbsp;</li> <li>FIELD&nbsp;|&nbsp;</li> <li>CONSTR&nbsp;|&nbsp;</li> <li><a href="#method_detail">METHOD</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <p class="subTitle">org.apache.lucene.queryparser.flexible.messages</p> <h2 title="Interface Message" class="title">Interface Message</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Known Implementing Classes:</dt> <dd><a href="../../../../../../org/apache/lucene/queryparser/flexible/messages/MessageImpl.html" title="class in org.apache.lucene.queryparser.flexible.messages">MessageImpl</a></dd> </dl> <hr> <br> <pre>public interface <strong>Message</strong></pre> <div class="block">Message Interface for a lazy loading. For Native Language Support (NLS), system of software internationalization.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]</code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/lucene/queryparser/flexible/messages/Message.html#getArguments()">getArguments</a></strong>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/lucene/queryparser/flexible/messages/Message.html#getKey()">getKey</a></strong>()</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/lucene/queryparser/flexible/messages/Message.html#getLocalizedMessage()">getLocalizedMessage</a></strong>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/lucene/queryparser/flexible/messages/Message.html#getLocalizedMessage(java.util.Locale)">getLocalizedMessage</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a>&nbsp;locale)</code>&nbsp;</td> </tr> </table> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getKey()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getKey</h4> <pre><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getKey()</pre> </li> </ul> <a name="getArguments()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getArguments</h4> <pre><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]&nbsp;getArguments()</pre> </li> </ul> <a name="getLocalizedMessage()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getLocalizedMessage</h4> <pre><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getLocalizedMessage()</pre> </li> </ul> <a name="getLocalizedMessage(java.util.Locale)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getLocalizedMessage</h4> <pre><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getLocalizedMessage(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a>&nbsp;locale)</pre> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Message.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>PREV CLASS</li> <li><a href="../../../../../../org/apache/lucene/queryparser/flexible/messages/MessageImpl.html" title="class in org.apache.lucene.queryparser.flexible.messages"><span class="strong">NEXT CLASS</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/lucene/queryparser/flexible/messages/Message.html" target="_top">FRAMES</a></li> <li><a href="Message.html" target="_top">NO FRAMES</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>SUMMARY:&nbsp;</li> <li>NESTED&nbsp;|&nbsp;</li> <li>FIELD&nbsp;|&nbsp;</li> <li>CONSTR&nbsp;|&nbsp;</li> <li><a href="#method_summary">METHOD</a></li> </ul> <ul class="subNavList"> <li>DETAIL:&nbsp;</li> <li>FIELD&nbsp;|&nbsp;</li> <li>CONSTR&nbsp;|&nbsp;</li> <li><a href="#method_detail">METHOD</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small> <i>Copyright &copy; 2000-2014 Apache Software Foundation. All Rights Reserved.</i> <script src='../../../../../../prettify.js' type='text/javascript'></script> <script type='text/javascript'> (function(){ var oldonload = window.onload; if (typeof oldonload != 'function') { window.onload = prettyPrint; } else { window.onload = function() { oldonload(); prettyPrint(); } } })(); </script> </small></p> </body> </html>
{ "content_hash": "20e2d888e00eaef27bcbe6779582ea6c", "timestamp": "", "source": "github", "line_count": 267, "max_line_length": 369, "avg_line_length": 38.46441947565543, "alnum_prop": 0.6337877312560857, "repo_name": "OrlandoLee/ForYou", "id": "0f2e75f2a7dbb9ca4ea50c0000294a0f0358604a", "size": "10270", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lucene/lib/lucene-4.6.1/docs/queryparser/org/apache/lucene/queryparser/flexible/messages/Message.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "294179" }, { "name": "Java", "bytes": "4850924" }, { "name": "JavaScript", "bytes": "8728" }, { "name": "Ruby", "bytes": "15745" }, { "name": "Shell", "bytes": "368" } ], "symlink_target": "" }
package com.zimbra.client; import com.zimbra.common.service.ServiceException; import com.zimbra.common.soap.Element; import com.zimbra.common.soap.MailConstants; import com.zimbra.common.soap.VoiceConstants; import com.zimbra.client.event.ZModifyEvent; import org.json.JSONException; public class ZCallHit implements ZSearchHit { private String mId; private String mSortField; private long mDate; private long mDuration; private ZPhone mCaller; private ZPhone mRecipient; public ZCallHit(Element e) throws ServiceException { mId = "ZCallHit"; mSortField = e.getAttribute(MailConstants.A_SORT_FIELD, null); mDate = e.getAttributeLong(MailConstants.A_DATE); mDuration = e.getAttributeLong(VoiceConstants.A_VMSG_DURATION) * 1000; for (Element el : e.listElements(VoiceConstants.E_CALLPARTY)) { String addressType = el.getAttribute(MailConstants.A_ADDRESS_TYPE, null); if (ZEmailAddress.EMAIL_TYPE_FROM.equals(addressType)) { mCaller = new ZPhone(el.getAttribute(VoiceConstants.A_PHONENUM), el.getAttribute(MailConstants.A_PERSONAL, null)); } else { mRecipient = new ZPhone(el.getAttribute(VoiceConstants.A_PHONENUM), el.getAttribute(MailConstants.A_PERSONAL, null)); } } } @Override public String getId() { return mId; } @Override public String getSortField() { return mSortField; } public ZPhone getCaller() { return mCaller; } public ZPhone getRecipient() { return mRecipient; } public String getDisplayCaller() { return mCaller.getDisplay(); } public String getDisplayRecipient() { return mRecipient.getDisplay(); } public long getDate() { return mDate; } public long getDuration() { return mDuration; } @Override public void modifyNotification(ZModifyEvent event) throws ServiceException { // No-op. } @Override public ZJSONObject toZJSONObject() throws JSONException { ZJSONObject zjo = new ZJSONObject(); zjo.put("id", mId); zjo.put("sortField", mSortField); zjo.put("date", mDate); zjo.put("duration", mDuration); zjo.put("caller", mCaller); zjo.put("recipient", mRecipient); return zjo; } @Override public String toString() { return String.format("[ZCallHit %s]", mId); } public String dump() { return ZJSONObject.toString(this); } }
{ "content_hash": "78520f542270545f9e8a7c3bb365db26", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 133, "avg_line_length": 30.634146341463413, "alnum_prop": 0.6636146496815286, "repo_name": "nico01f/z-pec", "id": "0726dcf240c0de949a0fb6e4f9102a5910490e01", "size": "3067", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ZimbraClient/src/java/com/zimbra/client/ZCallHit.java", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "18110" }, { "name": "C", "bytes": "61139" }, { "name": "C#", "bytes": "1461640" }, { "name": "C++", "bytes": "723279" }, { "name": "CSS", "bytes": "2648118" }, { "name": "Groff", "bytes": "15389" }, { "name": "HTML", "bytes": "83875860" }, { "name": "Java", "bytes": "49998455" }, { "name": "JavaScript", "bytes": "39307223" }, { "name": "Makefile", "bytes": "13060" }, { "name": "PHP", "bytes": "4263" }, { "name": "PLSQL", "bytes": "17047" }, { "name": "Perl", "bytes": "2030870" }, { "name": "PowerShell", "bytes": "1485" }, { "name": "Python", "bytes": "129210" }, { "name": "Shell", "bytes": "575209" }, { "name": "XSLT", "bytes": "20635" } ], "symlink_target": "" }
import React from 'react'; import { Page, Toolbar, ToolbarButton, BackButton, Input } from '../../src/index.js'; import MyToolbar from './MyToolbar'; export default class extends React.Component { constructor(props) { super(props); this.state = { text: 'text', selected: [1], selected2: 1 }; } handleCheckbox(idx, event) { const selected = this.state.selected; if (event.target.checked && selected.indexOf(idx) < 0) { selected.push(idx); } else if(!event.target.checked) { selected.splice(selected.indexOf(idx), 1); } this.setState({selected: selected}); } handleRadio(idx, event) { if (event.target.checked) { this.setState({selected2: idx}); } } render() { return ( <Page renderToolbar = { () => <Toolbar> <div className='left'><BackButton>Back</BackButton></div> <div className='center'>Input</div> </Toolbar> } > <p> Please enter a text </p> <Input disabled={false} value={this.state.text} float onChange={(event) => { this.setState({text: event.target.value})} } modifier='material' placeholder='Username'></Input> <input value={this.state.text} onChange={(event) => { this.setState({text: event.target.value}); }} /> <div> Text : {this.state.text} </div> <h2>Checkboxes</h2> { [0, 1, 2].map((idx) => ( <div> <input type='checkbox' onChange={this.handleCheckbox.bind(this, idx)} checked={this.state.selected.indexOf(idx) >= 0} /> <Input type='checkbox' onChange={this.handleCheckbox.bind(this, idx)} checked={this.state.selected.indexOf(idx) >= 0} /> </div> )) } <p>Selected: [{this.state.selected.join(', ')}]</p> <h2>Radio buttons</h2> { [0, 1, 2].map((idx) => ( <div> <input type='radio' onChange={this.handleRadio.bind(this, idx)} checked={idx === this.state.selected2} /> <Input type='radio' onChange={this.handleRadio.bind(this, idx)} checked={idx === this.state.selected2} /> </div> )) } <p>Selected: {this.state.selected2}</p> </Page> ); } }
{ "content_hash": "327f37ec2d34be67cf7d593ba5d67a08", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 108, "avg_line_length": 24.01851851851852, "alnum_prop": 0.4865073245952197, "repo_name": "OnsenUI/react-onsenui", "id": "d32d4a2cc76a96d188651128c91ace62218c3e8c", "size": "2594", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "demo/examples/Input.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "1518" }, { "name": "JavaScript", "bytes": "167537" } ], "symlink_target": "" }
package org.apache.derbyTesting.functionTests.tests.lang; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Properties; import junit.framework.Test; import junit.framework.TestSuite; import org.apache.derbyTesting.junit.BaseJDBCTestCase; import org.apache.derbyTesting.junit.CleanDatabaseTestSetup; import org.apache.derbyTesting.junit.DatabasePropertyTestSetup; import org.apache.derbyTesting.junit.SystemPropertyTestSetup; /** * This tests updateable cursor using index, Beetle entry 3865. * * Not done in ij since we need to do many "next" and "update" to be able to * excercise the code of creating temp conglomerate for virtual memory heap. We * need at minimum 200 rows in table, if "maxMemoryPerTable" property is set to * 1 (KB). This includes 100 rows to fill the in-memory portion of the hash * table, and another 100 rows to fill an in-memory heap that was used until * DERBY-5425 removed it. */ public class UpdateCursorTest extends BaseJDBCTestCase { private static final int SIZE_OF_T1 = 250; private static final String EXPECTED_SQL_CODE = "02000"; /** * Basic constructor. */ public UpdateCursorTest(String name) { super(name); } /** * Sets the auto commit to false. */ protected void initializeConnection(Connection conn) throws SQLException { conn.setAutoCommit(false); } /** * Returns the implemented tests. * * @return An instance of <code>Test</code> with the implemented tests to * run. */ public static Test suite() { Properties props = new Properties(); props.setProperty("derby.language.maxMemoryPerTable", "1"); return new DatabasePropertyTestSetup( new SystemPropertyTestSetup(new CleanDatabaseTestSetup( new TestSuite(UpdateCursorTest.class, "UpdateCursorTest")) { /** * @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement) */ protected void decorateSQL(Statement s) throws SQLException { StringBuffer sb = new StringBuffer(1000); String largeString; PreparedStatement pstmt; assertUpdateCount(s, 0, "create table T1 (" + " c1 int," + " c2 char(50)," + " c3 int," + " c4 char(50)," + " c5 int," + " c6 varchar(1000))"); assertUpdateCount(s, 0, "create index I11 on T1(c3, c1, c5)"); assertUpdateCount(s, 0, "create table T2(" + " c1 int)"); assertUpdateCount(s, 0, "create table T3(" + " c1 char(20) not null primary key)"); assertUpdateCount(s, 0, "create table T4(" + " c1 char(20) references T3(c1) on delete cascade)"); /* fill the newly created tables */ for (int i = 0; i < 1000; i++) { sb.append('a'); } pstmt = s.getConnection().prepareStatement("insert into T1 values (?, ?, ?, ?, ?, ?), " + "(?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?), " + "(?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?)"); largeString = new String(sb); for (int i = 246; i > 0; i = i - 5) { int k = 0; for (int j = 0; j < 5; j++) { pstmt.setInt(1 + k, i + (4 - j)); pstmt.setString(2 + k, new Integer(i).toString()); pstmt.setInt(3 + k, i + j); pstmt.setString(4 + k, new Integer(i).toString()); pstmt.setInt(5 + k, i); pstmt.setString(6 + k, largeString); k += 6; } assertUpdateCount(pstmt, 5); } s.executeUpdate("insert into t2 values (1)"); pstmt.close(); } }, props), props, true); } /** * Test the virtual memory heap. * * @throws SQLException */ public void testVirtualMemoryHeap() throws SQLException { PreparedStatement select = prepareStatement("select c1, c3 from t1 where c3 > 1 and c1 > 0 for update"); Statement update = createStatement(); String cursorName; ResultSet cursor; int expectedValue = 1; /* drop index and recreate it to be sure that it is ascending * (other subtests may have changed it) */ assertUpdateCount(update, 0, "drop index I11"); assertUpdateCount(update, 0, "create index I11 on T1 (c3, c1, c5)"); cursor = select.executeQuery(); // cursor is now open cursorName = cursor.getCursorName(); /* scan the entire table except the last row. */ for (int i = 0; i < SIZE_OF_T1 - 1; i++) { // Expect the values to be returned in index order. expectedValue++; assertEquals(cursor.next(), true); //System.out.println("Row " + i + ": "+cursor.getInt(1)+","+cursor.getInt(2)+": "+expectedValue); assertEquals("Virtual memory heap test failed! Got unexpected value.", expectedValue, cursor.getInt(2)); update.execute("update t1 set c3 = c3 + 250 where current of " + cursorName); } assertFalse( "Update with virtual memory heap failed! Still got rows.", cursor.next()); cursor.close(); update.close(); /* see what we have in the table */ select = prepareStatement("select c1, c3 from t1"); cursor = select.executeQuery(); // cursor is now open for (int i = 0; i < SIZE_OF_T1; i++) { assertEquals(cursor.next(), true); } assertFalse( "Update with virtual memory heeap failed! Got more rows.", cursor.next()); select.close(); cursor.close(); rollback(); } /** * Tests non covering index. * * @throws SQLException */ public void testNonCoveringIndex() throws SQLException { PreparedStatement select; Statement update; ResultSet cursor; String cursorName; update = createStatement(); select = prepareStatement("select c3, c2 from t1 where c3 > 125 and c1 > 0 for update"); cursor = select.executeQuery(); // cursor is now open cursorName = cursor.getCursorName(); for (int i = 0; i < (SIZE_OF_T1 / 2); i++) { assertEquals(cursor.next(), true); update.execute("update t1 set c3 = c3 + 25 where current of " + cursorName); } assertFalse( "Update using noncovering index failed! Still got rows.", cursor.next()); cursor.close(); select.close(); /* see what we have in the table */ select = prepareStatement("select c1, c3 from t1"); cursor = select.executeQuery(); // cursor is now open for (int i = 0; i < SIZE_OF_T1; i++) { assertEquals(cursor.next(), true); } assertFalse( "Update using noncovering index failed! Got more rows.", cursor .next()); select.close(); cursor.close(); rollback(); } /** * Tests descending index. * * @throws SQLException */ public void testDescendingIndex() throws SQLException { PreparedStatement select; Statement update; ResultSet cursor; update = createStatement(); /* drop index and recreate it */ assertUpdateCount(update, 0, "drop index I11"); assertUpdateCount(update, 0, "create index I11 on T1 (c3 desc, c1, c5 desc)"); commit(); update = createStatement(); select = prepareStatement("select c3, c1 from t1 where c3 > 125 and c1 > 0 for update"); cursor = select.executeQuery(); // cursor is now open for (int i = 0; i < (SIZE_OF_T1 / 2); i++) { assertEquals(cursor.next(), true); if ((i % 2) == 0) { update.execute("update t1 set c3 = c3 + 1 where current of " + cursor.getCursorName()); } else { update.execute("update t1 set c3 = c3 - 1 where current of " + cursor.getCursorName()); } } assertFalse("Update using desc index failed! Got more rows.", cursor.next()); cursor.close(); select.close(); /* see what we have in the table */ select = prepareStatement("select c3, c2 from t1"); cursor = select.executeQuery(); // cursor is now open for (int i = 0; i < SIZE_OF_T1; i++) { assertEquals(cursor.next(), true); } assertFalse("Update using desc index failed! Got more rows.", cursor.next()); select.close(); cursor.close(); rollback(); } /** * Test if the correct warnings are raised. * * @throws SQLException */ public void testUpdateDeleteWarning() throws SQLException { Statement stmt = createStatement(); SQLWarning sw; stmt.executeUpdate("update t2 set c1 = 2 where c1 = 1"); sw = stmt.getWarnings(); assertNull("The update should not return a warning.", sw); stmt.executeUpdate("update t2 set c1 = 2 where c1 = 1"); sw = stmt.getWarnings(); assertNotNull("The update should return a warning.", sw); assertEquals("Wrong sql state.", EXPECTED_SQL_CODE, sw .getSQLState()); stmt.executeUpdate("delete from t2 where c1 = 2"); sw = stmt.getWarnings(); assertNull("The delete should not return a warning.", sw); stmt.executeUpdate("delete from t2 where c1 = 2"); sw = stmt.getWarnings(); assertNotNull("The delete should return a warning.", sw); assertEquals("Wrong sql state.", EXPECTED_SQL_CODE, sw .getSQLState()); stmt.executeUpdate("delete from t3"); sw = stmt.getWarnings(); assertNotNull("The delete cascade should return a warning.", sw); assertEquals("Wrong sql state.", EXPECTED_SQL_CODE, sw .getSQLState()); stmt.close(); rollback(); } /** * Regression test case for DERBY-5425. The scan used to lose rows that * had spilt to disk from the data structure that keeps track of already * seen rows, if the transaction was committed in the middle of the scan. */ public void testDerby5425HoldOverCommit() throws SQLException { Statement stmt = createStatement(); // Drop index and recreate it to be sure that it is ascending // (other subtests may have changed it) assertUpdateCount(stmt, 0, "drop index I11"); assertUpdateCount(stmt, 0, "create index I11 on T1 (c3, c1, c5)"); PreparedStatement sel = prepareStatement( "select c3 from t1 --DERBY-PROPERTIES index=I11", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet rs = sel.executeQuery(); for (int i = 1; i <= SIZE_OF_T1; i++) { assertTrue("Too few rows", rs.next()); assertEquals(i, rs.getInt(1)); rs.updateInt(1, i); rs.updateRow(); commit(); } assertFalse("Too many rows", rs.next()); rs.close(); } }
{ "content_hash": "cb690ec2db2260a1bdce3501f073cc1d", "timestamp": "", "source": "github", "line_count": 330, "max_line_length": 107, "avg_line_length": 30.83939393939394, "alnum_prop": 0.6453768301071042, "repo_name": "kavin256/Derby", "id": "6294403ce3dbcc63a19f6f9a58f9b6ae46e1c4d5", "size": "11074", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateCursorTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "14629" }, { "name": "C++", "bytes": "1814" }, { "name": "CSS", "bytes": "13737" }, { "name": "HTML", "bytes": "248094" }, { "name": "Java", "bytes": "40591204" }, { "name": "JavaScript", "bytes": "12169" }, { "name": "PLSQL", "bytes": "360514" }, { "name": "PLpgSQL", "bytes": "84342" }, { "name": "SQLPL", "bytes": "139204" }, { "name": "Shell", "bytes": "13785" }, { "name": "SourcePawn", "bytes": "3142" }, { "name": "XSLT", "bytes": "15231" } ], "symlink_target": "" }
"""Test Home Assistant package util methods.""" import asyncio import logging import os from subprocess import PIPE import sys from unittest.mock import MagicMock, call, patch import pkg_resources import pytest import homeassistant.util.package as package RESOURCE_DIR = os.path.abspath( os.path.join(os.path.dirname(__file__), "..", "resources") ) TEST_NEW_REQ = "pyhelloworld3==1.0.0" TEST_ZIP_REQ = "file://{}#{}".format( os.path.join(RESOURCE_DIR, "pyhelloworld3.zip"), TEST_NEW_REQ ) @pytest.fixture def mock_sys(): """Mock sys.""" with patch("homeassistant.util.package.sys", spec=object) as sys_mock: sys_mock.executable = "python3" yield sys_mock @pytest.fixture def deps_dir(): """Return path to deps directory.""" return os.path.abspath("/deps_dir") @pytest.fixture def lib_dir(deps_dir): """Return path to lib directory.""" return os.path.join(deps_dir, "lib_dir") @pytest.fixture def mock_popen(lib_dir): """Return a Popen mock.""" with patch("homeassistant.util.package.Popen") as popen_mock: popen_mock.return_value.communicate.return_value = ( bytes(lib_dir, "utf-8"), b"error", ) popen_mock.return_value.returncode = 0 yield popen_mock @pytest.fixture def mock_env_copy(): """Mock os.environ.copy.""" with patch("homeassistant.util.package.os.environ.copy") as env_copy: env_copy.return_value = {} yield env_copy @pytest.fixture def mock_venv(): """Mock homeassistant.util.package.is_virtual_env.""" with patch("homeassistant.util.package.is_virtual_env") as mock: mock.return_value = True yield mock def mock_async_subprocess(): """Return an async Popen mock.""" async_popen = MagicMock() async def communicate(input=None): """Communicate mock.""" stdout = bytes("/deps_dir/lib_dir", "utf-8") return (stdout, None) async_popen.communicate = communicate return async_popen def test_install(mock_sys, mock_popen, mock_env_copy, mock_venv): """Test an install attempt on a package that doesn't exist.""" env = mock_env_copy() assert package.install_package(TEST_NEW_REQ, False) assert mock_popen.call_count == 1 assert mock_popen.call_args == call( [mock_sys.executable, "-m", "pip", "install", "--quiet", TEST_NEW_REQ], stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env, ) assert mock_popen.return_value.communicate.call_count == 1 def test_install_upgrade(mock_sys, mock_popen, mock_env_copy, mock_venv): """Test an upgrade attempt on a package.""" env = mock_env_copy() assert package.install_package(TEST_NEW_REQ) assert mock_popen.call_count == 1 assert mock_popen.call_args == call( [ mock_sys.executable, "-m", "pip", "install", "--quiet", TEST_NEW_REQ, "--upgrade", ], stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env, ) assert mock_popen.return_value.communicate.call_count == 1 def test_install_target(mock_sys, mock_popen, mock_env_copy, mock_venv): """Test an install with a target.""" target = "target_folder" env = mock_env_copy() env["PYTHONUSERBASE"] = os.path.abspath(target) mock_venv.return_value = False mock_sys.platform = "linux" args = [ mock_sys.executable, "-m", "pip", "install", "--quiet", TEST_NEW_REQ, "--user", "--prefix=", ] assert package.install_package(TEST_NEW_REQ, False, target=target) assert mock_popen.call_count == 1 assert mock_popen.call_args == call( args, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env ) assert mock_popen.return_value.communicate.call_count == 1 def test_install_target_venv(mock_sys, mock_popen, mock_env_copy, mock_venv): """Test an install with a target in a virtual environment.""" target = "target_folder" with pytest.raises(AssertionError): package.install_package(TEST_NEW_REQ, False, target=target) def test_install_error(caplog, mock_sys, mock_popen, mock_venv): """Test an install with a target.""" caplog.set_level(logging.WARNING) mock_popen.return_value.returncode = 1 assert not package.install_package(TEST_NEW_REQ) assert len(caplog.records) == 1 for record in caplog.records: assert record.levelname == "ERROR" def test_install_constraint(mock_sys, mock_popen, mock_env_copy, mock_venv): """Test install with constraint file on not installed package.""" env = mock_env_copy() constraints = "constraints_file.txt" assert package.install_package(TEST_NEW_REQ, False, constraints=constraints) assert mock_popen.call_count == 1 assert mock_popen.call_args == call( [ mock_sys.executable, "-m", "pip", "install", "--quiet", TEST_NEW_REQ, "--constraint", constraints, ], stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env, ) assert mock_popen.return_value.communicate.call_count == 1 def test_install_find_links(mock_sys, mock_popen, mock_env_copy, mock_venv): """Test install with find-links on not installed package.""" env = mock_env_copy() link = "https://wheels-repository" assert package.install_package(TEST_NEW_REQ, False, find_links=link) assert mock_popen.call_count == 1 assert mock_popen.call_args == call( [ mock_sys.executable, "-m", "pip", "install", "--quiet", TEST_NEW_REQ, "--find-links", link, "--prefer-binary", ], stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env, ) assert mock_popen.return_value.communicate.call_count == 1 async def test_async_get_user_site(mock_env_copy): """Test async get user site directory.""" deps_dir = "/deps_dir" env = mock_env_copy() env["PYTHONUSERBASE"] = os.path.abspath(deps_dir) args = [sys.executable, "-m", "site", "--user-site"] with patch( "homeassistant.util.package.asyncio.create_subprocess_exec", return_value=mock_async_subprocess(), ) as popen_mock: ret = await package.async_get_user_site(deps_dir) assert popen_mock.call_count == 1 assert popen_mock.call_args == call( *args, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.DEVNULL, env=env, ) assert ret == os.path.join(deps_dir, "lib_dir") def test_check_package_global(): """Test for an installed package.""" installed_package = list(pkg_resources.working_set)[0].project_name assert package.is_installed(installed_package) def test_check_package_zip(): """Test for an installed zip package.""" assert not package.is_installed(TEST_ZIP_REQ)
{ "content_hash": "4a21a0e1de3b6b4096b2dc7d0c18ca27", "timestamp": "", "source": "github", "line_count": 248, "max_line_length": 80, "avg_line_length": 28.68951612903226, "alnum_prop": 0.6143359100491919, "repo_name": "partofthething/home-assistant", "id": "0c25166244440670fefe784071ab1971906c64ba", "size": "7115", "binary": false, "copies": "3", "ref": "refs/heads/dev", "path": "tests/util/test_package.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "1720" }, { "name": "Python", "bytes": "31051838" }, { "name": "Shell", "bytes": "4832" } ], "symlink_target": "" }
[blog.web1992.cn](https://blog.web1992.cn) This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
{ "content_hash": "f566485edd5fc2c2b129e65ae9c8fcc0", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 105, "avg_line_length": 49.666666666666664, "alnum_prop": 0.7583892617449665, "repo_name": "web1992/jekyll_blog", "id": "08db19991554f387009611dc66d5ece0a44be83a", "size": "157", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2650" }, { "name": "JavaScript", "bytes": "14871" } ], "symlink_target": "" }
title: Pathfinder author: Nicholas Lore date: 2011-08-12 19:49:23 categories: non-fiction rating: 4/5 --- This is a phenomenal book on how to choose a career. It is extremely detailed, giving you every step you need to take to find your passion, discover how to get paid to do it, qualify yourself for it, and then land a job. That being said, I am certain that this book is not for everyone. It's written as a workbook that explains clear principles and then loads you up with tons of exercises and homework. If you aren't willing to do the work on the side, don't even bother. If you are (and you ought to be, as you will likely be working for the rest of your life) then there is no better book for reaching that goal.
{ "content_hash": "178dd3b4659bd6c120cb2ce7af5cf646", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 615, "avg_line_length": 90.5, "alnum_prop": 0.7679558011049724, "repo_name": "bryanbraun/bryanbraun.github.io", "id": "42eeb3b371b4841e2b87af99422d3634ce983503", "size": "728", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "_books/pathfinder.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "15700" }, { "name": "HTML", "bytes": "34705" }, { "name": "JavaScript", "bytes": "27447" }, { "name": "Ruby", "bytes": "74" } ], "symlink_target": "" }
<?php namespace TypiCMS\Modules\Pages\Facades; use Illuminate\Support\Facades\Facade; class Pages extends Facade { /** * Get the registered name of the component. * * @return string */ protected static function getFacadeAccessor() { return 'Pages'; } }
{ "content_hash": "ad0bc39f81e50b39f7db85c8dac154db", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 49, "avg_line_length": 16.666666666666668, "alnum_prop": 0.6366666666666667, "repo_name": "TypiCMS/Pages", "id": "b32b88a8efcc53ce61f3737abb8dcb9159fc7e57", "size": "300", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Facades/Pages.php", "mode": "33188", "license": "mit", "language": [ { "name": "Blade", "bytes": "16085" }, { "name": "PHP", "bytes": "128623" } ], "symlink_target": "" }
package Zonemaster::Util v1.1.1; use 5.014002; use parent 'Exporter'; use strict; use warnings; use Zonemaster; use Zonemaster::DNSName; use Pod::Simple::SimpleTree; ## no critic (Modules::ProhibitAutomaticExportation) our @EXPORT = qw[ ns info name pod_extract_for scramble_case ]; our @EXPORT_OK = qw[ ns info name pod_extract_for policy scramble_case ]; our %EXPORT_TAGS = ( all => \@EXPORT_OK ); ## no critic (Subroutines::RequireArgUnpacking) sub ns { return Zonemaster->ns( @_ ); } sub info { my ( $tag, $argref ) = @_; return Zonemaster->logger->add( $tag, $argref ); } sub policy { return Zonemaster->config->policy; } sub name { my ( $name ) = @_; return Zonemaster::DNSName->new( $name ); } # Functions for extracting POD documentation from test modules sub _pod_process_tree { my ( $node, $flags ) = @_; my ( $name, $ahash, @subnodes ) = @{$node}; my @res; $flags //= {}; foreach my $node ( @subnodes ) { if ( ref( $node ) ne 'ARRAY' ) { $flags->{tests} = 1 if $name eq 'head1' and $node eq 'TESTS'; if ( $name eq 'item-text' and $flags->{tests} ) { $node =~ s/\A(\w+).*\z/$1/x; $flags->{item} = $node; push @res, $node; } } else { if ( $flags->{item} ) { push @res, _pod_extract_text( $node ); } else { push @res, _pod_process_tree( $node, $flags ); } } } return @res; } ## end sub _pod_process_tree sub _pod_extract_text { my ( $node ) = @_; my ( $name, $ahash, @subnodes ) = @{$node}; my $res = q{}; foreach my $node ( @subnodes ) { if ( $name eq q{item-text} ) { $node =~ s/\A(\w+).*\z/$1/x; } if ( ref( $node ) eq q{ARRAY} ) { $res .= _pod_extract_text( $node ); } else { $res .= $node; } } return $res; } ## end sub _pod_extract_text sub pod_extract_for { my ( $name ) = @_; my $parser = Pod::Simple::SimpleTree->new; $parser->no_whining( 1 ); my %desc = eval { _pod_process_tree( $parser->parse_file( $INC{"Zonemaster/Test/$name.pm"} )->root ) }; return \%desc; } # Function from CPAN package Text::Capitalize that causes # issues when installing ZM. # sub scramble_case { my $string = shift; my ( @chars, $uppity, $newstring, $uppers, $downers ); @chars = split //, $string; $uppers = 2; $downers = 1; foreach my $c ( @chars ) { $uppity = int( rand( 1 + $downers / $uppers ) ); if ( $uppity ) { $c = uc( $c ); $uppers++; } else { $c = lc( $c ); $downers++; } } $newstring = join q{}, @chars; return $newstring; } # end sub scramble_case sub supports_ipv6 { return; } 1; =head1 NAME Zonemaster::Util - utility functions for other Zonemaster modules =head1 SYNOPSIS use Zonemaster::Util; info(TAG => { some => 'argument'}); my $ns = ns($name, $address); my $name = name('whatever.example.org'); =head1 EXPORTED FUNCTIONS =over =item info($tag, $href) Creates and returns a L<Zonemaster::Logger::Entry> object. The object is also added to the global logger object's list of entries. =item ns($name, $address) Creates and returns a nameserver object with the given name and address. =item policy() Returns a reference to the global policy hash. =item name($string_name_or_zone) Creates and returns a L<Zonemaster::DNSName> object for the given argument. =item pod_extract_for($testname) Will attempt to extract the POD documentation for the test methods in the test module for which the name is given. If it can, it returns a reference to a hash where the keys are the test method names and the values the documentation strings. This method blindly assumes that the structure of the POD is exactly like that in the Example and Basic test modules. If it's not, the results are undefined. =item scramble_case This routine provides a special effect: sCraMBliNg tHe CaSe =item supports_ipv6 Check if ZOnemaster hosting server supports IPv6. =back
{ "content_hash": "cbf522920cd7d95436da456ed6eaa05f", "timestamp": "", "source": "github", "line_count": 187, "max_line_length": 107, "avg_line_length": 22.67914438502674, "alnum_prop": 0.5802876680028295, "repo_name": "jelu/zonemaster-engine", "id": "d1fac5c859071ff1558c35d6b8a500ef8ab17cf2", "size": "4241", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/Zonemaster/Util.pm", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Makefile", "bytes": "372" }, { "name": "Perl", "bytes": "369658" }, { "name": "Perl6", "bytes": "54316" } ], "symlink_target": "" }
package com.jonathancolt.nicity.view.event; /* * #%L * nicity-view * %% * Copyright (C) 2013 Jonathan Colt * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ /** * * @author Administrator */ public class MouseClicked extends AMouseEvent { /** * * @param source * @param x * @param y * @param z * @param clickCount * @param modifiers * @param _cx * @param _cy * @param _cw * @param _ch * @return */ public static AMouseEvent newInstance( Object source, int x, int y, int z, int clickCount, int modifiers, float _cx, float _cy, float _cw, float _ch) { AMouseEvent e = new MouseClicked(); e.setSource(source); e.setX(x); e.setY(y); e.setZ(z); e.setClickCount(clickCount); e.setModifiers(modifiers); e.cx = _cx; e.cy = _cy; e.cw = _cw; e.ch = _ch; e.isDragging = false; return e; } }
{ "content_hash": "87d9d67b40c5555863a572f8625c2a8e", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 75, "avg_line_length": 24.50793650793651, "alnum_prop": 0.5854922279792746, "repo_name": "jnthnclt/nicity", "id": "9875516482417f2c821dc60fbcb5c1c85e6aea9b", "size": "2205", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "nicity-view/src/main/java/com/jonathancolt/nicity/view/event/MouseClicked.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "26281" }, { "name": "Java", "bytes": "3596700" }, { "name": "Ruby", "bytes": "80" } ], "symlink_target": "" }
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.navercorp.pinpoint</groupId> <artifactId>pinpoint</artifactId> <relativePath>../..</relativePath> <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>pinpoint-okhttp-plugin</artifactId> <name>pinpoint-okhttp-plugin</name> <packaging>jar</packaging> <dependencies> <dependency> <groupId>com.navercorp.pinpoint</groupId> <artifactId>pinpoint-bootstrap-core</artifactId> <scope>provided</scope> </dependency> <!-- HTTP Client --> <dependency> <groupId>com.squareup.okhttp</groupId> <artifactId>okhttp</artifactId> <scope>provided</scope> </dependency> </dependencies> </project>
{ "content_hash": "f5d31f2fbaf6f5089016adc8c4386fe9", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 104, "avg_line_length": 34.1, "alnum_prop": 0.6217008797653959, "repo_name": "wziyong/pinpoint", "id": "1cc77f6b9be2babbd918dac6942d5cea3a6b3fa5", "size": "1023", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "plugins/okhttp/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "22853" }, { "name": "CSS", "bytes": "109953" }, { "name": "CoffeeScript", "bytes": "10124" }, { "name": "Groovy", "bytes": "1423" }, { "name": "HTML", "bytes": "515287" }, { "name": "Java", "bytes": "8984255" }, { "name": "JavaScript", "bytes": "1864793" }, { "name": "Makefile", "bytes": "5246" }, { "name": "PLSQL", "bytes": "4156" }, { "name": "Python", "bytes": "3523" }, { "name": "Ruby", "bytes": "943" }, { "name": "Shell", "bytes": "30663" }, { "name": "Thrift", "bytes": "7543" } ], "symlink_target": "" }
/* * kmp_import.cpp */ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.txt for details. // //===----------------------------------------------------------------------===// /* ------------------------------------------------------------------------------------------------ Object generated from this source file is linked to Windows* OS DLL import library (libompmd.lib) only! It is not a part of regular static or dynamic OpenMP RTL. Any code that just needs to go in the libompmd.lib (but not in libompmt.lib and libompmd.dll) should be placed in this file. ------------------------------------------------------------------------------------------------ */ #ifdef __cplusplus extern "C" { #endif /* These symbols are required for mutual exclusion with Microsoft OpenMP RTL (and compatibility with MS Compiler). */ int _You_must_link_with_exactly_one_OpenMP_library = 1; int _You_must_link_with_Intel_OpenMP_library = 1; int _You_must_link_with_Microsoft_OpenMP_library = 1; #ifdef __cplusplus } #endif // end of file //
{ "content_hash": "acfe9b62e375540e402ff420f26f11fd", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 101, "avg_line_length": 30.428571428571427, "alnum_prop": 0.4953051643192488, "repo_name": "ensemblr/llvm-project-boilerplate", "id": "fc4bdae9dbe31903cc2bcfe607275505a4d17ba3", "size": "1278", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "include/llvm/projects/openmp/runtime/src/kmp_import.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "32" }, { "name": "AppleScript", "bytes": "1429" }, { "name": "Assembly", "bytes": "15649629" }, { "name": "Awk", "bytes": "1747037" }, { "name": "Batchfile", "bytes": "34481" }, { "name": "Brainfuck", "bytes": "284" }, { "name": "C", "bytes": "85584624" }, { "name": "C#", "bytes": "20737" }, { "name": "C++", "bytes": "168418524" }, { "name": "CMake", "bytes": "1174816" }, { "name": "CSS", "bytes": "49900" }, { "name": "Cuda", "bytes": "414703" }, { "name": "Emacs Lisp", "bytes": "110018" }, { "name": "Forth", "bytes": "1490" }, { "name": "Fortran", "bytes": "356707" }, { "name": "GAP", "bytes": "6167" }, { "name": "Go", "bytes": "132137" }, { "name": "HTML", "bytes": "1751124" }, { "name": "JavaScript", "bytes": "141512" }, { "name": "LLVM", "bytes": "62219250" }, { "name": "Limbo", "bytes": "7437" }, { "name": "Logos", "bytes": "1572537943" }, { "name": "Lua", "bytes": "86606" }, { "name": "M", "bytes": "2008" }, { "name": "M4", "bytes": "109560" }, { "name": "Makefile", "bytes": "616437" }, { "name": "Mathematica", "bytes": "7845" }, { "name": "Matlab", "bytes": "53817" }, { "name": "Mercury", "bytes": "1194" }, { "name": "Mirah", "bytes": "1079943" }, { "name": "OCaml", "bytes": "407143" }, { "name": "Objective-C", "bytes": "5910944" }, { "name": "Objective-C++", "bytes": "1720450" }, { "name": "OpenEdge ABL", "bytes": "690534" }, { "name": "PHP", "bytes": "15986" }, { "name": "POV-Ray SDL", "bytes": "19471" }, { "name": "Perl", "bytes": "591927" }, { "name": "PostScript", "bytes": "845774" }, { "name": "Protocol Buffer", "bytes": "20013" }, { "name": "Python", "bytes": "1895427" }, { "name": "QMake", "bytes": "15580" }, { "name": "RenderScript", "bytes": "741" }, { "name": "Roff", "bytes": "94555" }, { "name": "Rust", "bytes": "200" }, { "name": "Scheme", "bytes": "2654" }, { "name": "Shell", "bytes": "1144090" }, { "name": "Smalltalk", "bytes": "144607" }, { "name": "SourcePawn", "bytes": "1544" }, { "name": "Standard ML", "bytes": "2841" }, { "name": "Tcl", "bytes": "8285" }, { "name": "TeX", "bytes": "320484" }, { "name": "Vim script", "bytes": "17239" }, { "name": "Yacc", "bytes": "163484" } ], "symlink_target": "" }
<!DOCTYPE html> <!--[if IE]><![endif]--> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Class Ref&lt;T&gt; </title> <meta name="viewport" content="width=device-width"> <meta name="title" content="Class Ref&lt;T&gt; "> <meta name="generator" content="docfx 2.43.2.0"> <link rel="shortcut icon" href="../favicon.ico"> <link rel="stylesheet" href="../styles/docfx.vendor.css"> <link rel="stylesheet" href="../styles/docfx.css"> <link rel="stylesheet" href="../styles/main.css"> <meta property="docfx:navrel" content="../toc.html"> <meta property="docfx:tocrel" content="toc.html"> </head> <body data-spy="scroll" data-target="#affix" data-offset="120"> <div id="wrapper"> <header> <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="../index.html"> <img id="logo" class="svg" src="../logo.svg" alt=""> </a> </div> <div class="collapse navbar-collapse" id="navbar"> <form class="navbar-form navbar-right" role="search" id="search"> <div class="form-group"> <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off"> </div> </form> </div> </div> </nav> <div class="subnav navbar navbar-default"> <div class="container hide-when-search" id="breadcrumb"> <ul class="breadcrumb"> <li></li> </ul> </div> </div> </header> <div role="main" class="container body-content hide-when-search"> <div class="sidenav hide-when-search"> <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a> <div class="sidetoggle collapse" id="sidetoggle"> <div id="sidetoc"></div> </div> </div> <div class="article row grid-right"> <div class="col-md-10"> <article class="content wrap" id="_content" data-uid="Kephas.Data.Ref`1"> <h1 id="Kephas_Data_Ref_1" data-uid="Kephas.Data.Ref`1" class="text-break">Class Ref&lt;T&gt; </h1> <div class="markdown level0 summary"><p>Implementation of an entity reference.</p> </div> <div class="markdown level0 conceptual"></div> <div class="inheritance"> <h5>Inheritance</h5> <div class="level0"><span class="xref">System.Object</span></div> <div class="level1"><a class="xref" href="Kephas.Data.RefBase.html">RefBase</a></div> <div class="level2"><span class="xref">Ref&lt;T&gt;</span></div> <div class="level3"><a class="xref" href="Kephas.Data.LLBLGen.LLBLGenRef-1.html">LLBLGenRef&lt;T&gt;</a></div> </div> <div classs="implements"> <h5>Implements</h5> <div><a class="xref" href="Kephas.Data.IRef-1.html">IRef</a>&lt;T&gt;</div> <div><a class="xref" href="Kephas.Data.IRef.html">IRef</a></div> <div><a class="xref" href="Kephas.Data.IIdentifiable.html">IIdentifiable</a></div> </div> <div class="inheritedMembers"> <h5>Inherited Members</h5> <div> <a class="xref" href="Kephas.Data.RefBase.html#Kephas_Data_RefBase_RefFieldName">RefBase.RefFieldName</a> </div> <div> <a class="xref" href="Kephas.Data.RefBase.html#Kephas_Data_RefBase_GetEntityPropertyValue_System_String_">RefBase.GetEntityPropertyValue(String)</a> </div> <div> <a class="xref" href="Kephas.Data.RefBase.html#Kephas_Data_RefBase_SetEntityPropertyValue_System_String_System_Object_">RefBase.SetEntityPropertyValue(String, Object)</a> </div> <div> <a class="xref" href="Kephas.Data.RefBase.html#Kephas_Data_RefBase_GetContainerEntity">RefBase.GetContainerEntity()</a> </div> <div> <a class="xref" href="Kephas.Data.RefBase.html#Kephas_Data_RefBase_GetContainerEntityEntry">RefBase.GetContainerEntityEntry()</a> </div> <div> <a class="xref" href="Kephas.Data.RefBase.html#Kephas_Data_RefBase_GetDataContext_Kephas_Data_Capabilities_IEntityEntry_">RefBase.GetDataContext(IEntityEntry)</a> </div> <div> <span class="xref">System.Object.Equals(System.Object)</span> </div> <div> <span class="xref">System.Object.Equals(System.Object, System.Object)</span> </div> <div> <span class="xref">System.Object.GetHashCode()</span> </div> <div> <span class="xref">System.Object.GetType()</span> </div> <div> <span class="xref">System.Object.MemberwiseClone()</span> </div> <div> <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span> </div> <div> <span class="xref">System.Object.ToString()</span> </div> </div> <h6><strong>Namespace</strong>: <a class="xref" href="Kephas.Data.html">Kephas.Data</a></h6> <h6><strong>Assembly</strong>: Kephas.Data.dll</h6> <h5 id="Kephas_Data_Ref_1_syntax">Syntax</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public class Ref&lt;T&gt; : RefBase, IRef&lt;T&gt;, IRef, IIdentifiable where T : class, IIdentifiable</code></pre> </div> <h5 class="typeParameters">Type Parameters</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="parametername">T</span></td> <td><p>The referenced entity type.</p> </td> </tr> </tbody> </table> <h3 id="constructors">Constructors </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1__ctor_System_Object_System_String_.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.%23ctor(System.Object%2CSystem.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L37">View Source</a> </span> <a id="Kephas_Data_Ref_1__ctor_" data-uid="Kephas.Data.Ref`1.#ctor*"></a> <h4 id="Kephas_Data_Ref_1__ctor_System_Object_System_String_" data-uid="Kephas.Data.Ref`1.#ctor(System.Object,System.String)">Ref(Object, String)</h4> <div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="Kephas.Data.Ref-1.html">Ref&lt;T&gt;</a> class.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public Ref(object containerEntity, string refFieldName)</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Object</span></td> <td><span class="parametername">containerEntity</span></td> <td><p>The entity containing the reference.</p> </td> </tr> <tr> <td><span class="xref">System.String</span></td> <td><span class="parametername">refFieldName</span></td> <td><p>Name of the reference identifier property.</p> </td> </tr> </tbody> </table> <h3 id="properties">Properties </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_Entity.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.Entity%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L69">View Source</a> </span> <a id="Kephas_Data_Ref_1_Entity_" data-uid="Kephas.Data.Ref`1.Entity*"></a> <h4 id="Kephas_Data_Ref_1_Entity" data-uid="Kephas.Data.Ref`1.Entity">Entity</h4> <div class="markdown level1 summary"><p>Gets or sets the referenced entity.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public virtual T Entity { get; set; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">T</span></td> <td><p>The referenced entity.</p> </td> </tr> </tbody> </table> <h5 id="Kephas_Data_Ref_1_Entity_remarks">Remarks</h5> <div class="markdown level1 remarks"><p>The entity is not ensured to be set prior to calling <a class="xref" href="Kephas.Data.IRef-1.html#Kephas_Data_IRef_1_GetAsync_System_Boolean_System_Threading_CancellationToken_">GetAsync(Boolean, CancellationToken)</a> due to performance reasons, but the actual behavior is left to the implementor.</p> </div> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_EntityType.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.EntityType%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L57">View Source</a> </span> <a id="Kephas_Data_Ref_1_EntityType_" data-uid="Kephas.Data.Ref`1.EntityType*"></a> <h4 id="Kephas_Data_Ref_1_EntityType" data-uid="Kephas.Data.Ref`1.EntityType">EntityType</h4> <div class="markdown level1 summary"><p>Gets the type of the referenced entity.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public Type EntityType { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Type</span></td> <td><p>The type of the referenced entity.</p> </td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_Id.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.Id%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L105">View Source</a> </span> <a id="Kephas_Data_Ref_1_Id_" data-uid="Kephas.Data.Ref`1.Id*"></a> <h4 id="Kephas_Data_Ref_1_Id" data-uid="Kephas.Data.Ref`1.Id">Id</h4> <div class="markdown level1 summary"><p>Gets or sets the identifier of the referenced entity.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public virtual object Id { get; set; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Object</span></td> <td><p>The identifier of the referenced entity.</p> </td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_IsEmpty.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.IsEmpty%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L97">View Source</a> </span> <a id="Kephas_Data_Ref_1_IsEmpty_" data-uid="Kephas.Data.Ref`1.IsEmpty*"></a> <h4 id="Kephas_Data_Ref_1_IsEmpty" data-uid="Kephas.Data.Ref`1.IsEmpty">IsEmpty</h4> <div class="markdown level1 summary"><p>Gets a value indicating whether the reference is empty/not set.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public virtual bool IsEmpty { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Boolean</span></td> <td><p>True if this reference is empty, false if not.</p> </td> </tr> </tbody> </table> <h3 id="methods">Methods </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_GetAsync_System_Boolean_System_Threading_CancellationToken_.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.GetAsync(System.Boolean%2CSystem.Threading.CancellationToken)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L145">View Source</a> </span> <a id="Kephas_Data_Ref_1_GetAsync_" data-uid="Kephas.Data.Ref`1.GetAsync*"></a> <h4 id="Kephas_Data_Ref_1_GetAsync_System_Boolean_System_Threading_CancellationToken_" data-uid="Kephas.Data.Ref`1.GetAsync(System.Boolean,System.Threading.CancellationToken)">GetAsync(Boolean, CancellationToken)</h4> <div class="markdown level1 summary"><p>Gets the referenced entity asynchronously.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public virtual Task&lt;T&gt; GetAsync(bool throwIfNotFound = true, CancellationToken cancellationToken = default(CancellationToken))</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Boolean</span></td> <td><span class="parametername">throwIfNotFound</span></td> <td><p>If true and the referenced entity is not found, an exception occurs.</p> </td> </tr> <tr> <td><span class="xref">System.Threading.CancellationToken</span></td> <td><span class="parametername">cancellationToken</span></td> <td><p>The cancellation token (optional).</p> </td> </tr> </tbody> </table> <h5 class="returns">Returns</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Threading.Tasks.Task</span>&lt;T&gt;</td> <td><p>A task promising the referenced entity.</p> </td> </tr> </tbody> </table> <h3 id="eii">Explicit Interface Implementations </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_Kephas_Data_IIdentifiable_Id.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.Kephas%23Data%23IIdentifiable%23Id%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L49">View Source</a> </span> <a id="Kephas_Data_Ref_1_Kephas_Data_IIdentifiable_Id_" data-uid="Kephas.Data.Ref`1.Kephas#Data#IIdentifiable#Id*"></a> <h4 id="Kephas_Data_Ref_1_Kephas_Data_IIdentifiable_Id" data-uid="Kephas.Data.Ref`1.Kephas#Data#IIdentifiable#Id">IIdentifiable.Id</h4> <div class="markdown level1 summary"><p>Gets the identifier for this instance.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">object IIdentifiable.Id { get; }</code></pre> </div> <h5 class="returns">Returns</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Object</span></td> <td><p>The identifier.</p> </td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_Kephas_Data_IRef_Entity.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.Kephas%23Data%23IRef%23Entity%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L85">View Source</a> </span> <a id="Kephas_Data_Ref_1_Kephas_Data_IRef_Entity_" data-uid="Kephas.Data.Ref`1.Kephas#Data#IRef#Entity*"></a> <h4 id="Kephas_Data_Ref_1_Kephas_Data_IRef_Entity" data-uid="Kephas.Data.Ref`1.Kephas#Data#IRef#Entity">IRef.Entity</h4> <div class="markdown level1 summary"><p>Gets or sets the referenced entity.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">object IRef.Entity { get; set; }</code></pre> </div> <h5 class="returns">Returns</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Object</span></td> <td><p>The referenced entity.</p> </td> </tr> </tbody> </table> <h5 id="Kephas_Data_Ref_1_Kephas_Data_IRef_Entity_remarks">Remarks</h5> <div class="markdown level1 remarks"><p>The entity is not ensured to be set prior to calling <a class="xref" href="Kephas.Data.IRef.html#Kephas_Data_IRef_GetAsync_System_Boolean_System_Threading_CancellationToken_">GetAsync(Boolean, CancellationToken)</a> due to performance reasons, but the actual behavior is left to the implementor.</p> </div> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1_Kephas_Data_IRef_GetAsync_System_Boolean_System_Threading_CancellationToken_.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601.Kephas%23Data%23IRef%23GetAsync(System.Boolean%2CSystem.Threading.CancellationToken)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L180">View Source</a> </span> <a id="Kephas_Data_Ref_1_Kephas_Data_IRef_GetAsync_" data-uid="Kephas.Data.Ref`1.Kephas#Data#IRef#GetAsync*"></a> <h4 id="Kephas_Data_Ref_1_Kephas_Data_IRef_GetAsync_System_Boolean_System_Threading_CancellationToken_" data-uid="Kephas.Data.Ref`1.Kephas#Data#IRef#GetAsync(System.Boolean,System.Threading.CancellationToken)">IRef.GetAsync(Boolean, CancellationToken)</h4> <div class="markdown level1 summary"><p>Gets the referenced entity asynchronously.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="decalaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">Task&lt;object&gt; IRef.GetAsync(bool throwIfNotFound, CancellationToken cancellationToken)</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Boolean</span></td> <td><span class="parametername">throwIfNotFound</span></td> <td><p>If true and the referenced entity is not found, an exception occurs.</p> </td> </tr> <tr> <td><span class="xref">System.Threading.CancellationToken</span></td> <td><span class="parametername">cancellationToken</span></td> <td><p>The cancellation token (optional).</p> </td> </tr> </tbody> </table> <h5 class="returns">Returns</h5> <table class="table table-bordered table-striped table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">System.Object</span>&gt;</td> <td><p>A task promising the referenced entity.</p> </td> </tr> </tbody> </table> <h3 id="implements">Implements</h3> <div> <a class="xref" href="Kephas.Data.IRef-1.html">IRef&lt;T&gt;</a> </div> <div> <a class="xref" href="Kephas.Data.IRef.html">IRef</a> </div> <div> <a class="xref" href="Kephas.Data.IIdentifiable.html">IIdentifiable</a> </div> <h3 id="extensionmethods">Extension Methods</h3> <div> <a class="xref" href="Kephas.DynamicObjectExtensions.html#Kephas_DynamicObjectExtensions_SetPropertyValue_System_Object_System_String_System_Object_">DynamicObjectExtensions.SetPropertyValue(Object, String, Object)</a> </div> <div> <a class="xref" href="Kephas.DynamicObjectExtensions.html#Kephas_DynamicObjectExtensions_TrySetPropertyValue_System_Object_System_String_System_Object_">DynamicObjectExtensions.TrySetPropertyValue(Object, String, Object)</a> </div> <div> <a class="xref" href="Kephas.DynamicObjectExtensions.html#Kephas_DynamicObjectExtensions_GetPropertyValue_System_Object_System_String_">DynamicObjectExtensions.GetPropertyValue(Object, String)</a> </div> <div> <a class="xref" href="Kephas.DynamicObjectExtensions.html#Kephas_DynamicObjectExtensions_TryGetPropertyValue_System_Object_System_String_System_Object__">DynamicObjectExtensions.TryGetPropertyValue(Object, String, out Object)</a> </div> <div> <a class="xref" href="Kephas.DynamicObjectExtensions.html#Kephas_DynamicObjectExtensions_GetRuntimeTypeInfo_System_Object_">DynamicObjectExtensions.GetRuntimeTypeInfo(Object)</a> </div> <div> <a class="xref" href="Kephas.DynamicObjectExtensions.html#Kephas_DynamicObjectExtensions_ToDynamic_System_Object_">DynamicObjectExtensions.ToDynamic(Object)</a> </div> <div> <a class="xref" href="Kephas.DynamicObjectExtensions.html#Kephas_DynamicObjectExtensions_ToExpando_System_Object_">DynamicObjectExtensions.ToExpando(Object)</a> </div> <div> <a class="xref" href="Kephas.Behaviors.BehaviorValue.html#Kephas_Behaviors_BehaviorValue_ToBehaviorValue__1___0_">BehaviorValue.ToBehaviorValue&lt;TValue&gt;(TValue)</a> </div> <div> <a class="xref" href="Kephas.Collections.CollectionExtensions.html#Kephas_Collections_CollectionExtensions_AddRange__2___0_System_Collections_Generic_IEnumerable___1__">CollectionExtensions.AddRange&lt;T, TItem&gt;(T, IEnumerable&lt;TItem&gt;)</a> </div> <div> <a class="xref" href="Kephas.Logging.LoggingExtensions.html#Kephas_Logging_LoggingExtensions_GetLogger_System_Object_Kephas_Services_IContext_">LoggingExtensions.GetLogger(Object, IContext)</a> </div> <div> <a class="xref" href="Kephas.Model.TypeExtensions.html#Kephas_Model_TypeExtensions_GetAbstractType_System_Object_">TypeExtensions.GetAbstractType(Object)</a> </div> <div> <a class="xref" href="Kephas.Model.TypeExtensions.html#Kephas_Model_TypeExtensions_GetAbstractTypeInfo_System_Object_">TypeExtensions.GetAbstractTypeInfo(Object)</a> </div> <div> <a class="xref" href="Kephas.Reflection.ReflectionHelper.html#Kephas_Reflection_ReflectionHelper_GetTypeInfo_System_Object_">ReflectionHelper.GetTypeInfo(Object)</a> </div> <div> <a class="xref" href="Kephas.Data.Capabilities.EntityEntryExtensions.html#Kephas_Data_Capabilities_EntityEntryExtensions_TryGetAttachedEntityEntry_System_Object_">EntityEntryExtensions.TryGetAttachedEntityEntry(Object)</a> </div> </article> </div> <div class="hidden-sm col-md-2" role="complementary"> <div class="sideaffix"> <div class="contribution"> <ul class="nav"> <li> <a href="https://github.com/kephas-software/kephas/new/master/apiSpec/new?filename=Kephas_Data_Ref_1.md&amp;value=---%0Auid%3A%20Kephas.Data.Ref%601%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a> </li> <li> <a href="https://github.com/kephas-software/kephas/blob/master/src/Kephas.Data/Ref.cs/#L24" class="contribution-link">View Source</a> </li> </ul> </div> <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix"> <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> --> </nav> </div> </div> </div> </div> <footer> <div class="grad-bottom"></div> <div class="footer"> <div class="container"> <span class="pull-right"> <a href="#top">Back to top</a> </span> <span>Generated by <strong>DocFX</strong></span> </div> </div> </footer> </div> <script type="text/javascript" src="../styles/docfx.vendor.js"></script> <script type="text/javascript" src="../styles/docfx.js"></script> <script type="text/javascript" src="../styles/main.js"></script> </body> </html>
{ "content_hash": "a8a6748e81e489030129059d3b6b5116", "timestamp": "", "source": "github", "line_count": 610, "max_line_length": 526, "avg_line_length": 47.43606557377049, "alnum_prop": 0.6616671274536909, "repo_name": "quartz-software/kephas", "id": "5e24aee5a3b592b082be768eb7743ca493d482b8", "size": "28938", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/api/Kephas.Data.Ref-1.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1940" }, { "name": "C#", "bytes": "3855441" }, { "name": "PowerShell", "bytes": "3685" }, { "name": "TypeScript", "bytes": "9590" } ], "symlink_target": "" }
NS_ASSUME_NONNULL_BEGIN @class UIViewController; NS_CLASS_AVAILABLE_IOS(5_0) @interface UIStoryboardSegue : NSObject // Convenience constructor for returning a segue that performs a handler block in its -perform method. + (instancetype)segueWithIdentifier:(nullable NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination performHandler:(void (^)(void))performHandler NS_AVAILABLE_IOS(6_0); - (instancetype)initWithIdentifier:(nullable NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; @property (nullable, nonatomic, copy, readonly) NSString *identifier; @property (nonatomic, readonly) __kindof UIViewController *sourceViewController; @property (nonatomic, readonly) __kindof UIViewController *destinationViewController; /// Subclasses can override this method to augment or replace the effect of this segue. For example, to animate alongside the effect of a Modal Presentation segue, an override of this method can call super, then send -animateAlongsideTransition:completion: to the transitionCoordinator of the destinationViewController. /// The segue runtime will call +[UIView setAnimationsAreEnabled:] prior to invoking this method, based on the value of the Animates checkbox in the Properties Inspector for the segue. - (void)perform; @end /// Encapsulates the source of a prospective unwind segue. /// You do not create instances of this class directly. Instead, UIKit creates an instance of this class and sends -allowedChildViewControllersForUnwindingFromSource: to each ancestor of the sourceViewController until it finds a view controller which returns YES from -canPerformUnwindSegueAction:fromViewController:withSender:. NS_CLASS_AVAILABLE_IOS(9_0) @interface UIStoryboardUnwindSegueSource : NSObject - (instancetype)init NS_UNAVAILABLE; @property (readonly) UIViewController *sourceViewController; @property (readonly) SEL unwindAction; @property (readonly, nullable) id sender; @end NS_ASSUME_NONNULL_END
{ "content_hash": "e2fae5502f83d78f6b4bdf86ce5922d4", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 328, "avg_line_length": 59.82857142857143, "alnum_prop": 0.8147086914995224, "repo_name": "caolonghan/First", "id": "35bec67175fe380c42e74669fd06dd0c328427a6", "size": "2260", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CapitaStar_IOS_1.2.4 2 11.14适配x/kaidexing/Pods/UIKit.framework/Headers/UIStoryboardSegue.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "252220" }, { "name": "C++", "bytes": "38429" }, { "name": "HTML", "bytes": "2335" }, { "name": "JavaScript", "bytes": "64403" }, { "name": "Objective-C", "bytes": "7326896" }, { "name": "Objective-C++", "bytes": "21082" }, { "name": "Ruby", "bytes": "279" }, { "name": "Shell", "bytes": "11756" }, { "name": "Swift", "bytes": "5136" } ], "symlink_target": "" }
package org.apache.avro.tool; import java.io.File; import java.io.InputStream; import java.io.PrintStream; import java.util.List; import org.apache.avro.Schema; import org.apache.avro.util.RandomData; import org.apache.trevni.ColumnFileMetaData; import org.apache.trevni.avro.AvroColumnWriter; /** Tool to create randomly populated Trevni file based on an Avro schema */ public class TrevniCreateRandomTool implements Tool { @Override public String getName() { return "trevni_random"; } @Override public String getShortDescription() { return "Create a Trevni file filled with random instances of a schema."; } @Override public int run(InputStream stdin, PrintStream out, PrintStream err, List<String> args) throws Exception { if (args.size() != 3) { err.println("Usage: schemaFile count outputFile"); return 1; } File schemaFile = new File(args.get(0)); int count = Integer.parseInt(args.get(1)); File outputFile = new File(args.get(2)); Schema schema = new Schema.Parser().parse(schemaFile); AvroColumnWriter<Object> writer = new AvroColumnWriter<>(schema, new ColumnFileMetaData()); for (Object datum : new RandomData(schema, count)) writer.write(datum); writer.writeTo(outputFile); return 0; } }
{ "content_hash": "1d87bcf9d6beac83af1793fc14bf8a81", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 107, "avg_line_length": 26.448979591836736, "alnum_prop": 0.7160493827160493, "repo_name": "apache/avro", "id": "6c88956e9b7d5a0ddc413e4cdfbc3762d92b5166", "size": "2102", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lang/java/tools/src/main/java/org/apache/avro/tool/TrevniCreateRandomTool.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1510" }, { "name": "C", "bytes": "971770" }, { "name": "C#", "bytes": "1556714" }, { "name": "C++", "bytes": "782233" }, { "name": "CMake", "bytes": "28974" }, { "name": "CSS", "bytes": "3564" }, { "name": "Dockerfile", "bytes": "8920" }, { "name": "HTML", "bytes": "109383" }, { "name": "Java", "bytes": "4059696" }, { "name": "JavaScript", "bytes": "351520" }, { "name": "LLVM", "bytes": "7847" }, { "name": "M4", "bytes": "29412" }, { "name": "Makefile", "bytes": "2320" }, { "name": "PHP", "bytes": "267747" }, { "name": "Perl", "bytes": "116488" }, { "name": "Python", "bytes": "412833" }, { "name": "Ruby", "bytes": "248021" }, { "name": "Rust", "bytes": "702593" }, { "name": "Shell", "bytes": "60162" }, { "name": "Thrift", "bytes": "1559" }, { "name": "Vim Script", "bytes": "2765" }, { "name": "Yacc", "bytes": "5195" } ], "symlink_target": "" }
package it.reply.orchestrator.dto.messaging.rucio; interface EventPayload { }
{ "content_hash": "328a49df4496b3929984f69a47bc7316", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 50, "avg_line_length": 11.714285714285714, "alnum_prop": 0.7804878048780488, "repo_name": "indigo-dc/orchestrator", "id": "49fb7e11440be9bd6afcc54d6bcf74e53b017f26", "size": "727", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/it/reply/orchestrator/dto/messaging/rucio/EventPayload.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "1641" }, { "name": "Java", "bytes": "1778503" }, { "name": "Shell", "bytes": "4281" } ], "symlink_target": "" }
* [Create a Kubernetes Cluster](kubernetes/deploy.md) - Create a your first Kubernetes cluster. Start here! * [Kubernetes Next Steps](kubernetes/walkthrough.md) - You have successfully deployed a Kubernetes cluster, now what? * [Troubleshooting](kubernetes/troubleshooting.md) - Running into issues? Start here to troubleshoot Kubernetes. * [Features](kubernetes/features.md) - Guide to alpha, beta, and stable functionality in acs-engine. ## Known Issues ### Node "NotReady" due to lost TCP connection Nodes might appear in the "NotReady" state for approx. 15 minutes if master stops receiving updates from agents. This is a known upstream kubernetes [issue #41916](https://github.com/kubernetes/kubernetes/issues/41916#issuecomment-312428731). This fixing PR is currently under review. ACS-Engine partially mitigates this issue on Linux by detecting dead TCP connections more quickly via **net.ipv4.tcp_retries2=8**. ## Additional Kubernetes Resources Here are recommended links to learn more about Kubernetes: 1. [Kubernetes Bootcamp](https://kubernetesbootcamp.github.io/kubernetes-bootcamp/index.html) - shows you how to deploy, scale, update, and debug containerized applications. 2. [Kubernetes Userguide](http://kubernetes.io/docs/user-guide/) - provides information on running programs in an existing Kubernetes cluster. 3. [Kubernetes Examples](https://github.com/kubernetes/kubernetes/tree/master/examples) - provides a number of examples on how to run real applications with Kubernetes.
{ "content_hash": "b7f91d83aed25ce62076ac4a3ab005f8", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 173, "avg_line_length": 66.56521739130434, "alnum_prop": 0.7811887655127367, "repo_name": "lachie83/acs-engine", "id": "6f9c931ea587b4a492d1059d28ec29a58b16d304", "size": "1588", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "docs/kubernetes.md", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "652090" }, { "name": "Groovy", "bytes": "24799" }, { "name": "Makefile", "bytes": "4589" }, { "name": "Perl", "bytes": "285296" }, { "name": "PowerShell", "bytes": "44888" }, { "name": "Python", "bytes": "6862" }, { "name": "Shell", "bytes": "74940" } ], "symlink_target": "" }
from google.net.proto import ProtocolBuffer import array import dummy_thread as thread __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit unusednames=printElemNumber,debug_strs no-special""" if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'): _extension_runtime = True _ExtendableProtocolMessage = ProtocolBuffer.ExtendableProtocolMessage else: _extension_runtime = False _ExtendableProtocolMessage = ProtocolBuffer.ProtocolMessage class PropertyValue_ReferenceValuePathElement(ProtocolBuffer.ProtocolMessage): has_type_ = 0 type_ = "" has_id_ = 0 id_ = 0 has_name_ = 0 name_ = "" def __init__(self, contents=None): if contents is not None: self.MergeFromString(contents) def type(self): return self.type_ def set_type(self, x): self.has_type_ = 1 self.type_ = x def clear_type(self): if self.has_type_: self.has_type_ = 0 self.type_ = "" def has_type(self): return self.has_type_ def id(self): return self.id_ def set_id(self, x): self.has_id_ = 1 self.id_ = x def clear_id(self): if self.has_id_: self.has_id_ = 0 self.id_ = 0 def has_id(self): return self.has_id_ def name(self): return self.name_ def set_name(self, x): self.has_name_ = 1 self.name_ = x def clear_name(self): if self.has_name_: self.has_name_ = 0 self.name_ = "" def has_name(self): return self.has_name_ def MergeFrom(self, x): assert x is not self if (x.has_type()): self.set_type(x.type()) if (x.has_id()): self.set_id(x.id()) if (x.has_name()): self.set_name(x.name()) def Equals(self, x): if x is self: return 1 if self.has_type_ != x.has_type_: return 0 if self.has_type_ and self.type_ != x.type_: return 0 if self.has_id_ != x.has_id_: return 0 if self.has_id_ and self.id_ != x.id_: return 0 if self.has_name_ != x.has_name_: return 0 if self.has_name_ and self.name_ != x.name_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_type_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: type not set.') return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.type_)) if (self.has_id_): n += 2 + self.lengthVarInt64(self.id_) if (self.has_name_): n += 2 + self.lengthString(len(self.name_)) return n + 1 def ByteSizePartial(self): n = 0 if (self.has_type_): n += 1 n += self.lengthString(len(self.type_)) if (self.has_id_): n += 2 + self.lengthVarInt64(self.id_) if (self.has_name_): n += 2 + self.lengthString(len(self.name_)) return n def Clear(self): self.clear_type() self.clear_id() self.clear_name() def OutputUnchecked(self, out): out.putVarInt32(122) out.putPrefixedString(self.type_) if (self.has_id_): out.putVarInt32(128) out.putVarInt64(self.id_) if (self.has_name_): out.putVarInt32(138) out.putPrefixedString(self.name_) def OutputPartial(self, out): if (self.has_type_): out.putVarInt32(122) out.putPrefixedString(self.type_) if (self.has_id_): out.putVarInt32(128) out.putVarInt64(self.id_) if (self.has_name_): out.putVarInt32(138) out.putPrefixedString(self.name_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 116: break if tt == 122: self.set_type(d.getPrefixedString()) continue if tt == 128: self.set_id(d.getVarInt64()) continue if tt == 138: self.set_name(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_type_: res+=prefix+("type: %s\n" % self.DebugFormatString(self.type_)) if self.has_id_: res+=prefix+("id: %s\n" % self.DebugFormatInt64(self.id_)) if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) return res class PropertyValue_PointValue(ProtocolBuffer.ProtocolMessage): has_x_ = 0 x_ = 0.0 has_y_ = 0 y_ = 0.0 def __init__(self, contents=None): if contents is not None: self.MergeFromString(contents) def x(self): return self.x_ def set_x(self, x): self.has_x_ = 1 self.x_ = x def clear_x(self): if self.has_x_: self.has_x_ = 0 self.x_ = 0.0 def has_x(self): return self.has_x_ def y(self): return self.y_ def set_y(self, x): self.has_y_ = 1 self.y_ = x def clear_y(self): if self.has_y_: self.has_y_ = 0 self.y_ = 0.0 def has_y(self): return self.has_y_ def MergeFrom(self, x): assert x is not self if (x.has_x()): self.set_x(x.x()) if (x.has_y()): self.set_y(x.y()) def Equals(self, x): if x is self: return 1 if self.has_x_ != x.has_x_: return 0 if self.has_x_ and self.x_ != x.x_: return 0 if self.has_y_ != x.has_y_: return 0 if self.has_y_ and self.y_ != x.y_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_x_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: x not set.') if (not self.has_y_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: y not set.') return initialized def ByteSize(self): n = 0 return n + 18 def ByteSizePartial(self): n = 0 if (self.has_x_): n += 9 if (self.has_y_): n += 9 return n def Clear(self): self.clear_x() self.clear_y() def OutputUnchecked(self, out): out.putVarInt32(49) out.putDouble(self.x_) out.putVarInt32(57) out.putDouble(self.y_) def OutputPartial(self, out): if (self.has_x_): out.putVarInt32(49) out.putDouble(self.x_) if (self.has_y_): out.putVarInt32(57) out.putDouble(self.y_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 44: break if tt == 49: self.set_x(d.getDouble()) continue if tt == 57: self.set_y(d.getDouble()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_x_: res+=prefix+("x: %s\n" % self.DebugFormat(self.x_)) if self.has_y_: res+=prefix+("y: %s\n" % self.DebugFormat(self.y_)) return res class PropertyValue_UserValue(ProtocolBuffer.ProtocolMessage): has_email_ = 0 email_ = "" has_auth_domain_ = 0 auth_domain_ = "" has_nickname_ = 0 nickname_ = "" has_gaiaid_ = 0 gaiaid_ = 0 has_obfuscated_gaiaid_ = 0 obfuscated_gaiaid_ = "" has_federated_identity_ = 0 federated_identity_ = "" has_federated_provider_ = 0 federated_provider_ = "" def __init__(self, contents=None): if contents is not None: self.MergeFromString(contents) def email(self): return self.email_ def set_email(self, x): self.has_email_ = 1 self.email_ = x def clear_email(self): if self.has_email_: self.has_email_ = 0 self.email_ = "" def has_email(self): return self.has_email_ def auth_domain(self): return self.auth_domain_ def set_auth_domain(self, x): self.has_auth_domain_ = 1 self.auth_domain_ = x def clear_auth_domain(self): if self.has_auth_domain_: self.has_auth_domain_ = 0 self.auth_domain_ = "" def has_auth_domain(self): return self.has_auth_domain_ def nickname(self): return self.nickname_ def set_nickname(self, x): self.has_nickname_ = 1 self.nickname_ = x def clear_nickname(self): if self.has_nickname_: self.has_nickname_ = 0 self.nickname_ = "" def has_nickname(self): return self.has_nickname_ def gaiaid(self): return self.gaiaid_ def set_gaiaid(self, x): self.has_gaiaid_ = 1 self.gaiaid_ = x def clear_gaiaid(self): if self.has_gaiaid_: self.has_gaiaid_ = 0 self.gaiaid_ = 0 def has_gaiaid(self): return self.has_gaiaid_ def obfuscated_gaiaid(self): return self.obfuscated_gaiaid_ def set_obfuscated_gaiaid(self, x): self.has_obfuscated_gaiaid_ = 1 self.obfuscated_gaiaid_ = x def clear_obfuscated_gaiaid(self): if self.has_obfuscated_gaiaid_: self.has_obfuscated_gaiaid_ = 0 self.obfuscated_gaiaid_ = "" def has_obfuscated_gaiaid(self): return self.has_obfuscated_gaiaid_ def federated_identity(self): return self.federated_identity_ def set_federated_identity(self, x): self.has_federated_identity_ = 1 self.federated_identity_ = x def clear_federated_identity(self): if self.has_federated_identity_: self.has_federated_identity_ = 0 self.federated_identity_ = "" def has_federated_identity(self): return self.has_federated_identity_ def federated_provider(self): return self.federated_provider_ def set_federated_provider(self, x): self.has_federated_provider_ = 1 self.federated_provider_ = x def clear_federated_provider(self): if self.has_federated_provider_: self.has_federated_provider_ = 0 self.federated_provider_ = "" def has_federated_provider(self): return self.has_federated_provider_ def MergeFrom(self, x): assert x is not self if (x.has_email()): self.set_email(x.email()) if (x.has_auth_domain()): self.set_auth_domain(x.auth_domain()) if (x.has_nickname()): self.set_nickname(x.nickname()) if (x.has_gaiaid()): self.set_gaiaid(x.gaiaid()) if (x.has_obfuscated_gaiaid()): self.set_obfuscated_gaiaid(x.obfuscated_gaiaid()) if (x.has_federated_identity()): self.set_federated_identity(x.federated_identity()) if (x.has_federated_provider()): self.set_federated_provider(x.federated_provider()) def Equals(self, x): if x is self: return 1 if self.has_email_ != x.has_email_: return 0 if self.has_email_ and self.email_ != x.email_: return 0 if self.has_auth_domain_ != x.has_auth_domain_: return 0 if self.has_auth_domain_ and self.auth_domain_ != x.auth_domain_: return 0 if self.has_nickname_ != x.has_nickname_: return 0 if self.has_nickname_ and self.nickname_ != x.nickname_: return 0 if self.has_gaiaid_ != x.has_gaiaid_: return 0 if self.has_gaiaid_ and self.gaiaid_ != x.gaiaid_: return 0 if self.has_obfuscated_gaiaid_ != x.has_obfuscated_gaiaid_: return 0 if self.has_obfuscated_gaiaid_ and self.obfuscated_gaiaid_ != x.obfuscated_gaiaid_: return 0 if self.has_federated_identity_ != x.has_federated_identity_: return 0 if self.has_federated_identity_ and self.federated_identity_ != x.federated_identity_: return 0 if self.has_federated_provider_ != x.has_federated_provider_: return 0 if self.has_federated_provider_ and self.federated_provider_ != x.federated_provider_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_email_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: email not set.') if (not self.has_auth_domain_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: auth_domain not set.') if (not self.has_gaiaid_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: gaiaid not set.') return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.email_)) n += self.lengthString(len(self.auth_domain_)) if (self.has_nickname_): n += 1 + self.lengthString(len(self.nickname_)) n += self.lengthVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): n += 2 + self.lengthString(len(self.obfuscated_gaiaid_)) if (self.has_federated_identity_): n += 2 + self.lengthString(len(self.federated_identity_)) if (self.has_federated_provider_): n += 2 + self.lengthString(len(self.federated_provider_)) return n + 4 def ByteSizePartial(self): n = 0 if (self.has_email_): n += 1 n += self.lengthString(len(self.email_)) if (self.has_auth_domain_): n += 1 n += self.lengthString(len(self.auth_domain_)) if (self.has_nickname_): n += 1 + self.lengthString(len(self.nickname_)) if (self.has_gaiaid_): n += 2 n += self.lengthVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): n += 2 + self.lengthString(len(self.obfuscated_gaiaid_)) if (self.has_federated_identity_): n += 2 + self.lengthString(len(self.federated_identity_)) if (self.has_federated_provider_): n += 2 + self.lengthString(len(self.federated_provider_)) return n def Clear(self): self.clear_email() self.clear_auth_domain() self.clear_nickname() self.clear_gaiaid() self.clear_obfuscated_gaiaid() self.clear_federated_identity() self.clear_federated_provider() def OutputUnchecked(self, out): out.putVarInt32(74) out.putPrefixedString(self.email_) out.putVarInt32(82) out.putPrefixedString(self.auth_domain_) if (self.has_nickname_): out.putVarInt32(90) out.putPrefixedString(self.nickname_) out.putVarInt32(144) out.putVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): out.putVarInt32(154) out.putPrefixedString(self.obfuscated_gaiaid_) if (self.has_federated_identity_): out.putVarInt32(170) out.putPrefixedString(self.federated_identity_) if (self.has_federated_provider_): out.putVarInt32(178) out.putPrefixedString(self.federated_provider_) def OutputPartial(self, out): if (self.has_email_): out.putVarInt32(74) out.putPrefixedString(self.email_) if (self.has_auth_domain_): out.putVarInt32(82) out.putPrefixedString(self.auth_domain_) if (self.has_nickname_): out.putVarInt32(90) out.putPrefixedString(self.nickname_) if (self.has_gaiaid_): out.putVarInt32(144) out.putVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): out.putVarInt32(154) out.putPrefixedString(self.obfuscated_gaiaid_) if (self.has_federated_identity_): out.putVarInt32(170) out.putPrefixedString(self.federated_identity_) if (self.has_federated_provider_): out.putVarInt32(178) out.putPrefixedString(self.federated_provider_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 68: break if tt == 74: self.set_email(d.getPrefixedString()) continue if tt == 82: self.set_auth_domain(d.getPrefixedString()) continue if tt == 90: self.set_nickname(d.getPrefixedString()) continue if tt == 144: self.set_gaiaid(d.getVarInt64()) continue if tt == 154: self.set_obfuscated_gaiaid(d.getPrefixedString()) continue if tt == 170: self.set_federated_identity(d.getPrefixedString()) continue if tt == 178: self.set_federated_provider(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_email_: res+=prefix+("email: %s\n" % self.DebugFormatString(self.email_)) if self.has_auth_domain_: res+=prefix+("auth_domain: %s\n" % self.DebugFormatString(self.auth_domain_)) if self.has_nickname_: res+=prefix+("nickname: %s\n" % self.DebugFormatString(self.nickname_)) if self.has_gaiaid_: res+=prefix+("gaiaid: %s\n" % self.DebugFormatInt64(self.gaiaid_)) if self.has_obfuscated_gaiaid_: res+=prefix+("obfuscated_gaiaid: %s\n" % self.DebugFormatString(self.obfuscated_gaiaid_)) if self.has_federated_identity_: res+=prefix+("federated_identity: %s\n" % self.DebugFormatString(self.federated_identity_)) if self.has_federated_provider_: res+=prefix+("federated_provider: %s\n" % self.DebugFormatString(self.federated_provider_)) return res class PropertyValue_ReferenceValue(ProtocolBuffer.ProtocolMessage): has_app_ = 0 app_ = "" has_name_space_ = 0 name_space_ = "" def __init__(self, contents=None): self.pathelement_ = [] if contents is not None: self.MergeFromString(contents) def app(self): return self.app_ def set_app(self, x): self.has_app_ = 1 self.app_ = x def clear_app(self): if self.has_app_: self.has_app_ = 0 self.app_ = "" def has_app(self): return self.has_app_ def name_space(self): return self.name_space_ def set_name_space(self, x): self.has_name_space_ = 1 self.name_space_ = x def clear_name_space(self): if self.has_name_space_: self.has_name_space_ = 0 self.name_space_ = "" def has_name_space(self): return self.has_name_space_ def pathelement_size(self): return len(self.pathelement_) def pathelement_list(self): return self.pathelement_ def pathelement(self, i): return self.pathelement_[i] def mutable_pathelement(self, i): return self.pathelement_[i] def add_pathelement(self): x = PropertyValue_ReferenceValuePathElement() self.pathelement_.append(x) return x def clear_pathelement(self): self.pathelement_ = [] def MergeFrom(self, x): assert x is not self if (x.has_app()): self.set_app(x.app()) if (x.has_name_space()): self.set_name_space(x.name_space()) for i in xrange(x.pathelement_size()): self.add_pathelement().CopyFrom(x.pathelement(i)) def Equals(self, x): if x is self: return 1 if self.has_app_ != x.has_app_: return 0 if self.has_app_ and self.app_ != x.app_: return 0 if self.has_name_space_ != x.has_name_space_: return 0 if self.has_name_space_ and self.name_space_ != x.name_space_: return 0 if len(self.pathelement_) != len(x.pathelement_): return 0 for e1, e2 in zip(self.pathelement_, x.pathelement_): if e1 != e2: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_app_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: app not set.') for p in self.pathelement_: if not p.IsInitialized(debug_strs): initialized=0 return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.app_)) if (self.has_name_space_): n += 2 + self.lengthString(len(self.name_space_)) n += 2 * len(self.pathelement_) for i in xrange(len(self.pathelement_)): n += self.pathelement_[i].ByteSize() return n + 1 def ByteSizePartial(self): n = 0 if (self.has_app_): n += 1 n += self.lengthString(len(self.app_)) if (self.has_name_space_): n += 2 + self.lengthString(len(self.name_space_)) n += 2 * len(self.pathelement_) for i in xrange(len(self.pathelement_)): n += self.pathelement_[i].ByteSizePartial() return n def Clear(self): self.clear_app() self.clear_name_space() self.clear_pathelement() def OutputUnchecked(self, out): out.putVarInt32(106) out.putPrefixedString(self.app_) for i in xrange(len(self.pathelement_)): out.putVarInt32(115) self.pathelement_[i].OutputUnchecked(out) out.putVarInt32(116) if (self.has_name_space_): out.putVarInt32(162) out.putPrefixedString(self.name_space_) def OutputPartial(self, out): if (self.has_app_): out.putVarInt32(106) out.putPrefixedString(self.app_) for i in xrange(len(self.pathelement_)): out.putVarInt32(115) self.pathelement_[i].OutputPartial(out) out.putVarInt32(116) if (self.has_name_space_): out.putVarInt32(162) out.putPrefixedString(self.name_space_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 100: break if tt == 106: self.set_app(d.getPrefixedString()) continue if tt == 115: self.add_pathelement().TryMerge(d) continue if tt == 162: self.set_name_space(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_)) if self.has_name_space_: res+=prefix+("name_space: %s\n" % self.DebugFormatString(self.name_space_)) cnt=0 for e in self.pathelement_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("PathElement%s {\n" % elm) res+=e.__str__(prefix + " ", printElemNumber) res+=prefix+"}\n" cnt+=1 return res class PropertyValue(ProtocolBuffer.ProtocolMessage): has_int64value_ = 0 int64value_ = 0 has_booleanvalue_ = 0 booleanvalue_ = 0 has_stringvalue_ = 0 stringvalue_ = "" has_doublevalue_ = 0 doublevalue_ = 0.0 has_pointvalue_ = 0 pointvalue_ = None has_uservalue_ = 0 uservalue_ = None has_referencevalue_ = 0 referencevalue_ = None def __init__(self, contents=None): self.lazy_init_lock_ = thread.allocate_lock() if contents is not None: self.MergeFromString(contents) def int64value(self): return self.int64value_ def set_int64value(self, x): self.has_int64value_ = 1 self.int64value_ = x def clear_int64value(self): if self.has_int64value_: self.has_int64value_ = 0 self.int64value_ = 0 def has_int64value(self): return self.has_int64value_ def booleanvalue(self): return self.booleanvalue_ def set_booleanvalue(self, x): self.has_booleanvalue_ = 1 self.booleanvalue_ = x def clear_booleanvalue(self): if self.has_booleanvalue_: self.has_booleanvalue_ = 0 self.booleanvalue_ = 0 def has_booleanvalue(self): return self.has_booleanvalue_ def stringvalue(self): return self.stringvalue_ def set_stringvalue(self, x): self.has_stringvalue_ = 1 self.stringvalue_ = x def clear_stringvalue(self): if self.has_stringvalue_: self.has_stringvalue_ = 0 self.stringvalue_ = "" def has_stringvalue(self): return self.has_stringvalue_ def doublevalue(self): return self.doublevalue_ def set_doublevalue(self, x): self.has_doublevalue_ = 1 self.doublevalue_ = x def clear_doublevalue(self): if self.has_doublevalue_: self.has_doublevalue_ = 0 self.doublevalue_ = 0.0 def has_doublevalue(self): return self.has_doublevalue_ def pointvalue(self): if self.pointvalue_ is None: self.lazy_init_lock_.acquire() try: if self.pointvalue_ is None: self.pointvalue_ = PropertyValue_PointValue() finally: self.lazy_init_lock_.release() return self.pointvalue_ def mutable_pointvalue(self): self.has_pointvalue_ = 1; return self.pointvalue() def clear_pointvalue(self): if self.has_pointvalue_: self.has_pointvalue_ = 0; if self.pointvalue_ is not None: self.pointvalue_.Clear() def has_pointvalue(self): return self.has_pointvalue_ def uservalue(self): if self.uservalue_ is None: self.lazy_init_lock_.acquire() try: if self.uservalue_ is None: self.uservalue_ = PropertyValue_UserValue() finally: self.lazy_init_lock_.release() return self.uservalue_ def mutable_uservalue(self): self.has_uservalue_ = 1; return self.uservalue() def clear_uservalue(self): if self.has_uservalue_: self.has_uservalue_ = 0; if self.uservalue_ is not None: self.uservalue_.Clear() def has_uservalue(self): return self.has_uservalue_ def referencevalue(self): if self.referencevalue_ is None: self.lazy_init_lock_.acquire() try: if self.referencevalue_ is None: self.referencevalue_ = PropertyValue_ReferenceValue() finally: self.lazy_init_lock_.release() return self.referencevalue_ def mutable_referencevalue(self): self.has_referencevalue_ = 1; return self.referencevalue() def clear_referencevalue(self): if self.has_referencevalue_: self.has_referencevalue_ = 0; if self.referencevalue_ is not None: self.referencevalue_.Clear() def has_referencevalue(self): return self.has_referencevalue_ def MergeFrom(self, x): assert x is not self if (x.has_int64value()): self.set_int64value(x.int64value()) if (x.has_booleanvalue()): self.set_booleanvalue(x.booleanvalue()) if (x.has_stringvalue()): self.set_stringvalue(x.stringvalue()) if (x.has_doublevalue()): self.set_doublevalue(x.doublevalue()) if (x.has_pointvalue()): self.mutable_pointvalue().MergeFrom(x.pointvalue()) if (x.has_uservalue()): self.mutable_uservalue().MergeFrom(x.uservalue()) if (x.has_referencevalue()): self.mutable_referencevalue().MergeFrom(x.referencevalue()) def Equals(self, x): if x is self: return 1 if self.has_int64value_ != x.has_int64value_: return 0 if self.has_int64value_ and self.int64value_ != x.int64value_: return 0 if self.has_booleanvalue_ != x.has_booleanvalue_: return 0 if self.has_booleanvalue_ and self.booleanvalue_ != x.booleanvalue_: return 0 if self.has_stringvalue_ != x.has_stringvalue_: return 0 if self.has_stringvalue_ and self.stringvalue_ != x.stringvalue_: return 0 if self.has_doublevalue_ != x.has_doublevalue_: return 0 if self.has_doublevalue_ and self.doublevalue_ != x.doublevalue_: return 0 if self.has_pointvalue_ != x.has_pointvalue_: return 0 if self.has_pointvalue_ and self.pointvalue_ != x.pointvalue_: return 0 if self.has_uservalue_ != x.has_uservalue_: return 0 if self.has_uservalue_ and self.uservalue_ != x.uservalue_: return 0 if self.has_referencevalue_ != x.has_referencevalue_: return 0 if self.has_referencevalue_ and self.referencevalue_ != x.referencevalue_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (self.has_pointvalue_ and not self.pointvalue_.IsInitialized(debug_strs)): initialized = 0 if (self.has_uservalue_ and not self.uservalue_.IsInitialized(debug_strs)): initialized = 0 if (self.has_referencevalue_ and not self.referencevalue_.IsInitialized(debug_strs)): initialized = 0 return initialized def ByteSize(self): n = 0 if (self.has_int64value_): n += 1 + self.lengthVarInt64(self.int64value_) if (self.has_booleanvalue_): n += 2 if (self.has_stringvalue_): n += 1 + self.lengthString(len(self.stringvalue_)) if (self.has_doublevalue_): n += 9 if (self.has_pointvalue_): n += 2 + self.pointvalue_.ByteSize() if (self.has_uservalue_): n += 2 + self.uservalue_.ByteSize() if (self.has_referencevalue_): n += 2 + self.referencevalue_.ByteSize() return n def ByteSizePartial(self): n = 0 if (self.has_int64value_): n += 1 + self.lengthVarInt64(self.int64value_) if (self.has_booleanvalue_): n += 2 if (self.has_stringvalue_): n += 1 + self.lengthString(len(self.stringvalue_)) if (self.has_doublevalue_): n += 9 if (self.has_pointvalue_): n += 2 + self.pointvalue_.ByteSizePartial() if (self.has_uservalue_): n += 2 + self.uservalue_.ByteSizePartial() if (self.has_referencevalue_): n += 2 + self.referencevalue_.ByteSizePartial() return n def Clear(self): self.clear_int64value() self.clear_booleanvalue() self.clear_stringvalue() self.clear_doublevalue() self.clear_pointvalue() self.clear_uservalue() self.clear_referencevalue() def OutputUnchecked(self, out): if (self.has_int64value_): out.putVarInt32(8) out.putVarInt64(self.int64value_) if (self.has_booleanvalue_): out.putVarInt32(16) out.putBoolean(self.booleanvalue_) if (self.has_stringvalue_): out.putVarInt32(26) out.putPrefixedString(self.stringvalue_) if (self.has_doublevalue_): out.putVarInt32(33) out.putDouble(self.doublevalue_) if (self.has_pointvalue_): out.putVarInt32(43) self.pointvalue_.OutputUnchecked(out) out.putVarInt32(44) if (self.has_uservalue_): out.putVarInt32(67) self.uservalue_.OutputUnchecked(out) out.putVarInt32(68) if (self.has_referencevalue_): out.putVarInt32(99) self.referencevalue_.OutputUnchecked(out) out.putVarInt32(100) def OutputPartial(self, out): if (self.has_int64value_): out.putVarInt32(8) out.putVarInt64(self.int64value_) if (self.has_booleanvalue_): out.putVarInt32(16) out.putBoolean(self.booleanvalue_) if (self.has_stringvalue_): out.putVarInt32(26) out.putPrefixedString(self.stringvalue_) if (self.has_doublevalue_): out.putVarInt32(33) out.putDouble(self.doublevalue_) if (self.has_pointvalue_): out.putVarInt32(43) self.pointvalue_.OutputPartial(out) out.putVarInt32(44) if (self.has_uservalue_): out.putVarInt32(67) self.uservalue_.OutputPartial(out) out.putVarInt32(68) if (self.has_referencevalue_): out.putVarInt32(99) self.referencevalue_.OutputPartial(out) out.putVarInt32(100) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 8: self.set_int64value(d.getVarInt64()) continue if tt == 16: self.set_booleanvalue(d.getBoolean()) continue if tt == 26: self.set_stringvalue(d.getPrefixedString()) continue if tt == 33: self.set_doublevalue(d.getDouble()) continue if tt == 43: self.mutable_pointvalue().TryMerge(d) continue if tt == 67: self.mutable_uservalue().TryMerge(d) continue if tt == 99: self.mutable_referencevalue().TryMerge(d) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_int64value_: res+=prefix+("int64Value: %s\n" % self.DebugFormatInt64(self.int64value_)) if self.has_booleanvalue_: res+=prefix+("booleanValue: %s\n" % self.DebugFormatBool(self.booleanvalue_)) if self.has_stringvalue_: res+=prefix+("stringValue: %s\n" % self.DebugFormatString(self.stringvalue_)) if self.has_doublevalue_: res+=prefix+("doubleValue: %s\n" % self.DebugFormat(self.doublevalue_)) if self.has_pointvalue_: res+=prefix+"PointValue {\n" res+=self.pointvalue_.__str__(prefix + " ", printElemNumber) res+=prefix+"}\n" if self.has_uservalue_: res+=prefix+"UserValue {\n" res+=self.uservalue_.__str__(prefix + " ", printElemNumber) res+=prefix+"}\n" if self.has_referencevalue_: res+=prefix+"ReferenceValue {\n" res+=self.referencevalue_.__str__(prefix + " ", printElemNumber) res+=prefix+"}\n" return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kint64Value = 1 kbooleanValue = 2 kstringValue = 3 kdoubleValue = 4 kPointValueGroup = 5 kPointValuex = 6 kPointValuey = 7 kUserValueGroup = 8 kUserValueemail = 9 kUserValueauth_domain = 10 kUserValuenickname = 11 kUserValuegaiaid = 18 kUserValueobfuscated_gaiaid = 19 kUserValuefederated_identity = 21 kUserValuefederated_provider = 22 kReferenceValueGroup = 12 kReferenceValueapp = 13 kReferenceValuename_space = 20 kReferenceValuePathElementGroup = 14 kReferenceValuePathElementtype = 15 kReferenceValuePathElementid = 16 kReferenceValuePathElementname = 17 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 1: "int64Value", 2: "booleanValue", 3: "stringValue", 4: "doubleValue", 5: "PointValue", 6: "x", 7: "y", 8: "UserValue", 9: "email", 10: "auth_domain", 11: "nickname", 12: "ReferenceValue", 13: "app", 14: "PathElement", 15: "type", 16: "id", 17: "name", 18: "gaiaid", 19: "obfuscated_gaiaid", 20: "name_space", 21: "federated_identity", 22: "federated_provider", }, 22) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 1: ProtocolBuffer.Encoder.NUMERIC, 2: ProtocolBuffer.Encoder.NUMERIC, 3: ProtocolBuffer.Encoder.STRING, 4: ProtocolBuffer.Encoder.DOUBLE, 5: ProtocolBuffer.Encoder.STARTGROUP, 6: ProtocolBuffer.Encoder.DOUBLE, 7: ProtocolBuffer.Encoder.DOUBLE, 8: ProtocolBuffer.Encoder.STARTGROUP, 9: ProtocolBuffer.Encoder.STRING, 10: ProtocolBuffer.Encoder.STRING, 11: ProtocolBuffer.Encoder.STRING, 12: ProtocolBuffer.Encoder.STARTGROUP, 13: ProtocolBuffer.Encoder.STRING, 14: ProtocolBuffer.Encoder.STARTGROUP, 15: ProtocolBuffer.Encoder.STRING, 16: ProtocolBuffer.Encoder.NUMERIC, 17: ProtocolBuffer.Encoder.STRING, 18: ProtocolBuffer.Encoder.NUMERIC, 19: ProtocolBuffer.Encoder.STRING, 20: ProtocolBuffer.Encoder.STRING, 21: ProtocolBuffer.Encoder.STRING, 22: ProtocolBuffer.Encoder.STRING, }, 22, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.PropertyValue' class Property(ProtocolBuffer.ProtocolMessage): BLOB = 14 TEXT = 15 BYTESTRING = 16 ATOM_CATEGORY = 1 ATOM_LINK = 2 ATOM_TITLE = 3 ATOM_CONTENT = 4 ATOM_SUMMARY = 5 ATOM_AUTHOR = 6 GD_WHEN = 7 GD_EMAIL = 8 GEORSS_POINT = 9 GD_IM = 10 GD_PHONENUMBER = 11 GD_POSTALADDRESS = 12 GD_RATING = 13 BLOBKEY = 17 _Meaning_NAMES = { 14: "BLOB", 15: "TEXT", 16: "BYTESTRING", 1: "ATOM_CATEGORY", 2: "ATOM_LINK", 3: "ATOM_TITLE", 4: "ATOM_CONTENT", 5: "ATOM_SUMMARY", 6: "ATOM_AUTHOR", 7: "GD_WHEN", 8: "GD_EMAIL", 9: "GEORSS_POINT", 10: "GD_IM", 11: "GD_PHONENUMBER", 12: "GD_POSTALADDRESS", 13: "GD_RATING", 17: "BLOBKEY", } def Meaning_Name(cls, x): return cls._Meaning_NAMES.get(x, "") Meaning_Name = classmethod(Meaning_Name) has_meaning_ = 0 meaning_ = 0 has_meaning_uri_ = 0 meaning_uri_ = "" has_name_ = 0 name_ = "" has_value_ = 0 has_multiple_ = 0 multiple_ = 0 def __init__(self, contents=None): self.value_ = PropertyValue() if contents is not None: self.MergeFromString(contents) def meaning(self): return self.meaning_ def set_meaning(self, x): self.has_meaning_ = 1 self.meaning_ = x def clear_meaning(self): if self.has_meaning_: self.has_meaning_ = 0 self.meaning_ = 0 def has_meaning(self): return self.has_meaning_ def meaning_uri(self): return self.meaning_uri_ def set_meaning_uri(self, x): self.has_meaning_uri_ = 1 self.meaning_uri_ = x def clear_meaning_uri(self): if self.has_meaning_uri_: self.has_meaning_uri_ = 0 self.meaning_uri_ = "" def has_meaning_uri(self): return self.has_meaning_uri_ def name(self): return self.name_ def set_name(self, x): self.has_name_ = 1 self.name_ = x def clear_name(self): if self.has_name_: self.has_name_ = 0 self.name_ = "" def has_name(self): return self.has_name_ def value(self): return self.value_ def mutable_value(self): self.has_value_ = 1; return self.value_ def clear_value(self):self.has_value_ = 0; self.value_.Clear() def has_value(self): return self.has_value_ def multiple(self): return self.multiple_ def set_multiple(self, x): self.has_multiple_ = 1 self.multiple_ = x def clear_multiple(self): if self.has_multiple_: self.has_multiple_ = 0 self.multiple_ = 0 def has_multiple(self): return self.has_multiple_ def MergeFrom(self, x): assert x is not self if (x.has_meaning()): self.set_meaning(x.meaning()) if (x.has_meaning_uri()): self.set_meaning_uri(x.meaning_uri()) if (x.has_name()): self.set_name(x.name()) if (x.has_value()): self.mutable_value().MergeFrom(x.value()) if (x.has_multiple()): self.set_multiple(x.multiple()) def Equals(self, x): if x is self: return 1 if self.has_meaning_ != x.has_meaning_: return 0 if self.has_meaning_ and self.meaning_ != x.meaning_: return 0 if self.has_meaning_uri_ != x.has_meaning_uri_: return 0 if self.has_meaning_uri_ and self.meaning_uri_ != x.meaning_uri_: return 0 if self.has_name_ != x.has_name_: return 0 if self.has_name_ and self.name_ != x.name_: return 0 if self.has_value_ != x.has_value_: return 0 if self.has_value_ and self.value_ != x.value_: return 0 if self.has_multiple_ != x.has_multiple_: return 0 if self.has_multiple_ and self.multiple_ != x.multiple_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_name_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: name not set.') if (not self.has_value_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: value not set.') elif not self.value_.IsInitialized(debug_strs): initialized = 0 if (not self.has_multiple_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: multiple not set.') return initialized def ByteSize(self): n = 0 if (self.has_meaning_): n += 1 + self.lengthVarInt64(self.meaning_) if (self.has_meaning_uri_): n += 1 + self.lengthString(len(self.meaning_uri_)) n += self.lengthString(len(self.name_)) n += self.lengthString(self.value_.ByteSize()) return n + 4 def ByteSizePartial(self): n = 0 if (self.has_meaning_): n += 1 + self.lengthVarInt64(self.meaning_) if (self.has_meaning_uri_): n += 1 + self.lengthString(len(self.meaning_uri_)) if (self.has_name_): n += 1 n += self.lengthString(len(self.name_)) if (self.has_value_): n += 1 n += self.lengthString(self.value_.ByteSizePartial()) if (self.has_multiple_): n += 2 return n def Clear(self): self.clear_meaning() self.clear_meaning_uri() self.clear_name() self.clear_value() self.clear_multiple() def OutputUnchecked(self, out): if (self.has_meaning_): out.putVarInt32(8) out.putVarInt32(self.meaning_) if (self.has_meaning_uri_): out.putVarInt32(18) out.putPrefixedString(self.meaning_uri_) out.putVarInt32(26) out.putPrefixedString(self.name_) out.putVarInt32(32) out.putBoolean(self.multiple_) out.putVarInt32(42) out.putVarInt32(self.value_.ByteSize()) self.value_.OutputUnchecked(out) def OutputPartial(self, out): if (self.has_meaning_): out.putVarInt32(8) out.putVarInt32(self.meaning_) if (self.has_meaning_uri_): out.putVarInt32(18) out.putPrefixedString(self.meaning_uri_) if (self.has_name_): out.putVarInt32(26) out.putPrefixedString(self.name_) if (self.has_multiple_): out.putVarInt32(32) out.putBoolean(self.multiple_) if (self.has_value_): out.putVarInt32(42) out.putVarInt32(self.value_.ByteSizePartial()) self.value_.OutputPartial(out) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 8: self.set_meaning(d.getVarInt32()) continue if tt == 18: self.set_meaning_uri(d.getPrefixedString()) continue if tt == 26: self.set_name(d.getPrefixedString()) continue if tt == 32: self.set_multiple(d.getBoolean()) continue if tt == 42: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_value().TryMerge(tmp) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_meaning_: res+=prefix+("meaning: %s\n" % self.DebugFormatInt32(self.meaning_)) if self.has_meaning_uri_: res+=prefix+("meaning_uri: %s\n" % self.DebugFormatString(self.meaning_uri_)) if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) if self.has_value_: res+=prefix+"value <\n" res+=self.value_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" if self.has_multiple_: res+=prefix+("multiple: %s\n" % self.DebugFormatBool(self.multiple_)) return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kmeaning = 1 kmeaning_uri = 2 kname = 3 kvalue = 5 kmultiple = 4 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 1: "meaning", 2: "meaning_uri", 3: "name", 4: "multiple", 5: "value", }, 5) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 1: ProtocolBuffer.Encoder.NUMERIC, 2: ProtocolBuffer.Encoder.STRING, 3: ProtocolBuffer.Encoder.STRING, 4: ProtocolBuffer.Encoder.NUMERIC, 5: ProtocolBuffer.Encoder.STRING, }, 5, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.Property' class Path_Element(ProtocolBuffer.ProtocolMessage): has_type_ = 0 type_ = "" has_id_ = 0 id_ = 0 has_name_ = 0 name_ = "" def __init__(self, contents=None): if contents is not None: self.MergeFromString(contents) def type(self): return self.type_ def set_type(self, x): self.has_type_ = 1 self.type_ = x def clear_type(self): if self.has_type_: self.has_type_ = 0 self.type_ = "" def has_type(self): return self.has_type_ def id(self): return self.id_ def set_id(self, x): self.has_id_ = 1 self.id_ = x def clear_id(self): if self.has_id_: self.has_id_ = 0 self.id_ = 0 def has_id(self): return self.has_id_ def name(self): return self.name_ def set_name(self, x): self.has_name_ = 1 self.name_ = x def clear_name(self): if self.has_name_: self.has_name_ = 0 self.name_ = "" def has_name(self): return self.has_name_ def MergeFrom(self, x): assert x is not self if (x.has_type()): self.set_type(x.type()) if (x.has_id()): self.set_id(x.id()) if (x.has_name()): self.set_name(x.name()) def Equals(self, x): if x is self: return 1 if self.has_type_ != x.has_type_: return 0 if self.has_type_ and self.type_ != x.type_: return 0 if self.has_id_ != x.has_id_: return 0 if self.has_id_ and self.id_ != x.id_: return 0 if self.has_name_ != x.has_name_: return 0 if self.has_name_ and self.name_ != x.name_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_type_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: type not set.') return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.type_)) if (self.has_id_): n += 1 + self.lengthVarInt64(self.id_) if (self.has_name_): n += 1 + self.lengthString(len(self.name_)) return n + 1 def ByteSizePartial(self): n = 0 if (self.has_type_): n += 1 n += self.lengthString(len(self.type_)) if (self.has_id_): n += 1 + self.lengthVarInt64(self.id_) if (self.has_name_): n += 1 + self.lengthString(len(self.name_)) return n def Clear(self): self.clear_type() self.clear_id() self.clear_name() def OutputUnchecked(self, out): out.putVarInt32(18) out.putPrefixedString(self.type_) if (self.has_id_): out.putVarInt32(24) out.putVarInt64(self.id_) if (self.has_name_): out.putVarInt32(34) out.putPrefixedString(self.name_) def OutputPartial(self, out): if (self.has_type_): out.putVarInt32(18) out.putPrefixedString(self.type_) if (self.has_id_): out.putVarInt32(24) out.putVarInt64(self.id_) if (self.has_name_): out.putVarInt32(34) out.putPrefixedString(self.name_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 12: break if tt == 18: self.set_type(d.getPrefixedString()) continue if tt == 24: self.set_id(d.getVarInt64()) continue if tt == 34: self.set_name(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_type_: res+=prefix+("type: %s\n" % self.DebugFormatString(self.type_)) if self.has_id_: res+=prefix+("id: %s\n" % self.DebugFormatInt64(self.id_)) if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) return res class Path(ProtocolBuffer.ProtocolMessage): def __init__(self, contents=None): self.element_ = [] if contents is not None: self.MergeFromString(contents) def element_size(self): return len(self.element_) def element_list(self): return self.element_ def element(self, i): return self.element_[i] def mutable_element(self, i): return self.element_[i] def add_element(self): x = Path_Element() self.element_.append(x) return x def clear_element(self): self.element_ = [] def MergeFrom(self, x): assert x is not self for i in xrange(x.element_size()): self.add_element().CopyFrom(x.element(i)) def Equals(self, x): if x is self: return 1 if len(self.element_) != len(x.element_): return 0 for e1, e2 in zip(self.element_, x.element_): if e1 != e2: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 for p in self.element_: if not p.IsInitialized(debug_strs): initialized=0 return initialized def ByteSize(self): n = 0 n += 2 * len(self.element_) for i in xrange(len(self.element_)): n += self.element_[i].ByteSize() return n def ByteSizePartial(self): n = 0 n += 2 * len(self.element_) for i in xrange(len(self.element_)): n += self.element_[i].ByteSizePartial() return n def Clear(self): self.clear_element() def OutputUnchecked(self, out): for i in xrange(len(self.element_)): out.putVarInt32(11) self.element_[i].OutputUnchecked(out) out.putVarInt32(12) def OutputPartial(self, out): for i in xrange(len(self.element_)): out.putVarInt32(11) self.element_[i].OutputPartial(out) out.putVarInt32(12) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 11: self.add_element().TryMerge(d) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" cnt=0 for e in self.element_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("Element%s {\n" % elm) res+=e.__str__(prefix + " ", printElemNumber) res+=prefix+"}\n" cnt+=1 return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kElementGroup = 1 kElementtype = 2 kElementid = 3 kElementname = 4 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 1: "Element", 2: "type", 3: "id", 4: "name", }, 4) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 1: ProtocolBuffer.Encoder.STARTGROUP, 2: ProtocolBuffer.Encoder.STRING, 3: ProtocolBuffer.Encoder.NUMERIC, 4: ProtocolBuffer.Encoder.STRING, }, 4, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.Path' class Reference(ProtocolBuffer.ProtocolMessage): has_app_ = 0 app_ = "" has_name_space_ = 0 name_space_ = "" has_path_ = 0 def __init__(self, contents=None): self.path_ = Path() if contents is not None: self.MergeFromString(contents) def app(self): return self.app_ def set_app(self, x): self.has_app_ = 1 self.app_ = x def clear_app(self): if self.has_app_: self.has_app_ = 0 self.app_ = "" def has_app(self): return self.has_app_ def name_space(self): return self.name_space_ def set_name_space(self, x): self.has_name_space_ = 1 self.name_space_ = x def clear_name_space(self): if self.has_name_space_: self.has_name_space_ = 0 self.name_space_ = "" def has_name_space(self): return self.has_name_space_ def path(self): return self.path_ def mutable_path(self): self.has_path_ = 1; return self.path_ def clear_path(self):self.has_path_ = 0; self.path_.Clear() def has_path(self): return self.has_path_ def MergeFrom(self, x): assert x is not self if (x.has_app()): self.set_app(x.app()) if (x.has_name_space()): self.set_name_space(x.name_space()) if (x.has_path()): self.mutable_path().MergeFrom(x.path()) def Equals(self, x): if x is self: return 1 if self.has_app_ != x.has_app_: return 0 if self.has_app_ and self.app_ != x.app_: return 0 if self.has_name_space_ != x.has_name_space_: return 0 if self.has_name_space_ and self.name_space_ != x.name_space_: return 0 if self.has_path_ != x.has_path_: return 0 if self.has_path_ and self.path_ != x.path_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_app_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: app not set.') if (not self.has_path_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: path not set.') elif not self.path_.IsInitialized(debug_strs): initialized = 0 return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.app_)) if (self.has_name_space_): n += 2 + self.lengthString(len(self.name_space_)) n += self.lengthString(self.path_.ByteSize()) return n + 2 def ByteSizePartial(self): n = 0 if (self.has_app_): n += 1 n += self.lengthString(len(self.app_)) if (self.has_name_space_): n += 2 + self.lengthString(len(self.name_space_)) if (self.has_path_): n += 1 n += self.lengthString(self.path_.ByteSizePartial()) return n def Clear(self): self.clear_app() self.clear_name_space() self.clear_path() def OutputUnchecked(self, out): out.putVarInt32(106) out.putPrefixedString(self.app_) out.putVarInt32(114) out.putVarInt32(self.path_.ByteSize()) self.path_.OutputUnchecked(out) if (self.has_name_space_): out.putVarInt32(162) out.putPrefixedString(self.name_space_) def OutputPartial(self, out): if (self.has_app_): out.putVarInt32(106) out.putPrefixedString(self.app_) if (self.has_path_): out.putVarInt32(114) out.putVarInt32(self.path_.ByteSizePartial()) self.path_.OutputPartial(out) if (self.has_name_space_): out.putVarInt32(162) out.putPrefixedString(self.name_space_) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 106: self.set_app(d.getPrefixedString()) continue if tt == 114: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_path().TryMerge(tmp) continue if tt == 162: self.set_name_space(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_)) if self.has_name_space_: res+=prefix+("name_space: %s\n" % self.DebugFormatString(self.name_space_)) if self.has_path_: res+=prefix+"path <\n" res+=self.path_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kapp = 13 kname_space = 20 kpath = 14 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 13: "app", 14: "path", 20: "name_space", }, 20) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 13: ProtocolBuffer.Encoder.STRING, 14: ProtocolBuffer.Encoder.STRING, 20: ProtocolBuffer.Encoder.STRING, }, 20, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.Reference' class User(ProtocolBuffer.ProtocolMessage): has_email_ = 0 email_ = "" has_auth_domain_ = 0 auth_domain_ = "" has_nickname_ = 0 nickname_ = "" has_gaiaid_ = 0 gaiaid_ = 0 has_obfuscated_gaiaid_ = 0 obfuscated_gaiaid_ = "" has_federated_identity_ = 0 federated_identity_ = "" has_federated_provider_ = 0 federated_provider_ = "" def __init__(self, contents=None): if contents is not None: self.MergeFromString(contents) def email(self): return self.email_ def set_email(self, x): self.has_email_ = 1 self.email_ = x def clear_email(self): if self.has_email_: self.has_email_ = 0 self.email_ = "" def has_email(self): return self.has_email_ def auth_domain(self): return self.auth_domain_ def set_auth_domain(self, x): self.has_auth_domain_ = 1 self.auth_domain_ = x def clear_auth_domain(self): if self.has_auth_domain_: self.has_auth_domain_ = 0 self.auth_domain_ = "" def has_auth_domain(self): return self.has_auth_domain_ def nickname(self): return self.nickname_ def set_nickname(self, x): self.has_nickname_ = 1 self.nickname_ = x def clear_nickname(self): if self.has_nickname_: self.has_nickname_ = 0 self.nickname_ = "" def has_nickname(self): return self.has_nickname_ def gaiaid(self): return self.gaiaid_ def set_gaiaid(self, x): self.has_gaiaid_ = 1 self.gaiaid_ = x def clear_gaiaid(self): if self.has_gaiaid_: self.has_gaiaid_ = 0 self.gaiaid_ = 0 def has_gaiaid(self): return self.has_gaiaid_ def obfuscated_gaiaid(self): return self.obfuscated_gaiaid_ def set_obfuscated_gaiaid(self, x): self.has_obfuscated_gaiaid_ = 1 self.obfuscated_gaiaid_ = x def clear_obfuscated_gaiaid(self): if self.has_obfuscated_gaiaid_: self.has_obfuscated_gaiaid_ = 0 self.obfuscated_gaiaid_ = "" def has_obfuscated_gaiaid(self): return self.has_obfuscated_gaiaid_ def federated_identity(self): return self.federated_identity_ def set_federated_identity(self, x): self.has_federated_identity_ = 1 self.federated_identity_ = x def clear_federated_identity(self): if self.has_federated_identity_: self.has_federated_identity_ = 0 self.federated_identity_ = "" def has_federated_identity(self): return self.has_federated_identity_ def federated_provider(self): return self.federated_provider_ def set_federated_provider(self, x): self.has_federated_provider_ = 1 self.federated_provider_ = x def clear_federated_provider(self): if self.has_federated_provider_: self.has_federated_provider_ = 0 self.federated_provider_ = "" def has_federated_provider(self): return self.has_federated_provider_ def MergeFrom(self, x): assert x is not self if (x.has_email()): self.set_email(x.email()) if (x.has_auth_domain()): self.set_auth_domain(x.auth_domain()) if (x.has_nickname()): self.set_nickname(x.nickname()) if (x.has_gaiaid()): self.set_gaiaid(x.gaiaid()) if (x.has_obfuscated_gaiaid()): self.set_obfuscated_gaiaid(x.obfuscated_gaiaid()) if (x.has_federated_identity()): self.set_federated_identity(x.federated_identity()) if (x.has_federated_provider()): self.set_federated_provider(x.federated_provider()) def Equals(self, x): if x is self: return 1 if self.has_email_ != x.has_email_: return 0 if self.has_email_ and self.email_ != x.email_: return 0 if self.has_auth_domain_ != x.has_auth_domain_: return 0 if self.has_auth_domain_ and self.auth_domain_ != x.auth_domain_: return 0 if self.has_nickname_ != x.has_nickname_: return 0 if self.has_nickname_ and self.nickname_ != x.nickname_: return 0 if self.has_gaiaid_ != x.has_gaiaid_: return 0 if self.has_gaiaid_ and self.gaiaid_ != x.gaiaid_: return 0 if self.has_obfuscated_gaiaid_ != x.has_obfuscated_gaiaid_: return 0 if self.has_obfuscated_gaiaid_ and self.obfuscated_gaiaid_ != x.obfuscated_gaiaid_: return 0 if self.has_federated_identity_ != x.has_federated_identity_: return 0 if self.has_federated_identity_ and self.federated_identity_ != x.federated_identity_: return 0 if self.has_federated_provider_ != x.has_federated_provider_: return 0 if self.has_federated_provider_ and self.federated_provider_ != x.federated_provider_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_email_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: email not set.') if (not self.has_auth_domain_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: auth_domain not set.') if (not self.has_gaiaid_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: gaiaid not set.') return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.email_)) n += self.lengthString(len(self.auth_domain_)) if (self.has_nickname_): n += 1 + self.lengthString(len(self.nickname_)) n += self.lengthVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): n += 1 + self.lengthString(len(self.obfuscated_gaiaid_)) if (self.has_federated_identity_): n += 1 + self.lengthString(len(self.federated_identity_)) if (self.has_federated_provider_): n += 1 + self.lengthString(len(self.federated_provider_)) return n + 3 def ByteSizePartial(self): n = 0 if (self.has_email_): n += 1 n += self.lengthString(len(self.email_)) if (self.has_auth_domain_): n += 1 n += self.lengthString(len(self.auth_domain_)) if (self.has_nickname_): n += 1 + self.lengthString(len(self.nickname_)) if (self.has_gaiaid_): n += 1 n += self.lengthVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): n += 1 + self.lengthString(len(self.obfuscated_gaiaid_)) if (self.has_federated_identity_): n += 1 + self.lengthString(len(self.federated_identity_)) if (self.has_federated_provider_): n += 1 + self.lengthString(len(self.federated_provider_)) return n def Clear(self): self.clear_email() self.clear_auth_domain() self.clear_nickname() self.clear_gaiaid() self.clear_obfuscated_gaiaid() self.clear_federated_identity() self.clear_federated_provider() def OutputUnchecked(self, out): out.putVarInt32(10) out.putPrefixedString(self.email_) out.putVarInt32(18) out.putPrefixedString(self.auth_domain_) if (self.has_nickname_): out.putVarInt32(26) out.putPrefixedString(self.nickname_) out.putVarInt32(32) out.putVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): out.putVarInt32(42) out.putPrefixedString(self.obfuscated_gaiaid_) if (self.has_federated_identity_): out.putVarInt32(50) out.putPrefixedString(self.federated_identity_) if (self.has_federated_provider_): out.putVarInt32(58) out.putPrefixedString(self.federated_provider_) def OutputPartial(self, out): if (self.has_email_): out.putVarInt32(10) out.putPrefixedString(self.email_) if (self.has_auth_domain_): out.putVarInt32(18) out.putPrefixedString(self.auth_domain_) if (self.has_nickname_): out.putVarInt32(26) out.putPrefixedString(self.nickname_) if (self.has_gaiaid_): out.putVarInt32(32) out.putVarInt64(self.gaiaid_) if (self.has_obfuscated_gaiaid_): out.putVarInt32(42) out.putPrefixedString(self.obfuscated_gaiaid_) if (self.has_federated_identity_): out.putVarInt32(50) out.putPrefixedString(self.federated_identity_) if (self.has_federated_provider_): out.putVarInt32(58) out.putPrefixedString(self.federated_provider_) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 10: self.set_email(d.getPrefixedString()) continue if tt == 18: self.set_auth_domain(d.getPrefixedString()) continue if tt == 26: self.set_nickname(d.getPrefixedString()) continue if tt == 32: self.set_gaiaid(d.getVarInt64()) continue if tt == 42: self.set_obfuscated_gaiaid(d.getPrefixedString()) continue if tt == 50: self.set_federated_identity(d.getPrefixedString()) continue if tt == 58: self.set_federated_provider(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_email_: res+=prefix+("email: %s\n" % self.DebugFormatString(self.email_)) if self.has_auth_domain_: res+=prefix+("auth_domain: %s\n" % self.DebugFormatString(self.auth_domain_)) if self.has_nickname_: res+=prefix+("nickname: %s\n" % self.DebugFormatString(self.nickname_)) if self.has_gaiaid_: res+=prefix+("gaiaid: %s\n" % self.DebugFormatInt64(self.gaiaid_)) if self.has_obfuscated_gaiaid_: res+=prefix+("obfuscated_gaiaid: %s\n" % self.DebugFormatString(self.obfuscated_gaiaid_)) if self.has_federated_identity_: res+=prefix+("federated_identity: %s\n" % self.DebugFormatString(self.federated_identity_)) if self.has_federated_provider_: res+=prefix+("federated_provider: %s\n" % self.DebugFormatString(self.federated_provider_)) return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kemail = 1 kauth_domain = 2 knickname = 3 kgaiaid = 4 kobfuscated_gaiaid = 5 kfederated_identity = 6 kfederated_provider = 7 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 1: "email", 2: "auth_domain", 3: "nickname", 4: "gaiaid", 5: "obfuscated_gaiaid", 6: "federated_identity", 7: "federated_provider", }, 7) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 1: ProtocolBuffer.Encoder.STRING, 2: ProtocolBuffer.Encoder.STRING, 3: ProtocolBuffer.Encoder.STRING, 4: ProtocolBuffer.Encoder.NUMERIC, 5: ProtocolBuffer.Encoder.STRING, 6: ProtocolBuffer.Encoder.STRING, 7: ProtocolBuffer.Encoder.STRING, }, 7, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.User' class EntityProto(ProtocolBuffer.ProtocolMessage): GD_CONTACT = 1 GD_EVENT = 2 GD_MESSAGE = 3 _Kind_NAMES = { 1: "GD_CONTACT", 2: "GD_EVENT", 3: "GD_MESSAGE", } def Kind_Name(cls, x): return cls._Kind_NAMES.get(x, "") Kind_Name = classmethod(Kind_Name) has_key_ = 0 has_entity_group_ = 0 has_owner_ = 0 owner_ = None has_kind_ = 0 kind_ = 0 has_kind_uri_ = 0 kind_uri_ = "" def __init__(self, contents=None): self.key_ = Reference() self.entity_group_ = Path() self.property_ = [] self.raw_property_ = [] self.lazy_init_lock_ = thread.allocate_lock() if contents is not None: self.MergeFromString(contents) def key(self): return self.key_ def mutable_key(self): self.has_key_ = 1; return self.key_ def clear_key(self):self.has_key_ = 0; self.key_.Clear() def has_key(self): return self.has_key_ def entity_group(self): return self.entity_group_ def mutable_entity_group(self): self.has_entity_group_ = 1; return self.entity_group_ def clear_entity_group(self):self.has_entity_group_ = 0; self.entity_group_.Clear() def has_entity_group(self): return self.has_entity_group_ def owner(self): if self.owner_ is None: self.lazy_init_lock_.acquire() try: if self.owner_ is None: self.owner_ = User() finally: self.lazy_init_lock_.release() return self.owner_ def mutable_owner(self): self.has_owner_ = 1; return self.owner() def clear_owner(self): if self.has_owner_: self.has_owner_ = 0; if self.owner_ is not None: self.owner_.Clear() def has_owner(self): return self.has_owner_ def kind(self): return self.kind_ def set_kind(self, x): self.has_kind_ = 1 self.kind_ = x def clear_kind(self): if self.has_kind_: self.has_kind_ = 0 self.kind_ = 0 def has_kind(self): return self.has_kind_ def kind_uri(self): return self.kind_uri_ def set_kind_uri(self, x): self.has_kind_uri_ = 1 self.kind_uri_ = x def clear_kind_uri(self): if self.has_kind_uri_: self.has_kind_uri_ = 0 self.kind_uri_ = "" def has_kind_uri(self): return self.has_kind_uri_ def property_size(self): return len(self.property_) def property_list(self): return self.property_ def property(self, i): return self.property_[i] def mutable_property(self, i): return self.property_[i] def add_property(self): x = Property() self.property_.append(x) return x def clear_property(self): self.property_ = [] def raw_property_size(self): return len(self.raw_property_) def raw_property_list(self): return self.raw_property_ def raw_property(self, i): return self.raw_property_[i] def mutable_raw_property(self, i): return self.raw_property_[i] def add_raw_property(self): x = Property() self.raw_property_.append(x) return x def clear_raw_property(self): self.raw_property_ = [] def MergeFrom(self, x): assert x is not self if (x.has_key()): self.mutable_key().MergeFrom(x.key()) if (x.has_entity_group()): self.mutable_entity_group().MergeFrom(x.entity_group()) if (x.has_owner()): self.mutable_owner().MergeFrom(x.owner()) if (x.has_kind()): self.set_kind(x.kind()) if (x.has_kind_uri()): self.set_kind_uri(x.kind_uri()) for i in xrange(x.property_size()): self.add_property().CopyFrom(x.property(i)) for i in xrange(x.raw_property_size()): self.add_raw_property().CopyFrom(x.raw_property(i)) def Equals(self, x): if x is self: return 1 if self.has_key_ != x.has_key_: return 0 if self.has_key_ and self.key_ != x.key_: return 0 if self.has_entity_group_ != x.has_entity_group_: return 0 if self.has_entity_group_ and self.entity_group_ != x.entity_group_: return 0 if self.has_owner_ != x.has_owner_: return 0 if self.has_owner_ and self.owner_ != x.owner_: return 0 if self.has_kind_ != x.has_kind_: return 0 if self.has_kind_ and self.kind_ != x.kind_: return 0 if self.has_kind_uri_ != x.has_kind_uri_: return 0 if self.has_kind_uri_ and self.kind_uri_ != x.kind_uri_: return 0 if len(self.property_) != len(x.property_): return 0 for e1, e2 in zip(self.property_, x.property_): if e1 != e2: return 0 if len(self.raw_property_) != len(x.raw_property_): return 0 for e1, e2 in zip(self.raw_property_, x.raw_property_): if e1 != e2: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_key_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: key not set.') elif not self.key_.IsInitialized(debug_strs): initialized = 0 if (not self.has_entity_group_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: entity_group not set.') elif not self.entity_group_.IsInitialized(debug_strs): initialized = 0 if (self.has_owner_ and not self.owner_.IsInitialized(debug_strs)): initialized = 0 for p in self.property_: if not p.IsInitialized(debug_strs): initialized=0 for p in self.raw_property_: if not p.IsInitialized(debug_strs): initialized=0 return initialized def ByteSize(self): n = 0 n += self.lengthString(self.key_.ByteSize()) n += self.lengthString(self.entity_group_.ByteSize()) if (self.has_owner_): n += 2 + self.lengthString(self.owner_.ByteSize()) if (self.has_kind_): n += 1 + self.lengthVarInt64(self.kind_) if (self.has_kind_uri_): n += 1 + self.lengthString(len(self.kind_uri_)) n += 1 * len(self.property_) for i in xrange(len(self.property_)): n += self.lengthString(self.property_[i].ByteSize()) n += 1 * len(self.raw_property_) for i in xrange(len(self.raw_property_)): n += self.lengthString(self.raw_property_[i].ByteSize()) return n + 3 def ByteSizePartial(self): n = 0 if (self.has_key_): n += 1 n += self.lengthString(self.key_.ByteSizePartial()) if (self.has_entity_group_): n += 2 n += self.lengthString(self.entity_group_.ByteSizePartial()) if (self.has_owner_): n += 2 + self.lengthString(self.owner_.ByteSizePartial()) if (self.has_kind_): n += 1 + self.lengthVarInt64(self.kind_) if (self.has_kind_uri_): n += 1 + self.lengthString(len(self.kind_uri_)) n += 1 * len(self.property_) for i in xrange(len(self.property_)): n += self.lengthString(self.property_[i].ByteSizePartial()) n += 1 * len(self.raw_property_) for i in xrange(len(self.raw_property_)): n += self.lengthString(self.raw_property_[i].ByteSizePartial()) return n def Clear(self): self.clear_key() self.clear_entity_group() self.clear_owner() self.clear_kind() self.clear_kind_uri() self.clear_property() self.clear_raw_property() def OutputUnchecked(self, out): if (self.has_kind_): out.putVarInt32(32) out.putVarInt32(self.kind_) if (self.has_kind_uri_): out.putVarInt32(42) out.putPrefixedString(self.kind_uri_) out.putVarInt32(106) out.putVarInt32(self.key_.ByteSize()) self.key_.OutputUnchecked(out) for i in xrange(len(self.property_)): out.putVarInt32(114) out.putVarInt32(self.property_[i].ByteSize()) self.property_[i].OutputUnchecked(out) for i in xrange(len(self.raw_property_)): out.putVarInt32(122) out.putVarInt32(self.raw_property_[i].ByteSize()) self.raw_property_[i].OutputUnchecked(out) out.putVarInt32(130) out.putVarInt32(self.entity_group_.ByteSize()) self.entity_group_.OutputUnchecked(out) if (self.has_owner_): out.putVarInt32(138) out.putVarInt32(self.owner_.ByteSize()) self.owner_.OutputUnchecked(out) def OutputPartial(self, out): if (self.has_kind_): out.putVarInt32(32) out.putVarInt32(self.kind_) if (self.has_kind_uri_): out.putVarInt32(42) out.putPrefixedString(self.kind_uri_) if (self.has_key_): out.putVarInt32(106) out.putVarInt32(self.key_.ByteSizePartial()) self.key_.OutputPartial(out) for i in xrange(len(self.property_)): out.putVarInt32(114) out.putVarInt32(self.property_[i].ByteSizePartial()) self.property_[i].OutputPartial(out) for i in xrange(len(self.raw_property_)): out.putVarInt32(122) out.putVarInt32(self.raw_property_[i].ByteSizePartial()) self.raw_property_[i].OutputPartial(out) if (self.has_entity_group_): out.putVarInt32(130) out.putVarInt32(self.entity_group_.ByteSizePartial()) self.entity_group_.OutputPartial(out) if (self.has_owner_): out.putVarInt32(138) out.putVarInt32(self.owner_.ByteSizePartial()) self.owner_.OutputPartial(out) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 32: self.set_kind(d.getVarInt32()) continue if tt == 42: self.set_kind_uri(d.getPrefixedString()) continue if tt == 106: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_key().TryMerge(tmp) continue if tt == 114: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.add_property().TryMerge(tmp) continue if tt == 122: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.add_raw_property().TryMerge(tmp) continue if tt == 130: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_entity_group().TryMerge(tmp) continue if tt == 138: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_owner().TryMerge(tmp) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_key_: res+=prefix+"key <\n" res+=self.key_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" if self.has_entity_group_: res+=prefix+"entity_group <\n" res+=self.entity_group_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" if self.has_owner_: res+=prefix+"owner <\n" res+=self.owner_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" if self.has_kind_: res+=prefix+("kind: %s\n" % self.DebugFormatInt32(self.kind_)) if self.has_kind_uri_: res+=prefix+("kind_uri: %s\n" % self.DebugFormatString(self.kind_uri_)) cnt=0 for e in self.property_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("property%s <\n" % elm) res+=e.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" cnt+=1 cnt=0 for e in self.raw_property_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("raw_property%s <\n" % elm) res+=e.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" cnt+=1 return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kkey = 13 kentity_group = 16 kowner = 17 kkind = 4 kkind_uri = 5 kproperty = 14 kraw_property = 15 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 4: "kind", 5: "kind_uri", 13: "key", 14: "property", 15: "raw_property", 16: "entity_group", 17: "owner", }, 17) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 4: ProtocolBuffer.Encoder.NUMERIC, 5: ProtocolBuffer.Encoder.STRING, 13: ProtocolBuffer.Encoder.STRING, 14: ProtocolBuffer.Encoder.STRING, 15: ProtocolBuffer.Encoder.STRING, 16: ProtocolBuffer.Encoder.STRING, 17: ProtocolBuffer.Encoder.STRING, }, 17, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.EntityProto' class CompositeProperty(ProtocolBuffer.ProtocolMessage): has_index_id_ = 0 index_id_ = 0 def __init__(self, contents=None): self.value_ = [] if contents is not None: self.MergeFromString(contents) def index_id(self): return self.index_id_ def set_index_id(self, x): self.has_index_id_ = 1 self.index_id_ = x def clear_index_id(self): if self.has_index_id_: self.has_index_id_ = 0 self.index_id_ = 0 def has_index_id(self): return self.has_index_id_ def value_size(self): return len(self.value_) def value_list(self): return self.value_ def value(self, i): return self.value_[i] def set_value(self, i, x): self.value_[i] = x def add_value(self, x): self.value_.append(x) def clear_value(self): self.value_ = [] def MergeFrom(self, x): assert x is not self if (x.has_index_id()): self.set_index_id(x.index_id()) for i in xrange(x.value_size()): self.add_value(x.value(i)) def Equals(self, x): if x is self: return 1 if self.has_index_id_ != x.has_index_id_: return 0 if self.has_index_id_ and self.index_id_ != x.index_id_: return 0 if len(self.value_) != len(x.value_): return 0 for e1, e2 in zip(self.value_, x.value_): if e1 != e2: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_index_id_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: index_id not set.') return initialized def ByteSize(self): n = 0 n += self.lengthVarInt64(self.index_id_) n += 1 * len(self.value_) for i in xrange(len(self.value_)): n += self.lengthString(len(self.value_[i])) return n + 1 def ByteSizePartial(self): n = 0 if (self.has_index_id_): n += 1 n += self.lengthVarInt64(self.index_id_) n += 1 * len(self.value_) for i in xrange(len(self.value_)): n += self.lengthString(len(self.value_[i])) return n def Clear(self): self.clear_index_id() self.clear_value() def OutputUnchecked(self, out): out.putVarInt32(8) out.putVarInt64(self.index_id_) for i in xrange(len(self.value_)): out.putVarInt32(18) out.putPrefixedString(self.value_[i]) def OutputPartial(self, out): if (self.has_index_id_): out.putVarInt32(8) out.putVarInt64(self.index_id_) for i in xrange(len(self.value_)): out.putVarInt32(18) out.putPrefixedString(self.value_[i]) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 8: self.set_index_id(d.getVarInt64()) continue if tt == 18: self.add_value(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_index_id_: res+=prefix+("index_id: %s\n" % self.DebugFormatInt64(self.index_id_)) cnt=0 for e in self.value_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("value%s: %s\n" % (elm, self.DebugFormatString(e))) cnt+=1 return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kindex_id = 1 kvalue = 2 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 1: "index_id", 2: "value", }, 2) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 1: ProtocolBuffer.Encoder.NUMERIC, 2: ProtocolBuffer.Encoder.STRING, }, 2, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.CompositeProperty' class Index_Property(ProtocolBuffer.ProtocolMessage): ASCENDING = 1 DESCENDING = 2 _Direction_NAMES = { 1: "ASCENDING", 2: "DESCENDING", } def Direction_Name(cls, x): return cls._Direction_NAMES.get(x, "") Direction_Name = classmethod(Direction_Name) has_name_ = 0 name_ = "" has_direction_ = 0 direction_ = 1 def __init__(self, contents=None): if contents is not None: self.MergeFromString(contents) def name(self): return self.name_ def set_name(self, x): self.has_name_ = 1 self.name_ = x def clear_name(self): if self.has_name_: self.has_name_ = 0 self.name_ = "" def has_name(self): return self.has_name_ def direction(self): return self.direction_ def set_direction(self, x): self.has_direction_ = 1 self.direction_ = x def clear_direction(self): if self.has_direction_: self.has_direction_ = 0 self.direction_ = 1 def has_direction(self): return self.has_direction_ def MergeFrom(self, x): assert x is not self if (x.has_name()): self.set_name(x.name()) if (x.has_direction()): self.set_direction(x.direction()) def Equals(self, x): if x is self: return 1 if self.has_name_ != x.has_name_: return 0 if self.has_name_ and self.name_ != x.name_: return 0 if self.has_direction_ != x.has_direction_: return 0 if self.has_direction_ and self.direction_ != x.direction_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_name_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: name not set.') return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.name_)) if (self.has_direction_): n += 1 + self.lengthVarInt64(self.direction_) return n + 1 def ByteSizePartial(self): n = 0 if (self.has_name_): n += 1 n += self.lengthString(len(self.name_)) if (self.has_direction_): n += 1 + self.lengthVarInt64(self.direction_) return n def Clear(self): self.clear_name() self.clear_direction() def OutputUnchecked(self, out): out.putVarInt32(26) out.putPrefixedString(self.name_) if (self.has_direction_): out.putVarInt32(32) out.putVarInt32(self.direction_) def OutputPartial(self, out): if (self.has_name_): out.putVarInt32(26) out.putPrefixedString(self.name_) if (self.has_direction_): out.putVarInt32(32) out.putVarInt32(self.direction_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 20: break if tt == 26: self.set_name(d.getPrefixedString()) continue if tt == 32: self.set_direction(d.getVarInt32()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) if self.has_direction_: res+=prefix+("direction: %s\n" % self.DebugFormatInt32(self.direction_)) return res class Index(ProtocolBuffer.ProtocolMessage): has_entity_type_ = 0 entity_type_ = "" has_ancestor_ = 0 ancestor_ = 0 def __init__(self, contents=None): self.property_ = [] if contents is not None: self.MergeFromString(contents) def entity_type(self): return self.entity_type_ def set_entity_type(self, x): self.has_entity_type_ = 1 self.entity_type_ = x def clear_entity_type(self): if self.has_entity_type_: self.has_entity_type_ = 0 self.entity_type_ = "" def has_entity_type(self): return self.has_entity_type_ def ancestor(self): return self.ancestor_ def set_ancestor(self, x): self.has_ancestor_ = 1 self.ancestor_ = x def clear_ancestor(self): if self.has_ancestor_: self.has_ancestor_ = 0 self.ancestor_ = 0 def has_ancestor(self): return self.has_ancestor_ def property_size(self): return len(self.property_) def property_list(self): return self.property_ def property(self, i): return self.property_[i] def mutable_property(self, i): return self.property_[i] def add_property(self): x = Index_Property() self.property_.append(x) return x def clear_property(self): self.property_ = [] def MergeFrom(self, x): assert x is not self if (x.has_entity_type()): self.set_entity_type(x.entity_type()) if (x.has_ancestor()): self.set_ancestor(x.ancestor()) for i in xrange(x.property_size()): self.add_property().CopyFrom(x.property(i)) def Equals(self, x): if x is self: return 1 if self.has_entity_type_ != x.has_entity_type_: return 0 if self.has_entity_type_ and self.entity_type_ != x.entity_type_: return 0 if self.has_ancestor_ != x.has_ancestor_: return 0 if self.has_ancestor_ and self.ancestor_ != x.ancestor_: return 0 if len(self.property_) != len(x.property_): return 0 for e1, e2 in zip(self.property_, x.property_): if e1 != e2: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_entity_type_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: entity_type not set.') if (not self.has_ancestor_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: ancestor not set.') for p in self.property_: if not p.IsInitialized(debug_strs): initialized=0 return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.entity_type_)) n += 2 * len(self.property_) for i in xrange(len(self.property_)): n += self.property_[i].ByteSize() return n + 3 def ByteSizePartial(self): n = 0 if (self.has_entity_type_): n += 1 n += self.lengthString(len(self.entity_type_)) if (self.has_ancestor_): n += 2 n += 2 * len(self.property_) for i in xrange(len(self.property_)): n += self.property_[i].ByteSizePartial() return n def Clear(self): self.clear_entity_type() self.clear_ancestor() self.clear_property() def OutputUnchecked(self, out): out.putVarInt32(10) out.putPrefixedString(self.entity_type_) for i in xrange(len(self.property_)): out.putVarInt32(19) self.property_[i].OutputUnchecked(out) out.putVarInt32(20) out.putVarInt32(40) out.putBoolean(self.ancestor_) def OutputPartial(self, out): if (self.has_entity_type_): out.putVarInt32(10) out.putPrefixedString(self.entity_type_) for i in xrange(len(self.property_)): out.putVarInt32(19) self.property_[i].OutputPartial(out) out.putVarInt32(20) if (self.has_ancestor_): out.putVarInt32(40) out.putBoolean(self.ancestor_) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 10: self.set_entity_type(d.getPrefixedString()) continue if tt == 19: self.add_property().TryMerge(d) continue if tt == 40: self.set_ancestor(d.getBoolean()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_entity_type_: res+=prefix+("entity_type: %s\n" % self.DebugFormatString(self.entity_type_)) if self.has_ancestor_: res+=prefix+("ancestor: %s\n" % self.DebugFormatBool(self.ancestor_)) cnt=0 for e in self.property_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("Property%s {\n" % elm) res+=e.__str__(prefix + " ", printElemNumber) res+=prefix+"}\n" cnt+=1 return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kentity_type = 1 kancestor = 5 kPropertyGroup = 2 kPropertyname = 3 kPropertydirection = 4 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 1: "entity_type", 2: "Property", 3: "name", 4: "direction", 5: "ancestor", }, 5) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 1: ProtocolBuffer.Encoder.STRING, 2: ProtocolBuffer.Encoder.STARTGROUP, 3: ProtocolBuffer.Encoder.STRING, 4: ProtocolBuffer.Encoder.NUMERIC, 5: ProtocolBuffer.Encoder.NUMERIC, }, 5, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.Index' class CompositeIndex(ProtocolBuffer.ProtocolMessage): WRITE_ONLY = 1 READ_WRITE = 2 DELETED = 3 ERROR = 4 _State_NAMES = { 1: "WRITE_ONLY", 2: "READ_WRITE", 3: "DELETED", 4: "ERROR", } def State_Name(cls, x): return cls._State_NAMES.get(x, "") State_Name = classmethod(State_Name) has_app_id_ = 0 app_id_ = "" has_id_ = 0 id_ = 0 has_definition_ = 0 has_state_ = 0 state_ = 0 def __init__(self, contents=None): self.definition_ = Index() if contents is not None: self.MergeFromString(contents) def app_id(self): return self.app_id_ def set_app_id(self, x): self.has_app_id_ = 1 self.app_id_ = x def clear_app_id(self): if self.has_app_id_: self.has_app_id_ = 0 self.app_id_ = "" def has_app_id(self): return self.has_app_id_ def id(self): return self.id_ def set_id(self, x): self.has_id_ = 1 self.id_ = x def clear_id(self): if self.has_id_: self.has_id_ = 0 self.id_ = 0 def has_id(self): return self.has_id_ def definition(self): return self.definition_ def mutable_definition(self): self.has_definition_ = 1; return self.definition_ def clear_definition(self):self.has_definition_ = 0; self.definition_.Clear() def has_definition(self): return self.has_definition_ def state(self): return self.state_ def set_state(self, x): self.has_state_ = 1 self.state_ = x def clear_state(self): if self.has_state_: self.has_state_ = 0 self.state_ = 0 def has_state(self): return self.has_state_ def MergeFrom(self, x): assert x is not self if (x.has_app_id()): self.set_app_id(x.app_id()) if (x.has_id()): self.set_id(x.id()) if (x.has_definition()): self.mutable_definition().MergeFrom(x.definition()) if (x.has_state()): self.set_state(x.state()) def Equals(self, x): if x is self: return 1 if self.has_app_id_ != x.has_app_id_: return 0 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0 if self.has_id_ != x.has_id_: return 0 if self.has_id_ and self.id_ != x.id_: return 0 if self.has_definition_ != x.has_definition_: return 0 if self.has_definition_ and self.definition_ != x.definition_: return 0 if self.has_state_ != x.has_state_: return 0 if self.has_state_ and self.state_ != x.state_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_app_id_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: app_id not set.') if (not self.has_id_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: id not set.') if (not self.has_definition_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: definition not set.') elif not self.definition_.IsInitialized(debug_strs): initialized = 0 if (not self.has_state_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: state not set.') return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.app_id_)) n += self.lengthVarInt64(self.id_) n += self.lengthString(self.definition_.ByteSize()) n += self.lengthVarInt64(self.state_) return n + 4 def ByteSizePartial(self): n = 0 if (self.has_app_id_): n += 1 n += self.lengthString(len(self.app_id_)) if (self.has_id_): n += 1 n += self.lengthVarInt64(self.id_) if (self.has_definition_): n += 1 n += self.lengthString(self.definition_.ByteSizePartial()) if (self.has_state_): n += 1 n += self.lengthVarInt64(self.state_) return n def Clear(self): self.clear_app_id() self.clear_id() self.clear_definition() self.clear_state() def OutputUnchecked(self, out): out.putVarInt32(10) out.putPrefixedString(self.app_id_) out.putVarInt32(16) out.putVarInt64(self.id_) out.putVarInt32(26) out.putVarInt32(self.definition_.ByteSize()) self.definition_.OutputUnchecked(out) out.putVarInt32(32) out.putVarInt32(self.state_) def OutputPartial(self, out): if (self.has_app_id_): out.putVarInt32(10) out.putPrefixedString(self.app_id_) if (self.has_id_): out.putVarInt32(16) out.putVarInt64(self.id_) if (self.has_definition_): out.putVarInt32(26) out.putVarInt32(self.definition_.ByteSizePartial()) self.definition_.OutputPartial(out) if (self.has_state_): out.putVarInt32(32) out.putVarInt32(self.state_) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 10: self.set_app_id(d.getPrefixedString()) continue if tt == 16: self.set_id(d.getVarInt64()) continue if tt == 26: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_definition().TryMerge(tmp) continue if tt == 32: self.set_state(d.getVarInt32()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_)) if self.has_id_: res+=prefix+("id: %s\n" % self.DebugFormatInt64(self.id_)) if self.has_definition_: res+=prefix+"definition <\n" res+=self.definition_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" if self.has_state_: res+=prefix+("state: %s\n" % self.DebugFormatInt32(self.state_)) return res def _BuildTagLookupTable(sparse, maxtag, default=None): return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)]) kapp_id = 1 kid = 2 kdefinition = 3 kstate = 4 _TEXT = _BuildTagLookupTable({ 0: "ErrorCode", 1: "app_id", 2: "id", 3: "definition", 4: "state", }, 4) _TYPES = _BuildTagLookupTable({ 0: ProtocolBuffer.Encoder.NUMERIC, 1: ProtocolBuffer.Encoder.STRING, 2: ProtocolBuffer.Encoder.NUMERIC, 3: ProtocolBuffer.Encoder.STRING, 4: ProtocolBuffer.Encoder.NUMERIC, }, 4, ProtocolBuffer.Encoder.MAX_TYPE) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.CompositeIndex' if _extension_runtime: pass __all__ = ['PropertyValue','PropertyValue_ReferenceValuePathElement','PropertyValue_PointValue','PropertyValue_UserValue','PropertyValue_ReferenceValue','Property','Path','Path_Element','Reference','User','EntityProto','CompositeProperty','Index','Index_Property','CompositeIndex']
{ "content_hash": "676eb7de346701ec4080787c36ddc779", "timestamp": "", "source": "github", "line_count": 3221, "max_line_length": 281, "avg_line_length": 29.480596088171374, "alnum_prop": 0.6338342618237729, "repo_name": "adviti/melange", "id": "274b04995f9a42ef58999b97a0cb61b047806113", "size": "95561", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "thirdparty/google_appengine/google/appengine/datastore/entity_pb.py", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
Please use the [issue tracker](https://github.com/acch/scrollpos-styler/issues) to ask questions, report bugs and request features. ## Contributing new content and updates - Fork the [code](https://github.com/acch/scrollpos-styler) to your own Git repository - Make changes in your forked repository - When you are happy with your updates, submit a [pull request](https://github.com/acch/scrollpos-styler/pulls) describing the changes - IMPORTANT: Make sure that your forked repository is in sync with the base repository before sending a pull request - The updates will be reviewed and merged in Adhere to the excellent [Code Guide](http://codeguide.co/). ## Copyright and license By contributing, you agree to license your contribution under the [MIT License](LICENSE).
{ "content_hash": "4e8cd712e3a2a5557f3d2a574e5355f3", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 134, "avg_line_length": 51.8, "alnum_prop": 0.7812097812097812, "repo_name": "acch/scrollpos-styler", "id": "2d9e2d0b98d78e7d2259be3f4d91255c7271b977", "size": "813", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CONTRIBUTING.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "5763" } ], "symlink_target": "" }
<div id="push"></div> </div> <!-- #wrap in moduel/navbar.html --> <div id="footer"> <div class="container"> <p class="muted credit"> &copy;&nbsp;1998-<%= (new Date).getFullYear() %> Dyn &minus;&nbsp; <i class="glyph-inbox glyph-small"></i>&nbsp;<a href="/legal">Legal Notices</a> &minus;&nbsp; <i class="icon-heart"></i>&nbsp;<a href="/thanks">Thanks</a> &minus;&nbsp; <i class="glyph-share_alt glyph-small"></i>&nbsp;<a href="https://github.com/Hackademy2013/showcase">Forks</a> </p> </div> </div> <script type="text/javascript" src="/script/jquery-2.0.0.js"></script> <script type="text/javascript" src="/framework/bootstrap/js/bootstrap.min.js"></script> </body> </html>
{ "content_hash": "869063ecc78c0377fdb2defc1b00a866", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 114, "avg_line_length": 44.125, "alnum_prop": 0.6317280453257791, "repo_name": "Hackademy2013/showcase", "id": "2b6c46f12785aaed78f59e3f8d9615217ddf95d6", "size": "706", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "view/module/foot.html", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "99663" }, { "name": "Shell", "bytes": "399" } ], "symlink_target": "" }
<!DOCTYPE html> <!-- Copyright (c) 2014, tibbitts All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> <ul class="nav nav-tabs" id="tabs" role="tablist"> <li class="active" id="media-tab" ><a href="#images" role="tab" data-toggle="tab">Media</a></li> <li id="controls-tab" style="display: none" ><a href="#controls" role="tab" data-toggle="tab">Controls</a></li> </ul> <div id="media-buttons"></div> <div id="controls" style="display: none;"> <button id="skip-backward-btn" class="btn btn-lg btn-default auto-wire" data-action="skipBackward" ><span class="glyphicon glyphicon-step-backward" ></span></button> <button id="play-btn" class="btn btn-lg btn-default" style="display: none"><span class="glyphicon glyphicon-play" ></span></button> <button id="pause-btn" class="btn btn-lg btn-default"><span class="glyphicon glyphicon-pause" ></span></button> <button id="skip-forward-btn" class="btn btn-lg btn-default auto-wire" data-action="skipForward" ><span class="glyphicon glyphicon-step-forward" ></span></button> <div style="padding-top: 30px"> <button id="mute-btn" class="btn btn-lg btn-default auto-wire" data-action="mute"><span class="glyphicon glyphicon-volume-off" ></span></button> <button id="volume-down-btn" class="btn btn-lg btn-default auto-wire" data-action="volumeDown"><span class="glyphicon glyphicon-volume-down" ></span></button> <button id="volume-up-btn" class="btn btn-lg btn-default auto-wire" data-action="volumeUp" ><span class="glyphicon glyphicon-volume-up" ></span></button> </div> </div> <script> var videos = [ { id: "ivuO-0jfYiM", title: "Opening Video", responseType: "youtube" }, { id: "GCCIiFij7tg", title: "Closing Video", responseType: "youtube" }, { id: "QMcBiqc0gh4", title: "Discovery Centers commercial", responseType: "youtube" }, ]; console.info("Creating media buttons"); $.each(videos, function(index, video) { $("#media-buttons").append("<button class='btn btn-lg btn-default media-btn' data-video='" + JSON.stringify(video) + "' ><span class='btn-nav' style='background-image: url(\"/image-cache?ref=https%3A%2F%2Fimg.youtube.com%2Fvi%2F"+ video.id +"%2Fsddefault.jpg\"); background-repeat: no-repeat; background-attachment: local; background-position: center; background-size:200px 150px '></span></button>") }); $(".media-btn").click(function() { sendToDisplay($(this).attr("data-video")); $("#controls-tab").show().click().addClass("active"); $("#media-tab").removeClass("active"); $("#pause-btn").show(); $("#play-btn").hide(); }); $("#media-tab").click(function (e) { $("#media-buttons").show(); $("#controls").hide(); }); $("#controls-tab").click(function (e) { $("#media-buttons").hide(); $("#controls").show(); }); $("#play-btn").click(function (e) { sendToDisplay(JSON.stringify({responseType:"play"})); $("#pause-btn").show(); $("#play-btn").hide(); }); $("#pause-btn").click(function (e) { sendToDisplay(JSON.stringify({responseType:"pause"})); $("#pause-btn").hide(); $("#play-btn").show(); }); $(".auto-wire").click(function (e) { sendToDisplay(JSON.stringify({responseType:$(this).attr("data-action")})); }); </script>
{ "content_hash": "a9edf2f0956970ae94226675a40ea60b", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 408, "avg_line_length": 46.0873786407767, "alnum_prop": 0.6509374341689488, "repo_name": "PuyallupStakeFamilyHistoryCenter/familyhistoryservice", "id": "a2f661d3689ba8d021bcda865af35925bea31e0a", "size": "4747", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/resources/static-content/fragments/controller-media-youtube.html", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "82804" }, { "name": "HTML", "bytes": "647931" }, { "name": "Java", "bytes": "253014" }, { "name": "JavaScript", "bytes": "2010941" }, { "name": "Shell", "bytes": "454" } ], "symlink_target": "" }
package org.olat.modules.wiki.restapi.vo; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; /** * bundles a List of WikiVo-Objects * * @author strentini, [email protected], http://www.frentix.com * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "wikis") public class WikiVOes { @XmlElementWrapper(name = "wikis") @XmlElement(name = "wiki") private WikiVO[] entries; @XmlAttribute(name = "totalCount") private int totalCount; public WikiVOes() { // make JAXB happy } public WikiVO[] getWikis() { return entries; } public void setWikis(WikiVO[] entries) { this.entries = entries; totalCount = entries.length; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } }
{ "content_hash": "809a0682d8fc22276bb3fb7123c7bdb8", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 73, "avg_line_length": 22.29787234042553, "alnum_prop": 0.7452290076335878, "repo_name": "stevenhva/InfoLearn_OpenOLAT", "id": "03c07ee32177fdd7e88eb0c9ecd252dcace5aad2", "size": "1870", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/main/java/org/olat/modules/wiki/restapi/vo/WikiVOes.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
import React from 'react'; import clazz from 'classnames'; import PropTypes from 'prop-types'; import override from 'core-decorators/lib/override'; import View from './View'; import * as componentStyles from '../styles/core/collectionView.sass'; const noop = arg => arg; class CollectionView extends View { static defaultProps = { ...View.defaultProps, itemLayout: noop }; static propTypes = { ...View.propTypes, itemLayout: PropTypes.func }; constructor (props, context) { super(props, context); } @override render () { const elementTree = super.render(); const props = elementTree.props; const { children, itemLayout } = this.props; const newProps = { ...props, className: clazz(props.className, componentStyles['collection-view']), children: React.Children.map(children, itemLayout) }; return React.cloneElement(elementTree, newProps); } } export default CollectionView;
{ "content_hash": "589d65637a33564a666660df906ed624", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 82, "avg_line_length": 24.833333333333332, "alnum_prop": 0.6308724832214765, "repo_name": "WellerQu/rongcapital-ui", "id": "7aef0f6c108d816a617070f25f3c1f118a202c52", "size": "1043", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/core/CollectionView.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4062" }, { "name": "JavaScript", "bytes": "74525" } ], "symlink_target": "" }
@media screen and (max-width:480px) { .wp2, .wp5 { margin-bottom: 30px; } .supplemental { text-align: center; margin: 0; padding: 0; } .credit { text-align: center; } } @media screen and (max-width:768px) { nav,.header-inner nav{position:fixed;background:#242830;z-index:2} nav ul li a{color:#fff} nav ul li a:hover{color:rgba(255,255,255,0.58)} } @media screen and (max-width:1024px) { .wp3 { background-position: 50px 0; } .subscribe { background-attachment: scroll; } } @media screen and (max-width:1280px) { .wp3 { background-position: 50px 0; } } @media screen and (min-width:480px) and (max-width:991px) { .wp2, .wp5, .wp6 { margin-bottom: 30px; } .supplemental { text-align: center; margin: 0; padding: 0; } .credit { text-align: center; } }
{ "content_hash": "5698efdb98ed45e746f8a9babc7c3578", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 67, "avg_line_length": 34.54545454545455, "alnum_prop": 0.6789473684210526, "repo_name": "anythingcodes/anythingcodes.github.io", "id": "d6d5d189328f40b947b20127d29e2370ab3e6b27", "size": "760", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "css/queries.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10011" }, { "name": "HTML", "bytes": "17337" }, { "name": "JavaScript", "bytes": "2449" } ], "symlink_target": "" }
package async import ( "context" "github.com/skygeario/skygear-server/pkg/core/config" "github.com/skygeario/skygear-server/pkg/core/db" "github.com/skygeario/skygear-server/pkg/core/logging" "github.com/skygeario/skygear-server/pkg/core/sentry" ) type Executor struct { tasks map[string]Task pool db.Pool } func NewExecutor(dbPool db.Pool) *Executor { return &Executor{ tasks: map[string]Task{}, pool: dbPool, } } func (e *Executor) Register(name string, task Task) { e.tasks[name] = task } func (e *Executor) Execute(ctx context.Context, spec TaskSpec) { ctx = db.InitDBContext(ctx, e.pool) task := e.tasks[spec.Name] tConfig := config.GetTenantConfig(ctx) logHook := logging.NewDefaultLogHook(tConfig.DefaultSensitiveLoggerValues()) sentryHook := &sentry.LogHook{Hub: sentry.DefaultClient.Hub} loggerFactory := logging.NewFactory(logHook, sentryHook) logger := loggerFactory.NewLogger("async-executor") go func() { defer func() { if rec := recover(); rec != nil { logger.WithFields(map[string]interface{}{ "task_name": spec.Name, "error": rec, }).Error("unexpected error occurred when running async task") } }() err := task.Run(ctx, spec.Param) if err != nil { logger.WithFields(map[string]interface{}{ "task_name": spec.Name, "error": err, }).Error("error occurred when running async task") } }() }
{ "content_hash": "8678d67e1407646e1ccbe25083464069", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 77, "avg_line_length": 24.875, "alnum_prop": 0.6927494615936827, "repo_name": "SkygearIO/skygear-server", "id": "1991d5d4966ba828c30c47cb1236740034329fe3", "size": "1393", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pkg/core/async/executor.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4510" }, { "name": "Dockerfile", "bytes": "2060" }, { "name": "Go", "bytes": "1818149" }, { "name": "HTML", "bytes": "311" }, { "name": "JavaScript", "bytes": "431" }, { "name": "Makefile", "bytes": "8695" }, { "name": "Nix", "bytes": "1486" }, { "name": "PLSQL", "bytes": "351" }, { "name": "PLpgSQL", "bytes": "1058" }, { "name": "Shell", "bytes": "5366" }, { "name": "TSQL", "bytes": "30624" } ], "symlink_target": "" }
package com.meisterschueler.ognviewer.common; import org.ogn.commons.beacon.ReceiverBeacon; import java.util.ArrayList; import java.util.List; public class ReceiverBundle { public ReceiverBeacon receiverBeacon; public int beaconCount; static public int maxBeaconCounter; public List<String> aircrafts; static public int maxAircraftCounter; public ReceiverBundle(ReceiverBeacon receiverBeacon) { this.receiverBeacon = receiverBeacon; this.beaconCount = 0; this.aircrafts = new ArrayList<>(); } }
{ "content_hash": "587f7f4c19c9ebd4278e612ac4b4730f", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 58, "avg_line_length": 26.238095238095237, "alnum_prop": 0.7422867513611615, "repo_name": "Meisterschueler/ogn-viewer-android", "id": "c050cdce567b961e127dc139a27c1ba4c3a8bc03", "size": "551", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/meisterschueler/ognviewer/common/ReceiverBundle.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "177004" } ], "symlink_target": "" }
{% extends "base.html" %} {% load thumbnail %} {% block content %} <div class="container"> <div class="row products-row"> <ul class="product-list"> {% for object in object_list %} <li class="product-list__item col-xs-6 col-md-4"> <a href="{% url "products:detail" object.slug %}"> {% if object.image %} <img class="b-lazy img-responsive full-w" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="{% thumbnail object.image 360x480 crop %}" alt="{{ object.name }}"> {% endif %} <h2>{{ object.name }}</h2> <span class="product-list__item__price">${{ object.price }}</span> </a> </li> {% endfor %} </ul> </div> </div> {% endblock %}
{ "content_hash": "ea308bf073a0cdc6931438ef67871577", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 101, "avg_line_length": 35.52, "alnum_prop": 0.49324324324324326, "repo_name": "martinstastny/django-simple-ecommerce", "id": "ce7f379d5e0a51ba73d2f25eb07597cb2f37f4a6", "size": "888", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "simplestore/products/templates/product_list.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2054" }, { "name": "HTML", "bytes": "19830" }, { "name": "JavaScript", "bytes": "12532" }, { "name": "Python", "bytes": "84571" } ], "symlink_target": "" }
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package admanager.axis.v202205.suggestedadunitservice; import static com.google.api.ads.common.lib.utils.Builder.DEFAULT_CONFIGURATION_FILENAME; import com.google.api.ads.admanager.axis.factory.AdManagerServices; import com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder; import com.google.api.ads.admanager.axis.v202205.ApiError; import com.google.api.ads.admanager.axis.v202205.ApiException; import com.google.api.ads.admanager.axis.v202205.SuggestedAdUnit; import com.google.api.ads.admanager.axis.v202205.SuggestedAdUnitPage; import com.google.api.ads.admanager.axis.v202205.SuggestedAdUnitServiceInterface; import com.google.api.ads.admanager.lib.client.AdManagerSession; import com.google.api.ads.common.lib.auth.OfflineCredentials; import com.google.api.ads.common.lib.auth.OfflineCredentials.Api; import com.google.api.ads.common.lib.conf.ConfigurationLoadException; import com.google.api.ads.common.lib.exception.OAuthException; import com.google.api.ads.common.lib.exception.ValidationException; import com.google.api.client.auth.oauth2.Credential; import com.google.common.base.Joiner; import java.rmi.RemoteException; /** * This example gets all suggested ad units. To approve suggested ad units, run * ApproveSuggestedAdUnits.java. This feature is only available to Ad Manager premium solution * networks. * * <p>Credentials and properties in {@code fromFile()} are pulled from the "ads.properties" file. * See README for more info. */ public class GetAllSuggestedAdUnits { /** * Runs the example. * * @param adManagerServices the services factory. * @param session the session. * @throws ApiException if the API request failed with one or more service errors. * @throws RemoteException if the API request failed due to other errors. */ public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the SuggestedAdUnitService. SuggestedAdUnitServiceInterface suggestedAdUnitService = adManagerServices.get(session, SuggestedAdUnitServiceInterface.class); // Create a statement to select all suggested ad units. StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get suggested ad units by statement. SuggestedAdUnitPage page = suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (SuggestedAdUnit suggestedAdUnit : page.getResults()) { System.out.printf( "%d) Suggested ad unit with ID '%s', path '%s', " + "and number of requests %d was found.%n", i++, suggestedAdUnit.getId(), Joiner.on('/').join(suggestedAdUnit.getPath()), suggestedAdUnit.getNumRequests()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); } public static void main(String[] args) { AdManagerSession session; try { // Generate a refreshable OAuth2 credential. Credential oAuth2Credential = new OfflineCredentials.Builder() .forApi(Api.AD_MANAGER) .fromFile() .build() .generateCredential(); // Construct a AdManagerSession. session = new AdManagerSession.Builder().fromFile().withOAuth2Credential(oAuth2Credential).build(); } catch (ConfigurationLoadException cle) { System.err.printf( "Failed to load configuration from the %s file. Exception: %s%n", DEFAULT_CONFIGURATION_FILENAME, cle); return; } catch (ValidationException ve) { System.err.printf( "Invalid configuration in the %s file. Exception: %s%n", DEFAULT_CONFIGURATION_FILENAME, ve); return; } catch (OAuthException oe) { System.err.printf( "Failed to create OAuth credentials. Check OAuth settings in the %s file. " + "Exception: %s%n", DEFAULT_CONFIGURATION_FILENAME, oe); return; } AdManagerServices adManagerServices = new AdManagerServices(); try { runExample(adManagerServices, session); } catch (ApiException apiException) { // ApiException is the base class for most exceptions thrown by an API request. Instances // of this exception have a message and a collection of ApiErrors that indicate the // type and underlying cause of the exception. Every exception object in the admanager.axis // packages will return a meaningful value from toString // // ApiException extends RemoteException, so this catch block must appear before the // catch block for RemoteException. System.err.println("Request failed due to ApiException. Underlying ApiErrors:"); if (apiException.getErrors() != null) { int i = 0; for (ApiError apiError : apiException.getErrors()) { System.err.printf(" Error %d: %s%n", i++, apiError); } } } catch (RemoteException re) { System.err.printf("Request failed unexpectedly due to RemoteException: %s%n", re); } } }
{ "content_hash": "ceeff18c663d893b3818c3f48466f52f", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 99, "avg_line_length": 41.993197278911566, "alnum_prop": 0.7061396403693504, "repo_name": "googleads/googleads-java-lib", "id": "5a6393aeaea840b6b48503bfb170ec43a1ea36ab", "size": "6173", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/admanager_axis/src/main/java/admanager/axis/v202205/suggestedadunitservice/GetAllSuggestedAdUnits.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "81068791" } ], "symlink_target": "" }
package com.instaclustr.cassandra.backup.impl.restore; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; import com.google.common.base.Joiner; import com.google.inject.Inject; import com.google.inject.assistedinject.Assisted; import com.instaclustr.cassandra.backup.guice.RestorerFactory; import com.instaclustr.cassandra.backup.impl.ManifestEntry; import com.instaclustr.cassandra.backup.impl.RemoteObjectReference; import com.instaclustr.operations.Operation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RestoreCommitLogsOperation extends Operation<RestoreCommitLogsOperationRequest> { private static final Logger logger = LoggerFactory.getLogger(RestoreCommitLogsOperation.class); private final static String CASSANDRA_COMMIT_LOGS = "commitlog"; private final Map<String, RestorerFactory> restorerFactoryMap; private final Path commitlogsPath; @Inject public RestoreCommitLogsOperation(final Map<String, RestorerFactory> restorerFactoryMap, @Assisted final RestoreCommitLogsOperationRequest request) { super(request); this.restorerFactoryMap = restorerFactoryMap; commitlogsPath = request.cassandraDirectory.resolve(CASSANDRA_COMMIT_LOGS); } @Override protected void run0() throws Exception { try (final Restorer restorer = restorerFactoryMap.get(request.storageLocation.storageProvider).createCommitLogRestorer(request)) { backupCurrentCommitLogs(); downloadCommitLogs(restorer); writeConfigOptions(); } } private void backupCurrentCommitLogs() throws Exception { final Set<Path> existingCommitlogsList = new HashSet<>(); if (commitlogsPath.toFile().exists()) try (Stream<Path> paths = Files.list(commitlogsPath)) { paths.filter(Files::isRegularFile).forEach(existingCommitlogsList::add); } if (existingCommitlogsList.size() > 0) { final Path currentCommitlogsPath = commitlogsPath.getParent().resolve("commitlogs-" + System.currentTimeMillis()); if (!currentCommitlogsPath.toFile().exists()) Files.createDirectory(currentCommitlogsPath); for (final Path file : existingCommitlogsList) { Files.move(file, currentCommitlogsPath.resolve(file.getFileName())); } } } private void downloadCommitLogs(final Restorer restorer) throws Exception { final RemoteObjectReference remoteObjectReference = restorer.objectKeyToRemoteReference(Paths.get("commitlog")); final Pattern commitlogPattern = Pattern.compile(".*(CommitLog-\\d+-\\d+\\.log)\\.(\\d+)"); final HashSet<ManifestEntry> parsedCommitlogList = new HashSet<>(); logger.info("Commencing processing of commit log listing"); final AtomicReference<ManifestEntry> overhangingManifestEntry = new AtomicReference<>(); final AtomicLong overhangingTimestamp = new AtomicLong(Long.MAX_VALUE); restorer.consumeFiles(remoteObjectReference, commitlogFile -> { final Matcher matcherCommitlog = commitlogPattern.matcher(commitlogFile.getObjectKey().toString()); if (matcherCommitlog.matches()) { final long commitlogTimestamp = Long.parseLong(matcherCommitlog.group(2)); if (commitlogTimestamp >= request.timestampStart && commitlogTimestamp <= request.timestampEnd) { parsedCommitlogList.add(new ManifestEntry(commitlogFile.getObjectKey(), commitlogsPath.resolve(matcherCommitlog.group(1)), ManifestEntry.Type.FILE, 0)); } else if (commitlogTimestamp > request.timestampEnd && commitlogTimestamp < overhangingTimestamp.get()) { // Make sure we also catch the first commitlog that goes past the end of the timestamp overhangingTimestamp.set(commitlogTimestamp); overhangingManifestEntry.set(new ManifestEntry(commitlogFile.getObjectKey(), commitlogsPath.resolve(matcherCommitlog.group(1)), ManifestEntry.Type.FILE, 0)); } } }); if (overhangingManifestEntry.get() != null) { parsedCommitlogList.add(overhangingManifestEntry.get()); } logger.info("Found {} commit logs to download", parsedCommitlogList.size()); if (parsedCommitlogList.size() == 0) { return; } restorer.downloadFiles(parsedCommitlogList); } /** * Add cassandra.replayList at the end of cassandra-env.sh. In case Cassandra container restarts, * this change will not be there anymore because configuration volume is ephemeral and gets * reconstructed every time from scratch. * <p> * However, when restoration tooling is run just against "vanilla" C* (without K8S), that added line will be there * "for ever". * * @throws IOException */ private void writeConfigOptions() throws IOException { if (request.keyspaceTables.size() > 0) { final String cassandraEnvStringBuilder = "JVM_OPTS=\"$JVM_OPTS -Dcassandra.replayList=" + Joiner.on(",").withKeyValueSeparator(".").join(request.keyspaceTables.entries()) + "\"\n"; Files.write(request.cassandraConfigDirectory.resolve("cassandra-env.sh"), cassandraEnvStringBuilder.getBytes(), StandardOpenOption.APPEND, StandardOpenOption.CREATE); } } }
{ "content_hash": "6a62a8f94fda07854a71be28fa59ef72", "timestamp": "", "source": "github", "line_count": 142, "max_line_length": 138, "avg_line_length": 44.66901408450704, "alnum_prop": 0.6478007252088916, "repo_name": "benbromhead/cassandra-operator", "id": "34f502107d3d27ae0942164ed264133361f72818", "size": "6343", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "java/backup-restore/src/main/java/com/instaclustr/cassandra/backup/impl/restore/RestoreCommitLogsOperation.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "3703" }, { "name": "Java", "bytes": "380511" }, { "name": "Makefile", "bytes": "3914" }, { "name": "Shell", "bytes": "12049" }, { "name": "Smarty", "bytes": "2125" } ], "symlink_target": "" }
This folder contains the extension implementation for the [Google](https://www.google.com). ## Data Supported - Blogger Import of Social Posts. - Calendar Import & Export - Contacts Import & Export - G+ export of posts - Mail Import & Export - Photos Import & Export - Tasks Import & Export - Social Posts Export ## Current State - Calendar doesn't support recurring events yet - All services still need some final testing - G+ exports are limited by what is avalible in their API: - Export is only for public posts - For posts with multiple albums only the thumbnails are ported - Blogger import: - Imports into your first blog, doesn't create a new blog for the imported content - Stores attached photos in Drive ## Keys & Auth Google uses OAuth 2 for authorization. ### Create a developer account Before getting started you will need a [Google Cloud developer account](https://console.developers.google.com/start) ### Google Photos #### Getting Started - Enable the Google Photos API and request an OAuth 2.0 client ID by following the [getting started guide](https://developers.google.com/photos/library/guides/get-started). - Choose which [authorization scopes](https://developers.google.com/photos/library/guides/authentication-authorization) your application will need. You can see the required scopes in the [GoogleOauthConfig](https://github.com/google/data-transfer-project/blob/master/extensions/auth/portability-auth-google/src/main/java/org/datatransferproject/auth/google/GoogleOAuthConfig.java#L51-L77). - Initially, your application will show an "Unverified app" message until it is [verified](https://support.google.com/cloud/answer/7454865) and you will have limited [API](https://developers.google.com/photos/library/guides/api-limits-quotas) and [OAuth](https://console.developers.google.com/apis/credentials/consent) quota - We recommend you review the [UX Guidelines](https://developers.google.com/photos/library/guides/ux-guidelines) and [Acceptable use policy](https://developers.google.com/photos/library/guides/acceptable-use) while designing your app if you want to eventually get increased quota through the Google Photos Partner Program. #### Launching to Production Before launching your application to production, you’ll want to get it verified and increase your quota limits by applying for the [Google Photos Partner Program](https://developers.google.com/photos/partner-program/overview). We recommend getting this process started well before your intended launch 1. Getting your app verified - Follow the [instructions](https://support.google.com/cloud/answer/7454865) under “Verification for apps”. **Note**: The OAuth consent screen requires a support email. This has to be a google account of a developer or a google group. - Visit the [OAuth API verification FAQs](https://support.google.com/cloud/answer/9110914) for more information. 2. Increasing Quota *Oauth* - You can monitor your Oauth token grant rate [here](https://console.developers.google.com/apis/credentials/consent). - To increase your quota, fill out this [form](https://support.google.com/code/contact/oauth_quota_increase). *API* - You can monitor your API quota [here](https://console.developers.google.com/iam-admin/quotas) - To increase your quota, apply for the [Google Photos Partner Program](https://developers.google.com/photos/partner-program/overview). **Note**: Your application must adhere to the [UX Guidelines](https://developers.google.com/photos/library/guides/ux-guidelines) and the [Acceptable use policy](https://developers.google.com/photos/library/guides/acceptable-use). - As part of your application you must pass an [integration review](https://developers.google.com/photos/partner-program/overview#launching) before launch, which could take several weeks to complete. #### Best Practices Some Google Photos API [best practices](https://developers.google.com/photos/library/guides/best-practices) are handled by the DTP infrastructure, but may require configuring: - __Authentication and authorization__ - only request the scopes required for the [specific adapter](https://github.com/google/data-transfer-project/blob/master/extensions/auth/portability-auth-google/src/main/java/org/datatransferproject/auth/google/GoogleOAuthConfig.java#L51-L77) you intend to use. - __Retrying Failed Requests__ - there is a [default retry strategy](https://github.com/google/data-transfer-project/blob/master/distributions/demo-server/src/main/resources/config/retry/default.yaml) built into the platform that is configurable. - __Exponential backoff__ - we rate limit the writes by default to 1/sec and employ exponential backoff for retries For more information about the Google Photos API, please visit their developer page. ## Maintained By The Google extension was created and maintained by the [DTP maintainers](mailto:[email protected]) (this includes developers from Google).
{ "content_hash": "06393561d8f9f0b65a2d4c194057351b", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 390, "avg_line_length": 72.20289855072464, "alnum_prop": 0.7858289843436371, "repo_name": "google/data-transfer-project", "id": "458dfc3c98d34380f91633eb7eaf09ec77a55cfa", "size": "4997", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "extensions/data-transfer/portability-data-transfer-google/Readme.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "7334" }, { "name": "Java", "bytes": "2226564" }, { "name": "JavaScript", "bytes": "2259" }, { "name": "SCSS", "bytes": "2383" }, { "name": "Shell", "bytes": "29124" }, { "name": "TypeScript", "bytes": "34008" } ], "symlink_target": "" }
@interface PodsDummy_Pods_iTunesRSSObjc_iTunesRSSObjc : NSObject @end @implementation PodsDummy_Pods_iTunesRSSObjc_iTunesRSSObjc @end
{ "content_hash": "3bcc29e146b6a61530e7dcee9dcad2ed", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 64, "avg_line_length": 33.5, "alnum_prop": 0.8582089552238806, "repo_name": "robmaceachern/iTunesRSSObjc", "id": "49ea6884d854c8c8274f8fcf2701c99c2dc6660a", "size": "168", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Example/Pods/Target Support Files/Pods-iTunesRSSObjc-iTunesRSSObjc/Pods-iTunesRSSObjc-iTunesRSSObjc-dummy.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "11564" }, { "name": "C++", "bytes": "334" }, { "name": "Objective-C", "bytes": "616044" }, { "name": "Ruby", "bytes": "2732" }, { "name": "Shell", "bytes": "8048" } ], "symlink_target": "" }
using NMF.Collections.Generic; using NMF.Collections.ObjectModel; using NMF.Expressions; using NMF.Expressions.Linq; using NMF.Models; using NMF.Models.Collections; using NMF.Models.Expressions; using NMF.Models.Repository; using NMF.Serialization; using NMF.Utilities; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Linq; namespace NMF.Models.Meta { [ModelRepresentationClassAttribute("http://nmf.codeplex.com/nmeta/#//IdentifierScope/")] public enum IdentifierScope { Inherit = 0, Local = 1, Global = 2, } }
{ "content_hash": "5d560b04a887f00a8a4f00f9ec206e7b", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 92, "avg_line_length": 21.235294117647058, "alnum_prop": 0.7202216066481995, "repo_name": "mlessmann/NMF", "id": "da149b3388462dc1295d89473dbb7a980f74cadc", "size": "1157", "binary": false, "copies": "1", "ref": "refs/heads/netcore", "path": "Models/Models/Meta/IdentifierScope.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "7606950" }, { "name": "Smalltalk", "bytes": "44352" } ], "symlink_target": "" }
<?php include_once(dirname(__FILE__).'/../db_connect.php'); $file = $DB->Select("notepad",array('id' => $id));
{ "content_hash": "502c158ff411021135806877b3210bb9", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 53, "avg_line_length": 36.666666666666664, "alnum_prop": 0.5909090909090909, "repo_name": "licson0729/Ltayer", "id": "f95c0a9862e52c3566d8e74081b6055f6fa16b2c", "size": "110", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "apps/notepad/action/show_action.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "51" }, { "name": "CSS", "bytes": "70745" }, { "name": "HTML", "bytes": "5002" }, { "name": "JavaScript", "bytes": "97159" }, { "name": "PHP", "bytes": "141438" } ], "symlink_target": "" }
CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. // For the complete reference: // http://docs.ckeditor.com/#!/api/CKEDITOR.config // The toolbar groups arrangement, optimized for two toolbar rows. config.toolbarGroups = [ { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] }, { name: 'links' }, { name: 'insert' }, { name: 'forms' }, { name: 'tools' }, { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, { name: 'others' }, '/', { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] }, { name: 'styles' }, { name: 'colors' } ]; // Remove some buttons, provided by the standard plugins, which we don't // need to have in the Standard(s) toolbar. config.removeButtons = 'help'; // Se the most common block elements. config.format_tags = 'p;h1;h2;h3;pre'; // Make dialogs simpler. config.removeDialogTabs = 'image:advanced;link:advanced'; };
{ "content_hash": "058fe8251b6a4650c59549dcc0f601f1", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 83, "avg_line_length": 32.76470588235294, "alnum_prop": 0.6238779174147218, "repo_name": "blale-zhang/codegen", "id": "98f8ab6cfcb339c723d37260e840260cb83285c7", "size": "1275", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "WebContent/component/layoutit-master/ckeditor/config.js", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "29465" }, { "name": "Batchfile", "bytes": "403" }, { "name": "C#", "bytes": "11367" }, { "name": "CSS", "bytes": "3100783" }, { "name": "HTML", "bytes": "15816774" }, { "name": "Java", "bytes": "382175" }, { "name": "JavaScript", "bytes": "10963292" }, { "name": "Makefile", "bytes": "307" }, { "name": "PHP", "bytes": "307341" }, { "name": "Ruby", "bytes": "578" }, { "name": "Shell", "bytes": "26" } ], "symlink_target": "" }
FROM python:3.6 ADD yamltools/ /home/armory/yamltools ADD setup.py /home/armory WORKDIR /home/armory RUN python3 setup.py install ENTRYPOINT deck-configure
{ "content_hash": "730360697902f940bc3b31d4ac677170", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 37, "avg_line_length": 14.636363636363637, "alnum_prop": 0.7888198757763976, "repo_name": "armory-io/yaml-tools", "id": "cc595f16e9d07e51d528d17f55c146ef33d11200", "size": "161", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "299" }, { "name": "Python", "bytes": "11160" }, { "name": "Shell", "bytes": "1031" } ], "symlink_target": "" }
package com.siyeh.ig.migration; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.util.PsiUtil; import com.intellij.psi.util.PsiUtilCore; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; import com.siyeh.ig.InspectionGadgetsFix; import com.siyeh.ig.PsiReplacementUtil; import com.siyeh.ig.psiutils.CommentTracker; import com.siyeh.ig.psiutils.ExpressionUtils; import com.siyeh.ig.psiutils.TypeUtils; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author Bas Leijdekkers */ public class BigDecimalLegacyMethodInspection extends BaseInspection { @Nls @NotNull @Override public String getDisplayName() { return InspectionGadgetsBundle.message("bigdecimal.legacy.method.display.name"); } @NotNull @Override protected String buildErrorString(Object... infos) { return InspectionGadgetsBundle.message("bigdecimal.legacy.method.problem.descriptor"); } @Nullable @Override protected InspectionGadgetsFix buildFix(Object... infos) { final PsiExpression expression = (PsiExpression)infos[0]; final Object value = ExpressionUtils.computeConstantExpression(expression); if (!(value instanceof Integer)) { return null; } final int roundingMode = ((Integer)value).intValue(); if (roundingMode < 0 || roundingMode > 7) { return null; } return new BigDecimalLegacyMethodFix(); } private static class BigDecimalLegacyMethodFix extends InspectionGadgetsFix { @NotNull @Override public String getFamilyName() { return InspectionGadgetsBundle.message("bigdecimal.legacy.method.quickfix"); } @Override protected void doFix(Project project, ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement(); final PsiElement grandParent = element.getParent().getParent(); if (!(grandParent instanceof PsiMethodCallExpression)) { return; } final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)grandParent; final PsiExpressionList argumentList = methodCallExpression.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length != 2 && arguments.length != 3) { return; } final PsiExpression argument = arguments[arguments.length - 1]; final Object value = ExpressionUtils.computeConstantExpression(argument); if (!(value instanceof Integer)) { return; } CommentTracker commentTracker = new CommentTracker(); final int roundingMode = (Integer)value; switch (roundingMode) { case 0: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.UP", commentTracker); break; case 1: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.DOWN", commentTracker); break; case 2: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.CEILING", commentTracker); break; case 3: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.FLOOR", commentTracker); break; case 4: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.HALF_UP", commentTracker); break; case 5: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.HALF_DOWN", commentTracker); break; case 6: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.HALF_EVEN", commentTracker); break; case 7: PsiReplacementUtil.replaceExpressionAndShorten(argument, "java.math.RoundingMode.UNNECESSARY", commentTracker); break; } } } @Override public boolean shouldInspect(PsiFile file) { return PsiUtil.isLanguageLevel5OrHigher(file); } @Override public BaseInspectionVisitor buildVisitor() { return new BigDecimalLegacyMethodVisitor(); } private static class BigDecimalLegacyMethodVisitor extends BaseInspectionVisitor { @Override public void visitMethodCallExpression(PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); final String name = methodExpression.getReferenceName(); if (!"setScale".equals(name) && !"divide".equals(name)) { return; } final PsiExpressionList argumentList = expression.getArgumentList(); if (PsiUtilCore.hasErrorElementChild(argumentList)) { return; } final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length != 2 && arguments.length != 3) { return; } final PsiExpression argument = arguments[arguments.length - 1]; if (!PsiType.INT.equals(argument.getType())) { return; } if (!TypeUtils.expressionHasTypeOrSubtype(expression, "java.math.BigDecimal")) { return; } registerMethodCallError(expression, argument); } } }
{ "content_hash": "58aeea6a3e79dcc120ffc994cc99d5e4", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 121, "avg_line_length": 36.20805369127517, "alnum_prop": 0.7171455050973123, "repo_name": "ThiagoGarciaAlves/intellij-community", "id": "7830774e9a99af0aa05737d2fb9daa0185408396", "size": "5995", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/BigDecimalLegacyMethodInspection.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "20665" }, { "name": "AspectJ", "bytes": "182" }, { "name": "Batchfile", "bytes": "63518" }, { "name": "C", "bytes": "214180" }, { "name": "C#", "bytes": "1538" }, { "name": "C++", "bytes": "190028" }, { "name": "CSS", "bytes": "111474" }, { "name": "CoffeeScript", "bytes": "1759" }, { "name": "Cucumber", "bytes": "14382" }, { "name": "Erlang", "bytes": "10" }, { "name": "FLUX", "bytes": "57" }, { "name": "Groff", "bytes": "35232" }, { "name": "Groovy", "bytes": "2194261" }, { "name": "HTML", "bytes": "1726130" }, { "name": "J", "bytes": "5050" }, { "name": "Java", "bytes": "148273590" }, { "name": "JavaScript", "bytes": "125292" }, { "name": "Kotlin", "bytes": "454154" }, { "name": "Lex", "bytes": "166177" }, { "name": "Makefile", "bytes": "2352" }, { "name": "NSIS", "bytes": "85969" }, { "name": "Objective-C", "bytes": "28634" }, { "name": "Perl6", "bytes": "26" }, { "name": "Protocol Buffer", "bytes": "6570" }, { "name": "Python", "bytes": "21460459" }, { "name": "Ruby", "bytes": "1213" }, { "name": "Scala", "bytes": "11698" }, { "name": "Shell", "bytes": "63190" }, { "name": "Smalltalk", "bytes": "64" }, { "name": "TeX", "bytes": "60798" }, { "name": "TypeScript", "bytes": "6152" }, { "name": "XSLT", "bytes": "113040" } ], "symlink_target": "" }
/** * efeito alert para dar um fadein e fadeout na mensagem */ $(function () { // pegar elemente com corpo da mensagem var corpo_alert = $("#alert-message"); // verificar se o elemente esta presente na pagina if (corpo_alert.length) // gerar efeito para o elemento encontrado na pagina corpo_alert.fadeOut().fadeIn().fadeOut().fadeIn(); }); /** * mask input */ $(function (){ // mascara para telefone: (xx) xxxx-xxxxx $("input#inputTelefonePrincipal, input#inputTelefoneSecundario").mask("(99) 9999-9999?9"); // mascara para captcha com 4 caracteres apenas alfabéticos: xxxx $("input#inputCaptcha").mask("aaaa"); }); /** * plugin typeahead // busca do ajax bootstrap */ $(function (){ $('input.typeahead').typeahead({ ajax: { url: '/contatos/search', // url do serviço AJAX triggerLength: 2, // mínimo de caracteres displayField: 'nome', // campo do JSON utilizado de retorno } }); });
{ "content_hash": "ff03311175a2673872a8f28a2a84913d", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 94, "avg_line_length": 25.825, "alnum_prop": 0.5992255566311714, "repo_name": "Diego-Brocanelli/AgendaDeContatos", "id": "56336f0204ffb3bfbbe06980e2d630ad6d4e62f5", "size": "1036", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "public/js/scripts.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "711" }, { "name": "CSS", "bytes": "1748" }, { "name": "HTML", "bytes": "32544" }, { "name": "JavaScript", "bytes": "1036" }, { "name": "PHP", "bytes": "42231" } ], "symlink_target": "" }
#ifndef _CONN_BLE_GAP_SEC_KEYS_H #define _CONN_BLE_GAP_SEC_KEYS_H /** * @addtogroup ser_codecs Serialization codecs * @ingroup ble_sdk_lib_serialization */ /** * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs * @ingroup ser_codecs */ /**@file * * @defgroup conn_ble_gap_sec_keys GAP Functions for managing memory for security keys on connectivity device. * @{ * @ingroup ser_conn_s110_codecs * * @brief GAP Connectivity auxiliary functions for providing static memory required by Soft Device. This memory is used to store GAP security keys. */ #include "ble_gap.h" #include <stdint.h> /**@brief GAP connection - keyset mapping structure. * * @note This structure is used to map keysets to connection instances, and will be stored in a static table. */ typedef struct { uint16_t conn_handle; /**< Connection handle.*/ uint8_t conn_active; /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/ ble_gap_sec_keyset_t keyset; /**< Keyset structure see @ref ble_gap_sec_keyset_t.*/ ble_gap_enc_key_t enc_key_periph; /**< Peripheral Encryption Key, see @ref ble_gap_enc_key_t.*/ ble_gap_id_key_t id_key_periph; /**< Peripheral Identity Key, see @ref ble_gap_id_key_t.*/ ble_gap_sign_info_t sign_key_periph; /**< Peripheral Signing Information, see @ref ble_gap_sign_info_t.*/ ble_gap_enc_key_t enc_key_central; /**< Central Encryption Key, see @ref ble_gap_enc_key_t.*/ ble_gap_id_key_t id_key_central; /**< Central Identity Key, see @ref ble_gap_id_key_t.*/ ble_gap_sign_info_t sign_key_central; /**< Central Signing Information, see @ref ble_gap_sign_info_t.*/ } ser_ble_gap_conn_keyset_t; /**@brief allocates instance in m_conn_keys_table[] for storage of encryption keys. * * @param[out] p_index pointer to the index of allocated instance * * @retval NRF_SUCCESS great success. * @retval NRF_ERROR_NO_MEM no free instance available. */ uint32_t conn_ble_gap_sec_context_create(uint32_t *p_index); /**@brief release instance identified by a connection handle. * * @param[in] conn_handle conn_handle * * @retval NRF_SUCCESS Context released. * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found */ uint32_t conn_ble_gap_sec_context_destroy(uint16_t conn_handle); /**@brief finds index of instance identified by a connection handle in m_conn_keys_table[]. * * @param[in] conn_handle conn_handle * * @param[out] p_index Pointer to the index of entry in the context table corresponding to the given conn_handle * * @retval NRF_SUCCESS Context table entry found * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found */ uint32_t conn_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); /** @} */ #endif //_CONN_BLE_GAP_SEC_KEYS_H
{ "content_hash": "6d4fbb2c2dfb4ad868155e3ac67cc1d0", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 151, "avg_line_length": 41.5945945945946, "alnum_prop": 0.6468486029889539, "repo_name": "Jewelbots/gcc-nordic-toolchain", "id": "1495b4c1da7ea806b107f7d0a2bb8f18c0e608ca", "size": "3526", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "nrf51_sdk/serialization/connectivity/codecs/s110/serializers/conn_ble_gap_sec_keys.h", "mode": "33261", "license": "mit", "language": [ { "name": "Assembly", "bytes": "43693" }, { "name": "C", "bytes": "7739964" }, { "name": "C++", "bytes": "444347" }, { "name": "Shell", "bytes": "1047" } ], "symlink_target": "" }
// TODO(DEVELOPER): Change the values below using values from the initialization snippet: Firebase Console > Overview > Add Firebase to your web app. // Initialize Firebase var config = { apiKey: "<YOUR_API_KEY>", databaseURL: "<YOUR_DATABASE_URL>", storageBucket: "<YOUR_STORAGE_BUCKET_NAME>" }; firebase.initializeApp(config); /** * initApp handles setting up the Firebase context and registering * callbacks for the auth status. * * The core initialization is in firebase.App - this is the glue class * which stores configuration. We provide an app name here to allow * distinguishing multiple app instances. * * This method also registers a listener with firebase.auth().onAuthStateChanged. * This listener is called when the user is signed in or out, and that * is where we update the UI. * * When signed in, we also authenticate to the Firebase Realtime Database. */ function initApp() { // Listen for auth state changes. // [START authstatelistener] firebase.auth().onAuthStateChanged(function(user) { if (user) { // User is signed in. var displayName = user.displayName; var email = user.email; var emailVerified = user.emailVerified; var photoURL = user.photoURL; var isAnonymous = user.isAnonymous; var uid = user.uid; var providerData = user.providerData; // [START_EXCLUDE] document.getElementById('quickstart-button').textContent = 'Sign out'; document.getElementById('quickstart-sign-in-status').textContent = 'Signed in'; document.getElementById('quickstart-account-details').textContent = JSON.stringify(user, null, ' '); // [END_EXCLUDE] } else { // Let's try to get a Google auth token programmatically. // [START_EXCLUDE] document.getElementById('quickstart-button').textContent = 'Sign-in with Google'; document.getElementById('quickstart-sign-in-status').textContent = 'Signed out'; document.getElementById('quickstart-account-details').textContent = 'null'; // [END_EXCLUDE] } document.getElementById('quickstart-button').disabled = false; }); // [END authstatelistener] document.getElementById('quickstart-button').addEventListener('click', startSignIn, false); } /** * Start the auth flow and authorizes to Firebase. * @param{boolean} interactive True if the OAuth flow should request with an interactive mode. */ function startAuth(interactive) { // Request an OAuth token from the Chrome Identity API. chrome.identity.getAuthToken({interactive: !!interactive}, function(token) { if (chrome.runtime.lastError && !interactive) { console.log('It was not possible to get a token programmatically.'); } else if(chrome.runtime.lastError) { console.error(chrome.runtime.lastError); } else if (token) { // Authrorize Firebase with the OAuth Access Token. var credential = firebase.auth.GoogleAuthProvider.credential(null, token); firebase.auth().signInWithCredential(credential).catch(function(error) { // The OAuth token might have been invalidated. Lets' remove it from cache. if (error.code === 'auth/invalid-credential') { chrome.identity.removeCachedAuthToken({token: token}, function() { startAuth(interactive); }); } }); } else { console.error('The OAuth Token was null'); } }); } /** * Starts the sign-in process. */ function startSignIn() { document.getElementById('quickstart-button').disabled = true; if (firebase.auth().currentUser) { firebase.auth().signOut(); } else { startAuth(true); } } window.onload = function() { initApp(); };
{ "content_hash": "344baf5c893277069294c1522103be71", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 149, "avg_line_length": 37.16161616161616, "alnum_prop": 0.6901331883664039, "repo_name": "jmarantz/soccersub", "id": "dbdab81689292fd7a45edaae2d042e219066ca45", "size": "3679", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "auth/chromextension/credentials.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "13686" }, { "name": "HTML", "bytes": "151152" }, { "name": "JavaScript", "bytes": "189092" }, { "name": "Makefile", "bytes": "3463" }, { "name": "Shell", "bytes": "4245" } ], "symlink_target": "" }
FIR Filter Box Instrument ============================ The FIR Filter Box implements finite impulse response (FIR) filters at up to 15 MS/s and with over 14,000 coefficients at 244 kS/s. The instrument has two independent filter chains, a control matrix to combine signals from both ADCs, input/output scaling and offsets and oscilloscope monitor probes to view signals at different points in the instrument. Example Usage ------------- The following example code and a wide range of other pymoku demo scripts can be found at the `pymoku Github repository <https://github.com/liquidinstruments/pymoku>`_. .. literalinclude:: ../examples/firfilter_basic.py :language: python :caption: firfilter_basic.py The FIRFilter Class ----------------------- .. autoclass:: pymoku.instruments.FIRFilter :members: :inherited-members:
{ "content_hash": "bd454daf472d140fa3f571d19d2a1f7c", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 354, "avg_line_length": 39.666666666666664, "alnum_prop": 0.7274909963985594, "repo_name": "liquidinstruments/pymoku", "id": "4bfcca3a63f44150ae5855a77d7fc14f979d116b", "size": "834", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/firfilterbox.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Cap'n Proto", "bytes": "492" }, { "name": "Python", "bytes": "735943" } ], "symlink_target": "" }
namespace blink { // Represents the key ID and associated status. class MediaKeyStatusMap::MapEntry final : public GarbageCollected<MediaKeyStatusMap::MapEntry> { public: MapEntry(WebData key_id, const String& status) : key_id_(DOMArrayBuffer::Create(scoped_refptr<SharedBuffer>(key_id))), status_(status) {} virtual ~MapEntry() = default; DOMArrayBuffer* KeyId() const { return key_id_.Get(); } const String& Status() const { return status_; } static bool CompareLessThan(MapEntry* a, MapEntry* b) { // Compare the keyIds of 2 different MapEntries. Assume that |a| and |b| // are not null, but the keyId() may be. KeyIds are compared byte // by byte. DCHECK(a); DCHECK(b); // Handle null cases first (which shouldn't happen). // |aKeyId| |bKeyId| result // null null == (false) // null not-null < (true) // not-null null > (false) if (!a->KeyId() || !b->KeyId()) return b->KeyId(); // Compare the bytes. int result = memcmp(a->KeyId()->Data(), b->KeyId()->Data(), std::min(a->KeyId()->ByteLength(), b->KeyId()->ByteLength())); if (result != 0) return result < 0; // KeyIds are equal to the shared length, so the shorter string is <. DCHECK_NE(a->KeyId()->ByteLength(), b->KeyId()->ByteLength()); return a->KeyId()->ByteLength() < b->KeyId()->ByteLength(); } virtual void Trace(Visitor* visitor) const { visitor->Trace(key_id_); } private: const Member<DOMArrayBuffer> key_id_; const String status_; }; // Represents an Iterator that loops through the set of MapEntrys. class MapIterationSource final : public PairIterable<Member<V8BufferSource>, V8BufferSource, String, IDLString>::IterationSource { public: MapIterationSource(MediaKeyStatusMap* map) : map_(map), current_(0) {} bool Next(ScriptState* script_state, Member<V8BufferSource>& key, String& value, ExceptionState&) override { // This simply advances an index and returns the next value if any, // so if the iterated object is mutated values may be skipped. if (current_ >= map_->size()) return false; const auto& entry = map_->at(current_++); key = MakeGarbageCollected<V8BufferSource>(entry.KeyId()); value = entry.Status(); return true; } void Trace(Visitor* visitor) const override { visitor->Trace(map_); PairIterable<Member<V8BufferSource>, V8BufferSource, String, IDLString>::IterationSource::Trace(visitor); } private: // m_map is stored just for keeping it alive. It needs to be kept // alive while JavaScript holds the iterator to it. const Member<const MediaKeyStatusMap> map_; uint32_t current_; }; void MediaKeyStatusMap::Clear() { entries_.clear(); } void MediaKeyStatusMap::AddEntry(WebData key_id, const String& status) { // Insert new entry into sorted list. auto* entry = MakeGarbageCollected<MapEntry>(key_id, status); uint32_t index = 0; while (index < entries_.size() && MapEntry::CompareLessThan(entries_[index], entry)) ++index; entries_.insert(index, entry); } const MediaKeyStatusMap::MapEntry& MediaKeyStatusMap::at(uint32_t index) const { DCHECK_LT(index, entries_.size()); return *entries_.at(index); } uint32_t MediaKeyStatusMap::IndexOf(const DOMArrayPiece& key) const { for (uint32_t index = 0; index < entries_.size(); ++index) { auto* const current = entries_.at(index)->KeyId(); if (key == *current) return index; } // Not found, so return an index outside the valid range. The caller // must ensure this value is not exposed outside this class. return std::numeric_limits<uint32_t>::max(); } bool MediaKeyStatusMap::has( const V8BufferSource* key_id ) { uint32_t index = IndexOf(key_id); return index < entries_.size(); } ScriptValue MediaKeyStatusMap::get(ScriptState* script_state, const V8BufferSource* key_id ) { uint32_t index = IndexOf(key_id); if (index >= entries_.size()) { return ScriptValue(script_state->GetIsolate(), v8::Undefined(script_state->GetIsolate())); } return ScriptValue::From(script_state, at(index).Status()); } MediaKeyStatusMap::IterationSource* MediaKeyStatusMap::StartIteration( ScriptState*, ExceptionState&) { return MakeGarbageCollected<MapIterationSource>(this); } void MediaKeyStatusMap::Trace(Visitor* visitor) const { visitor->Trace(entries_); ScriptWrappable::Trace(visitor); } } // namespace blink
{ "content_hash": "5d2c7258adee67678458c34f30d9cf88", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 80, "avg_line_length": 32.01360544217687, "alnum_prop": 0.642583935401615, "repo_name": "chromium/chromium", "id": "f615475309125ee6a5481f220417f9948fb8edd0", "size": "5411", "binary": false, "copies": "6", "ref": "refs/heads/main", "path": "third_party/blink/renderer/modules/encryptedmedia/media_key_status_map.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0-beta2) on Mon Mar 19 19:31:57 CST 2007 --> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <TITLE> 类 javax.xml.soap.AttachmentPart 的使用 (Java Platform SE 6) </TITLE><script>var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "//hm.baidu.com/hm.js?dd1361ca20a10cc161e72d4bc4fef6df";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script> <META NAME="date" CONTENT="2007-03-19"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="类 javax.xml.soap.AttachmentPart 的使用 (Java Platform SE 6)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="跳过导航链接"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;Platform<br>Standard&nbsp;Ed. 6</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?javax/xml/soap//class-useAttachmentPart.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="AttachmentPart.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>类 javax.xml.soap.AttachmentPart<br>的使用</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 使用 <A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A> 的软件包</FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#javax.xml.soap"><B>javax.xml.soap</B></A></TD> <TD>提供用于创建和构建 SOAP 消息的 API。&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="javax.xml.soap"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <A HREF="../../../../javax/xml/soap/package-summary.html">javax.xml.soap</A> 中 <A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A> 的使用</FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">返回 <A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A> 的 <A HREF="../../../../javax/xml/soap/package-summary.html">javax.xml.soap</A> 中的方法</FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;<A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A></CODE></FONT></TD> <TD><CODE><B>SOAPMessage.</B><B><A HREF="../../../../javax/xml/soap/SOAPMessage.html#createAttachmentPart()">createAttachmentPart</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;创建一个新的空 <code>AttachmentPart</code> 对象。</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A></CODE></FONT></TD> <TD><CODE><B>SOAPMessage.</B><B><A HREF="../../../../javax/xml/soap/SOAPMessage.html#createAttachmentPart(javax.activation.DataHandler)">createAttachmentPart</A></B>(<A HREF="../../../../javax/activation/DataHandler.html" title="javax.activation 中的类">DataHandler</A>&nbsp;dataHandler)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;创建 <code>AttachmentPart</code> 对象并使用给定的 <code>DataHandler</code> 对象填充。</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A></CODE></FONT></TD> <TD><CODE><B>SOAPMessage.</B><B><A HREF="../../../../javax/xml/soap/SOAPMessage.html#createAttachmentPart(java.lang.Object, java.lang.String)">createAttachmentPart</A></B>(<A HREF="../../../../java/lang/Object.html" title="java.lang 中的类">Object</A>&nbsp;content, <A HREF="../../../../java/lang/String.html" title="java.lang 中的类">String</A>&nbsp;contentType)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;创建 <code>AttachmentPart</code> 对象并使用指定内容类型的指定数据填充。</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;<A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A></CODE></FONT></TD> <TD><CODE><B>SOAPMessage.</B><B><A HREF="../../../../javax/xml/soap/SOAPMessage.html#getAttachment(javax.xml.soap.SOAPElement)">getAttachment</A></B>(<A HREF="../../../../javax/xml/soap/SOAPElement.html" title="javax.xml.soap 中的接口">SOAPElement</A>&nbsp;element)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回与此 <code>SOAPElement</code> 引用的附件关联的 <code>AttachmentPart</code> 对象,如果不存在此类附件,则返回 <code>null</code>。</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">参数类型为 <A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A> 的 <A HREF="../../../../javax/xml/soap/package-summary.html">javax.xml.soap</A> 中的方法</FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;void</CODE></FONT></TD> <TD><CODE><B>SOAPMessage.</B><B><A HREF="../../../../javax/xml/soap/SOAPMessage.html#addAttachmentPart(javax.xml.soap.AttachmentPart)">addAttachmentPart</A></B>(<A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类">AttachmentPart</A>&nbsp;AttachmentPart)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;将给定的 <code>AttachmentPart</code> 对象添加到此 <code>SOAPMessage</code> 对象。</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="跳过导航链接"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../javax/xml/soap/AttachmentPart.html" title="javax.xml.soap 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;Platform<br>Standard&nbsp;Ed. 6</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?javax/xml/soap//class-useAttachmentPart.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="AttachmentPart.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">提交错误或意见</a><br>有关更多的 API 参考资料和开发人员文档,请参阅 <a href="http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html">Java SE 开发人员文档</a>。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。 <p>版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守<a href="http://java.sun.com/javase/6/docs/legal/license.html">许可证条款</a>。另请参阅<a href="http://java.sun.com/docs/redist.html">文档重新分发政策</a>。</font> </BODY> </HTML>
{ "content_hash": "aa4828d2f86500b4faa88491f2be87d0", "timestamp": "", "source": "github", "line_count": 223, "max_line_length": 441, "avg_line_length": 51.17937219730942, "alnum_prop": 0.6412862525190572, "repo_name": "piterlin/piterlin.github.io", "id": "b53d26959d5477f09c98e391a4f8222a5ce08010", "size": "12163", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/jdk6_cn/javax/xml/soap/class-use/AttachmentPart.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "479" }, { "name": "HTML", "bytes": "9480869" }, { "name": "JavaScript", "bytes": "246" } ], "symlink_target": "" }
export PIPENV_VENV_IN_PROJECT=1
{ "content_hash": "36d204a2d319f2b6eb233fac1c7fa455", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 31, "avg_line_length": 32, "alnum_prop": 0.8125, "repo_name": "thecodesmith/dotfiles", "id": "64c275b45e307556edbf977edac04ee83413eaf3", "size": "32", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "python/env.zsh", "mode": "33188", "license": "mit", "language": [ { "name": "AppleScript", "bytes": "252" }, { "name": "Perl", "bytes": "20090" }, { "name": "Ruby", "bytes": "3065" }, { "name": "Shell", "bytes": "36690" }, { "name": "Tcl", "bytes": "2811" } ], "symlink_target": "" }
package calc import ( "context" calcsvc "goa.design/plugins/v3/zaplogger/examples/calc/gen/calc" log "goa.design/plugins/v3/zaplogger/examples/calc/gen/log" ) // calc service example implementation. // The example methods log the requests and return zero values. type calcSvc struct { logger *log.Logger } // NewCalc returns the calc service implementation. func NewCalc(logger *log.Logger) calcsvc.Service { return &calcSvc{logger} } // Add implements add. func (s *calcSvc) Add(ctx context.Context, p *calcsvc.AddPayload) (res int, err error) { s.logger.Info("calc.add") return }
{ "content_hash": "dc5c329eaa1143a6fee8014ad89cbcbb", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 88, "avg_line_length": 23.76, "alnum_prop": 0.7474747474747475, "repo_name": "goadesign/plugins", "id": "25e221a56ae5b8064268ff7acfb148659a406804", "size": "594", "binary": false, "copies": "1", "ref": "refs/heads/v3", "path": "zaplogger/examples/calc/calc.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "165642" }, { "name": "Makefile", "bytes": "7723" } ], "symlink_target": "" }
package com.mossle.security.client; import com.mossle.api.userauth.UserAuthConnector; import com.mossle.api.userauth.UserAuthDTO; import com.mossle.core.mapper.BeanMapper; import com.mossle.security.impl.SpringSecurityUserAuth; import com.mossle.security.util.SpringSecurityUtils; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.web.context.HttpRequestResponseHolder; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; public class CachedSecurityContextRepository extends HttpSessionSecurityContextRepository { private UserAuthConnector userAuthConnector; private BeanMapper beanMapper = new BeanMapper(); private boolean debug; public SecurityContext loadContext( HttpRequestResponseHolder requestResponseHolder) { SecurityContext securityContext = super .loadContext(requestResponseHolder); if (securityContext == null) { logger.debug("securityContext is null"); return null; } if (debug) { return securityContext; } SpringSecurityUserAuth userAuthInSession = SpringSecurityUtils .getCurrentUser(securityContext); if (userAuthInSession == null) { logger.debug("userAuthInSession is null"); return securityContext; } UserAuthDTO userAuthInCache = userAuthConnector.findById( userAuthInSession.getId(), userAuthInSession.getTenantId()); SpringSecurityUserAuth userAuthResult = new SpringSecurityUserAuth(); beanMapper.copy(userAuthInCache, userAuthResult); SpringSecurityUtils.saveUserDetailsToContext(userAuthResult, null, securityContext); return securityContext; } public void setUserAuthConnector(UserAuthConnector userAuthConnector) { this.userAuthConnector = userAuthConnector; } public void setDebug(boolean debug) { this.debug = debug; } }
{ "content_hash": "a87a1f2c6e7e76e18d58c7d1c22fc82f", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 85, "avg_line_length": 32.109375, "alnum_prop": 0.7187347931873479, "repo_name": "vigosser/lemon", "id": "ecd006c95512f67b8809c2db6954d54b8e984bc0", "size": "2055", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "src/main/java/com/mossle/security/client/CachedSecurityContextRepository.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "223863" }, { "name": "HTML", "bytes": "201837" }, { "name": "Java", "bytes": "6047963" }, { "name": "JavaScript", "bytes": "5423122" }, { "name": "SQLPL", "bytes": "5352" } ], "symlink_target": "" }
// Copyright (c) 2021 Alachisoft // // 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 using Alachisoft.NCache.Caching.AutoExpiration; using Alachisoft.NCache.Common.Pooling.Options; namespace Alachisoft.NCache.Caching.Pooling { internal class TTLExpirationInstantiator : IPooledObjectInstantiator<TTLExpiration> { public TTLExpiration Instantiate() => new TTLExpiration(); } }
{ "content_hash": "ba08abf8b726e402ccd6c481ee4c6d75", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 87, "avg_line_length": 38.291666666666664, "alnum_prop": 0.7442872687704026, "repo_name": "Alachisoft/NCache", "id": "94613e5e254e1d5819859f0fa28af9ede83af40b", "size": "921", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Src/NCCache/Caching/Pooling/TTLExpirationInstantiator.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "12283536" }, { "name": "CSS", "bytes": "707" }, { "name": "HTML", "bytes": "16825" }, { "name": "JavaScript", "bytes": "377" } ], "symlink_target": "" }