package network

// Copyright (c) Microsoft and contributors.  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.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"context"
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/azure"
	"github.com/Azure/go-autorest/tracing"
	"net/http"
)

// ServiceEndpointPoliciesClient is the network Client
type ServiceEndpointPoliciesClient struct {
	BaseClient
}

// NewServiceEndpointPoliciesClient creates an instance of the ServiceEndpointPoliciesClient client.
func NewServiceEndpointPoliciesClient(subscriptionID string) ServiceEndpointPoliciesClient {
	return NewServiceEndpointPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}

// NewServiceEndpointPoliciesClientWithBaseURI creates an instance of the ServiceEndpointPoliciesClient client using a
// custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds,
// Azure stack).
func NewServiceEndpointPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServiceEndpointPoliciesClient {
	return ServiceEndpointPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)}
}

// CreateOrUpdate creates or updates a service Endpoint Policies.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceEndpointPolicyName - the name of the service endpoint policy.
// parameters - parameters supplied to the create or update service endpoint policy operation.
func (client ServiceEndpointPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy) (result ServiceEndpointPoliciesCreateOrUpdateFuture, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.CreateOrUpdate")
		defer func() {
			sc := -1
			if result.Response() != nil {
				sc = result.Response().StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceEndpointPolicyName, parameters)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request")
		return
	}

	result, err = client.CreateOrUpdateSender(req)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
		return
	}

	return
}

// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ServiceEndpointPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
		"serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName),
		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-08-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsContentType("application/json; charset=utf-8"),
		autorest.AsPut(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters),
		autorest.WithJSON(parameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client ServiceEndpointPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServiceEndpointPoliciesCreateOrUpdateFuture, err error) {
	var resp *http.Response
	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
	if err != nil {
		return
	}
	future.Future, err = azure.NewFutureFromResponse(resp)
	return
}

// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ServiceEndpointPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceEndpointPolicy, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// Delete deletes the specified service endpoint policy.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceEndpointPolicyName - the name of the service endpoint policy.
func (client ServiceEndpointPoliciesClient) Delete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (result ServiceEndpointPoliciesDeleteFuture, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.Delete")
		defer func() {
			sc := -1
			if result.Response() != nil {
				sc = result.Response().StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.DeletePreparer(ctx, resourceGroupName, serviceEndpointPolicyName)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Delete", nil, "Failure preparing request")
		return
	}

	result, err = client.DeleteSender(req)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Delete", result.Response(), "Failure sending request")
		return
	}

	return
}

// DeletePreparer prepares the Delete request.
func (client ServiceEndpointPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
		"serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName),
		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-08-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsDelete(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ServiceEndpointPoliciesClient) DeleteSender(req *http.Request) (future ServiceEndpointPoliciesDeleteFuture, err error) {
	var resp *http.Response
	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
	if err != nil {
		return
	}
	future.Future, err = azure.NewFutureFromResponse(resp)
	return
}

// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ServiceEndpointPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
		autorest.ByClosing())
	result.Response = resp
	return
}

// Get gets the specified service Endpoint Policies in a specified resource group.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceEndpointPolicyName - the name of the service endpoint policy.
// expand - expands referenced resources.
func (client ServiceEndpointPoliciesClient) Get(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, expand string) (result ServiceEndpointPolicy, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.Get")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.GetPreparer(ctx, resourceGroupName, serviceEndpointPolicyName, expand)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Get", nil, "Failure preparing request")
		return
	}

	resp, err := client.GetSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Get", resp, "Failure sending request")
		return
	}

	result, err = client.GetResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Get", resp, "Failure responding to request")
	}

	return
}

// GetPreparer prepares the Get request.
func (client ServiceEndpointPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, expand string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
		"serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName),
		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-08-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}
	if len(expand) > 0 {
		queryParameters["$expand"] = autorest.Encode("query", expand)
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ServiceEndpointPoliciesClient) GetSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}

// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ServiceEndpointPoliciesClient) GetResponder(resp *http.Response) (result ServiceEndpointPolicy, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// List gets all the service endpoint policies in a subscription.
func (client ServiceEndpointPoliciesClient) List(ctx context.Context) (result ServiceEndpointPolicyListResultPage, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.List")
		defer func() {
			sc := -1
			if result.seplr.Response.Response != nil {
				sc = result.seplr.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	result.fn = client.listNextResults
	req, err := client.ListPreparer(ctx)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "List", nil, "Failure preparing request")
		return
	}

	resp, err := client.ListSender(req)
	if err != nil {
		result.seplr.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "List", resp, "Failure sending request")
		return
	}

	result.seplr, err = client.ListResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "List", resp, "Failure responding to request")
	}
	if result.seplr.hasNextLink() && result.seplr.IsEmpty() {
		err = result.NextWithContext(ctx)
	}

	return
}

// ListPreparer prepares the List request.
func (client ServiceEndpointPoliciesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-08-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ServiceEndpointPoliciesClient) ListSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}

// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ServiceEndpointPoliciesClient) ListResponder(resp *http.Response) (result ServiceEndpointPolicyListResult, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// listNextResults retrieves the next set of results, if any.
func (client ServiceEndpointPoliciesClient) listNextResults(ctx context.Context, lastResults ServiceEndpointPolicyListResult) (result ServiceEndpointPolicyListResult, err error) {
	req, err := lastResults.serviceEndpointPolicyListResultPreparer(ctx)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listNextResults", nil, "Failure preparing next results request")
	}
	if req == nil {
		return
	}
	resp, err := client.ListSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listNextResults", resp, "Failure sending next results request")
	}
	result, err = client.ListResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listNextResults", resp, "Failure responding to next results request")
	}
	return
}

// ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client ServiceEndpointPoliciesClient) ListComplete(ctx context.Context) (result ServiceEndpointPolicyListResultIterator, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.List")
		defer func() {
			sc := -1
			if result.Response().Response.Response != nil {
				sc = result.page.Response().Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	result.page, err = client.List(ctx)
	return
}

// ListByResourceGroup gets all service endpoint Policies in a resource group.
// Parameters:
// resourceGroupName - the name of the resource group.
func (client ServiceEndpointPoliciesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServiceEndpointPolicyListResultPage, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.ListByResourceGroup")
		defer func() {
			sc := -1
			if result.seplr.Response.Response != nil {
				sc = result.seplr.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	result.fn = client.listByResourceGroupNextResults
	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "ListByResourceGroup", nil, "Failure preparing request")
		return
	}

	resp, err := client.ListByResourceGroupSender(req)
	if err != nil {
		result.seplr.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "ListByResourceGroup", resp, "Failure sending request")
		return
	}

	result.seplr, err = client.ListByResourceGroupResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "ListByResourceGroup", resp, "Failure responding to request")
	}
	if result.seplr.hasNextLink() && result.seplr.IsEmpty() {
		err = result.NextWithContext(ctx)
	}

	return
}

// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client ServiceEndpointPoliciesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-08-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client ServiceEndpointPoliciesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}

// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client ServiceEndpointPoliciesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceEndpointPolicyListResult, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// listByResourceGroupNextResults retrieves the next set of results, if any.
func (client ServiceEndpointPoliciesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceEndpointPolicyListResult) (result ServiceEndpointPolicyListResult, err error) {
	req, err := lastResults.serviceEndpointPolicyListResultPreparer(ctx)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
	}
	if req == nil {
		return
	}
	resp, err := client.ListByResourceGroupSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
	}
	result, err = client.ListByResourceGroupResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
	}
	return
}

// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
func (client ServiceEndpointPoliciesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServiceEndpointPolicyListResultIterator, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.ListByResourceGroup")
		defer func() {
			sc := -1
			if result.Response().Response.Response != nil {
				sc = result.page.Response().Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
	return
}

// Update updates service Endpoint Policies.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceEndpointPolicyName - the name of the service endpoint policy.
// parameters - parameters supplied to update service endpoint policy tags.
func (client ServiceEndpointPoliciesClient) Update(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters TagsObject) (result ServiceEndpointPoliciesUpdateFuture, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.Update")
		defer func() {
			sc := -1
			if result.Response() != nil {
				sc = result.Response().StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceEndpointPolicyName, parameters)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Update", nil, "Failure preparing request")
		return
	}

	result, err = client.UpdateSender(req)
	if err != nil {
		err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Update", result.Response(), "Failure sending request")
		return
	}

	return
}

// UpdatePreparer prepares the Update request.
func (client ServiceEndpointPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters TagsObject) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
		"serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName),
		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-08-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsContentType("application/json; charset=utf-8"),
		autorest.AsPatch(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters),
		autorest.WithJSON(parameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client ServiceEndpointPoliciesClient) UpdateSender(req *http.Request) (future ServiceEndpointPoliciesUpdateFuture, err error) {
	var resp *http.Response
	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
	if err != nil {
		return
	}
	future.Future, err = azure.NewFutureFromResponse(resp)
	return
}

// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client ServiceEndpointPoliciesClient) UpdateResponder(resp *http.Response) (result ServiceEndpointPolicy, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

{'repo_name': 'Azure/azure-sdk-for-go', 'stars': '750', 'repo_language': 'Go', 'file_name': 'interfaces.go', 'mime_type': 'text/plain', 'hash': 2773451993244160174, 'source_dataset': 'data'}


import {D_TS_EXTENSION, JS_EXTENSION, JSON_EXTENSION, JSX_EXTENSION, TS_EXTENSION, TSX_EXTENSION} from "../../constant/constant";

export type SupportedExtensions = Set<string>;

/**
 * Gets the extensions that are supported by Typescript, depending on whether or not to allow JS and JSON
 */
export function getSupportedExtensions(allowJs: boolean, allowJson: boolean): SupportedExtensions {
	return new Set([TS_EXTENSION, TSX_EXTENSION, D_TS_EXTENSION, ...(allowJs ? [JS_EXTENSION, JSX_EXTENSION] : []), ...(allowJson ? [JSON_EXTENSION] : [])]);
}

{'repo_name': 'wessberg/rollup-plugin-ts', 'stars': '188', 'repo_language': 'TypeScript', 'file_name': 'format-code.ts', 'mime_type': 'text/x-java', 'hash': 485215405634960476, 'source_dataset': 'data'}


// -*- C++ -*-
//===------------------------- hash_set ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_EXT_HASH
#define _LIBCPP_EXT_HASH

#pragma GCC system_header

#include <string>
#include <cstring>

namespace __gnu_cxx {

template <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };

template <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>
 : public std::unary_function<const char*, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(const char *__c) const _NOEXCEPT
    {
        return std::__do_string_hash(__c, __c + strlen(__c));
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<char *>
 : public std::unary_function<char*, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(char *__c) const _NOEXCEPT
    {
        return std::__do_string_hash<const char *>(__c, __c + strlen(__c));
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
 : public std::unary_function<char, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(char __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
 : public std::unary_function<signed char, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(signed char __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
 : public std::unary_function<unsigned char, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(unsigned char __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
 : public std::unary_function<short, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(short __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
 : public std::unary_function<unsigned short, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(unsigned short __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
    : public std::unary_function<int, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(int __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
    : public std::unary_function<unsigned int, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(unsigned int __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
    : public std::unary_function<long, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(long __c) const _NOEXCEPT
    {
        return __c;
    }
};

template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
    : public std::unary_function<unsigned long, size_t>
{
    _LIBCPP_INLINE_VISIBILITY
    size_t operator()(unsigned long __c) const _NOEXCEPT
    {
        return __c;
    }
};
}

#endif  // _LIBCPP_EXT_HASH

{'repo_name': 'ziglang/zig', 'stars': '6084', 'repo_language': 'Zig', 'file_name': 'c_flag_overrides.cmake', 'mime_type': 'text/plain', 'hash': -6032581015469023251, 'source_dataset': 'data'}


/*
 * locktdeq.c: simple lock-based parallel tandem deq implementation.
 * 	This is similar to lockdeq.c, but expresses the parallel
 * 	implementation in terms of a pair of simple single-lock-based deqs.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can access it online at
 * http://www.gnu.org/licenses/gpl-2.0.html.
 *
 * Copyright (c) 2009-2019 Paul E. McKenney, IBM Corporation.
 * Copyright (c) 2019 Paul E. McKenney, Facebook.
 */

#include "../api.h"

/* First do the underlying single-locked deq implementation. */

struct deq {
	struct cds_list_head chain;
} ____cacheline_internodealigned_in_smp;

void init_deq(struct deq *p)
{
	CDS_INIT_LIST_HEAD(&p->chain);
}

struct cds_list_head *deq_pop_l(struct deq *p)
{
	struct cds_list_head *e;

	if (cds_list_empty(&p->chain))
		e = NULL;
	else {
		e = p->chain.prev;
		cds_list_del(e);
		CDS_INIT_LIST_HEAD(e);
	}
	return e;
}

void deq_push_l(struct cds_list_head *e, struct deq *p)
{
	cds_list_add_tail(e, &p->chain);
}

struct cds_list_head *deq_pop_r(struct deq *p)
{
	struct cds_list_head *e;

	if (cds_list_empty(&p->chain))
		e = NULL;
	else {
		e = p->chain.next;
		cds_list_del(e);
		CDS_INIT_LIST_HEAD(e);
	}
	return e;
}

void deq_push_r(struct cds_list_head *e, struct deq *p)
{
	cds_list_add(e, &p->chain);
}

/*
 * And now the concurrent implementation, which simply has a pair
 * of deq structures in tandem, feeding each other as needed.
 * This of course requires some way of moving elements from one
 * to the other.  This implementation uses a trivial approach:
 * if a pop finds one empty, pull all elements from the
 * other one.
 *
 * Each individual deq has its own lock, with the left lock acquired
 * first if both locks are required.
 */

struct pdeq {
	spinlock_t llock;
	struct deq ldeq;
	/* char pad1[CACHE_LINE_SIZE - sizeof(spinlock_t) - sizeof(int)]; */
	spinlock_t rlock ____cacheline_internodealigned_in_smp;
	struct deq rdeq;
};

void init_pdeq(struct pdeq *d)
{
	spin_lock_init(&d->llock);
	init_deq(&d->ldeq);
	spin_lock_init(&d->rlock);
	init_deq(&d->rdeq);
}

//\begin{snippet}[labelbase=ln:SMPdesign:locktdeq:pop_push,commandchars=\\\@\$]
struct cds_list_head *pdeq_pop_l(struct pdeq *d)		//\lnlbl{popl:b}
{
	struct cds_list_head *e;

	spin_lock(&d->llock);					//\lnlbl{popl:acq:l}
	e = deq_pop_l(&d->ldeq);				//\lnlbl{popl:deq:ll}
	if (e == NULL) {
		spin_lock(&d->rlock);				//\lnlbl{popl:acq:r}
		e = deq_pop_l(&d->rdeq);			//\lnlbl{popl:deq:lr}
		cds_list_splice(&d->rdeq.chain, &d->ldeq.chain);//\lnlbl{popl:move}
		CDS_INIT_LIST_HEAD(&d->rdeq.chain);		//\lnlbl{popl:init:r}
		spin_unlock(&d->rlock);				//\lnlbl{popl:rel:r}
	}							//\lnlbl{popl:skip}
	spin_unlock(&d->llock);					//\lnlbl{popl:rel:l}
	return e;
}								//\lnlbl{popl:e}

struct cds_list_head *pdeq_pop_r(struct pdeq *d)		//\lnlbl{popr:b}
{
	struct cds_list_head *e;

	spin_lock(&d->rlock);					//\lnlbl{popr:acq:r1}
	e = deq_pop_r(&d->rdeq);				//\lnlbl{popr:deq:rr1}
	if (e == NULL) {					//\lnlbl{popr:check1}
		spin_unlock(&d->rlock);				//\lnlbl{popr:rel:r1}
		spin_lock(&d->llock);				//\lnlbl{popr:acq:l}
		spin_lock(&d->rlock);				//\lnlbl{popr:acq:r2}
		e = deq_pop_r(&d->rdeq);			//\lnlbl{popr:deq:rr2}
		if (e == NULL) {				//\lnlbl{popr:check2}
			e = deq_pop_r(&d->ldeq);			//\lnlbl{popr:deq:rl}
			cds_list_splice(&d->ldeq.chain, &d->rdeq.chain);//\lnlbl{popr:move}
			CDS_INIT_LIST_HEAD(&d->ldeq.chain);		//\lnlbl{popr:init:l}
		}
		spin_unlock(&d->llock);				//\lnlbl{popr:rel:l}
	}							//\lnlbl{popr:skip2}
	spin_unlock(&d->rlock);					//\lnlbl{popr:rel:r2}
	return e;
}								//\lnlbl{popr:e}

void pdeq_push_l(struct cds_list_head *e, struct pdeq *d)	//\lnlbl{pushl:b}
{
	spin_lock(&d->llock);					//\lnlbl{pushl:acq:l}
	deq_push_l(e, &d->ldeq);				//\lnlbl{pushl:que:l}
	spin_unlock(&d->llock);					//\lnlbl{pushl:rel:l}
}								//\lnlbl{pushl:e}

void pdeq_push_r(struct cds_list_head *e, struct pdeq *d)	//\lnlbl{pushr:b}
{
	spin_lock(&d->rlock);
	deq_push_r(e, &d->rdeq);
	spin_unlock(&d->rlock);
}								//\lnlbl{pushr:e}
//\end{snippet}

#ifdef TEST
#include "deqtorture.h"
#endif /* #ifdef TEST */

{'repo_name': 'paulmckrcu/perfbook', 'stars': '104', 'repo_language': 'TeX', 'file_name': 'shellparallel.fig', 'mime_type': 'text/plain', 'hash': -8793147588671986199, 'source_dataset': 'data'}


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
<ldml>
	<identity>
		<version number="$Revision: 1.53 $"/>
		<generation date="$Date: 2009/05/05 23:06:37 $"/>
		<language type="kl"/>
	</identity>
	<localeDisplayNames>
		<languages>
			<language type="kl">kalaallisut</language>
		</languages>
		<territories>
			<territory type="GL">Kalaallit Nunaat</territory>
		</territories>
	</localeDisplayNames>
	<characters>
		<exemplarCharacters>[a á-ã b-e é ê f-i í î ĩ j-o ô p q ĸ r-u ú û ũ v-z æ ø å]</exemplarCharacters>
	</characters>
	<dates>
		<calendars>
			<calendar type="gregorian">
				<months>
					<monthContext type="format">
						<monthWidth type="abbreviated">
							<month type="1">jan</month>
							<month type="2">feb</month>
							<month type="3">mar</month>
							<month type="4">apr</month>
							<month type="5">maj</month>
							<month type="6">jun</month>
							<month type="7">jul</month>
							<month type="8">aug</month>
							<month type="9">sep</month>
							<month type="10">okt</month>
							<month type="11">nov</month>
							<month type="12">dec</month>
						</monthWidth>
						<monthWidth type="wide">
							<month type="1">januari</month>
							<month type="2">februari</month>
							<month type="3">martsi</month>
							<month type="4">aprili</month>
							<month type="5">maji</month>
							<month type="6">juni</month>
							<month type="7">juli</month>
							<month type="8">augustusi</month>
							<month type="9">septemberi</month>
							<month type="10">oktoberi</month>
							<month type="11">novemberi</month>
							<month type="12">decemberi</month>
						</monthWidth>
					</monthContext>
					<monthContext type="stand-alone">
						<monthWidth type="narrow">
							<month type="1">1</month>
							<month type="2">2</month>
							<month type="3">3</month>
							<month type="4">4</month>
							<month type="5">5</month>
							<month type="6">6</month>
							<month type="7">7</month>
							<month type="8">8</month>
							<month type="9">9</month>
							<month type="10">10</month>
							<month type="11">11</month>
							<month type="12">12</month>
						</monthWidth>
					</monthContext>
				</months>
				<days>
					<dayContext type="format">
						<dayWidth type="abbreviated">
							<day type="sun">sab</day>
							<day type="mon">ata</day>
							<day type="tue">mar</day>
							<day type="wed">pin</day>
							<day type="thu">sis</day>
							<day type="fri">tal</day>
							<day type="sat">arf</day>
						</dayWidth>
						<dayWidth type="wide">
							<day type="sun">sabaat</day>
							<day type="mon">ataasinngorneq</day>
							<day type="tue">marlunngorneq</day>
							<day type="wed">pingasunngorneq</day>
							<day type="thu">sisamanngorneq</day>
							<day type="fri">tallimanngorneq</day>
							<day type="sat">arfininngorneq</day>
						</dayWidth>
					</dayContext>
					<dayContext type="stand-alone">
						<dayWidth type="narrow">
							<day type="sun">1</day>
							<day type="mon">2</day>
							<day type="tue">3</day>
							<day type="wed">4</day>
							<day type="thu">5</day>
							<day type="fri">6</day>
							<day type="sat">7</day>
						</dayWidth>
					</dayContext>
				</days>
				<quarters>
					<quarterContext type="format">
						<quarterWidth type="abbreviated">
							<quarter type="1">Q1</quarter>
							<quarter type="2">Q2</quarter>
							<quarter type="3">Q3</quarter>
							<quarter type="4">Q4</quarter>
						</quarterWidth>
						<quarterWidth type="wide">
							<quarter type="1">Q1</quarter>
							<quarter type="2">Q2</quarter>
							<quarter type="3">Q3</quarter>
							<quarter type="4">Q4</quarter>
						</quarterWidth>
					</quarterContext>
				</quarters>
				<am>AM</am>
				<pm>PM</pm>
				<eras>
					<eraAbbr>
						<era type="0">BCE</era>
						<era type="1">CE</era>
					</eraAbbr>
				</eras>
				<dateFormats>
					<dateFormatLength type="full">
						<dateFormat>
							<pattern>EEEE dd MMMM y</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="long">
						<dateFormat>
							<pattern>dd MMMM y</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="medium">
						<dateFormat>
							<pattern>MMM dd, y</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="short">
						<dateFormat>
							<pattern>dd/MM/yy</pattern>
						</dateFormat>
					</dateFormatLength>
				</dateFormats>
				<timeFormats>
					<timeFormatLength type="full">
						<timeFormat>
							<pattern>h:mm:ss a zzzz</pattern>
						</timeFormat>
					</timeFormatLength>
					<timeFormatLength type="long">
						<timeFormat>
							<pattern>h:mm:ss a z</pattern>
						</timeFormat>
					</timeFormatLength>
					<timeFormatLength type="medium">
						<timeFormat>
							<pattern>h:mm:ss a</pattern>
						</timeFormat>
					</timeFormatLength>
					<timeFormatLength type="short">
						<timeFormat>
							<pattern>h:mm a</pattern>
						</timeFormat>
					</timeFormatLength>
				</timeFormats>
				<dateTimeFormats>
					<availableFormats>
						<dateFormatItem id="MMMMdd">dd MMMM</dateFormatItem>
						<dateFormatItem id="MMdd">dd/MM</dateFormatItem>
						<dateFormatItem id="yyMM">MM/yy</dateFormatItem>
						<dateFormatItem id="yyQ">Q yy</dateFormatItem>
						<dateFormatItem id="yyyyMMMM">MMMM y</dateFormatItem>
					</availableFormats>
				</dateTimeFormats>
			</calendar>
		</calendars>
		<timeZoneNames>
			<hourFormat>+HH:mm;-HH:mm</hourFormat>
			<gmtFormat>GMT{0}</gmtFormat>
			<regionFormat>{0}</regionFormat>
		</timeZoneNames>
	</dates>
	<numbers>
		<symbols>
			<decimal>,</decimal>
			<group>.</group>
		</symbols>
		<currencyFormats>
			<currencyFormatLength>
				<currencyFormat>
					<pattern>¤#,##0.00;¤-#,##0.00</pattern>
				</currencyFormat>
			</currencyFormatLength>
		</currencyFormats>
		<currencies>
			<currency type="DKK">
				<symbol>kr</symbol>
			</currency>
		</currencies>
	</numbers>
</ldml>

{'repo_name': 'kaltura/server', 'stars': '262', 'repo_language': 'PHP', 'file_name': 'AsperaNodeApi.php', 'mime_type': 'text/x-php', 'hash': 358396703516594828, 'source_dataset': 'data'}


ajgl/breakpoint-twig-extension

The Xdebug extension is required for the breakpoint to work

The framework bundle to integrate the extension into Symfony

The twig bundle to integrate the extension into Symfony

Twig extension to set breakpoints

aptoma/twig-markdown

Needed for using GitHub's Markdown engine provided through their API.

Original Markdown engine with MarkdownExtra.

Twig extension to work with Markdown content

To make use of PSR-6 cache implementation via PsrCacheAdapter.

Cache fragments of templates directly within Twig.

aura/intl

The Aura Intl package provides internationalization tools, specifically message translation.

cakephp/bake

Bake plugin for CakePHP 3

cakephp/cakephp

To enable more efficient network calls in Http\Client.

To use Security::encrypt() or have secure CSRF token generation.

The intl PHP library, to use Text::transliterate() or Text::slug()

The CakePHP framework

conventions over configuration
dry
form
framework
mvc
orm
psr-7
rapid-development
validation

cakephp/cakephp-codesniffer

CakePHP CodeSniffer Standards

cakephp/chronos

A simple API extension for DateTime.

DebugKit needs to store panel data in a database. SQLite is simple and easy to use.

CakePHP Debug Kit

cakephp/migrations

Required if you want to generate migrations.

Database Migration plugin for CakePHP 3.0 based on Phinx

cakephp/plugin-installer

A composer installer for CakePHP 3.0+ plugins.

composer/ca-bundle

Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.

composer/composer

Enabling the openssl extension allows you to access https URLs for repositories and packages

Enabling the zip extension allows you to unzip archives

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

composer/semver

Semver library that offers utilities, version constraint parsing and validation.

composer/spdx-licenses

SPDX licenses list and validation library.

composer/xdebug-handler

Restarts a process without xdebug.

dnoegel/php-xdg-base-dir

implementation of xdg base directory specification for php

doctrine/instantiator

A small, lightweight utility to instantiate objects in PHP without invoking their constructors

jakub-onderka/php-console-highlighter

Highlight PHP code in terminal

jasny/twig-extensions

Required for the use of the LocalDate Twig extension

Required for the use of the PCRE Twig extension

A set of useful Twig filters

PCRE array date datetime preg regex templating text time

jdorn/sql-formatter

a PHP SQL highlighting library

josegonzalez/dotenv

dotenv file parsing for PHP

justinrainbow/json-schema

A library to validate a json schema.

Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.

.env config dotenv env loader m1 parser support

mobiledetect/mobiledetectlib

Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

detect mobile devices
mobile
mobile detect
mobile detector
php mobile detect

myclabs/deep-copy

Create deep copies (clones) of your objects

clone
copy
duplicate
object
object graph

nikic/php-parser

A PHP parser written in PHP

phar-io/manifest

Component for reading phar.io manifest information from a PHP Archive (PHAR)

phar-io/version

Library for handling version information and constraints

phpdocumentor/reflection-common

Common reflection classes used by phpdocumentor to reflect the code structure

FQSEN
phpDocumentor
phpdoc
reflection
static analysis

phpdocumentor/reflection-docblock

With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.

phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

phpunit/php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

phpunit/php-file-iterator

FilterIterator implementation that filters files based on a list of suffixes.

phpunit/php-text-template

Simple template engine.

phpunit/php-timer

Utility class for timing

phpunit/php-token-stream

Wrapper around PHP's tokenizer extension.

phpunit/phpunit

The PHP Unit Testing framework.

phpunit/phpunit-mock-objects

Mock Object library for PHPUnit

psr/container

Common Container Interface (PHP FIG PSR-11)

PSR-11 container container-interface container-interop psr

psr/http-message

Common interface for HTTP messages

http http-message psr psr-7 request response

psr/log

Common interface for logging libraries

psr/simple-cache

Common interfaces for simple caching

psy/psysh

Enabling the PCNTL extension makes PsySH a lot happier :)

The doc command requires SQLite to work.

If you have PCNTL, you'll want the POSIX extension as well.

Enables support for arrow-key history navigation, and showing and manipulating command history.

A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.

An interactive shell for modern PHP.

robmorgan/phinx

Phinx makes it ridiculously easy to manage the database migrations for your PHP app.

database
database migrations
db
migrations
phinx

sebastian/code-unit-reverse-lookup

Looks up which function or method a line of code belongs to

sebastian/comparator

Provides the functionality to compare PHP values for equality

sebastian/diff

Diff implementation

sebastian/environment

Provides functionality to handle HHVM/PHP environments

sebastian/exporter

Provides the functionality to export PHP variables for visualization

sebastian/global-state

Snapshotting of global state

sebastian/object-enumerator

Traverses array structures and object graphs to enumerate all referenced objects

sebastian/object-reflector

Allows reflection of object attributes, including inherited and non-public ones

sebastian/recursion-context

Provides functionality to recursively process PHP variables

sebastian/resource-operations

Provides a list of PHP built-in functions that operate on resources

sebastian/version

Library that helps with managing the version number of Git-hosted PHP projects

seld/jsonlint

JSON Linter

seld/phar-utils

PHAR file format utilities, for when PHP phars you up

PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.

symfony/config

Symfony Config Component

symfony/console

Symfony Console Component

symfony/filesystem

Symfony Filesystem Component

symfony/finder

Symfony Finder Component

symfony/polyfill-ctype

Symfony polyfill for ctype functions

symfony/polyfill-mbstring

Symfony polyfill for the Mbstring extension

compatibility mbstring polyfill portable shim

Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions

Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions

symfony/process

Symfony Process Component

symfony/service-contracts

Generic abstractions related to writing services

abstractions contracts decoupling interfaces interoperability standards

symfony/var-dumper

To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).

To use the ServerDumpCommand and/or the bin/var-dump-server script

Symfony mechanism for exploring and dumping PHP variables

symfony/yaml

For validating YAML files using the lint command

Symfony Yaml Component

theseer/tokenizer

A small library for converting tokenized PHP source code into XML and potentially other formats

twig/twig

Twig, the flexible, fast, and secure template language for PHP

umpirsky/twig-php-function

Call (almost) any PHP function from your Twig templates.

webmozart/assert

Assertions to validate method input/output with nice error messages.

wyrihaximus/twig-view

Twig powered View for CakePHP3

zendframework/zend-diactoros

PSR HTTP Message implementations

{'repo_name': 'cloudfoundry/php-buildpack', 'stars': '125', 'repo_language': 'PHP', 'file_name': 'server-defaults.conf', 'mime_type': 'text/plain', 'hash': 8955368404198354682, 'source_dataset': 'data'}


namespace AngleSharp.Core.Tests.Html
{
    using AngleSharp.Dom;
    using NUnit.Framework;
    using System;

    ///
    /// Tests from https://github.com/html5lib/html5lib-tests:
    /// tree-construction/tests14.dat
    ///
    [TestFixture]
    public class NamespaceTests
    {
        private static readonly String HtmlWithNestedSvgElement = @"<!DOCTYPE html>

<svg xmlns=""http://www.w3.org/2000/svg""><svg><circle /></svg></svg>
";

        [Test]
        public void UnknownElementWithUnknownNamespaceInBody()
        {
            var doc = (@"<!DOCTYPE html><xyz:abc></xyz:abc>").ToHtmlDocument();

            var docType0 = doc.ChildNodes[0] as DocumentType;
            Assert.IsNotNull(docType0);
            Assert.AreEqual(NodeType.DocumentType, docType0.NodeType);
            Assert.AreEqual(@"html", docType0.Name);

            var dochtml1 = doc.ChildNodes[1];
            Assert.AreEqual(2, dochtml1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1).Attributes.Length);
            Assert.AreEqual("html", dochtml1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1.NodeType);

            var dochtml1head0 = dochtml1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1head0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1head0).Attributes.Length);
            Assert.AreEqual("head", dochtml1head0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1head0.NodeType);

            var dochtml1body1 = dochtml1.ChildNodes[1];
            Assert.AreEqual(1, dochtml1body1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1).Attributes.Length);
            Assert.AreEqual("body", dochtml1body1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1.NodeType);

            var dochtml1body1xyzabc0 = dochtml1body1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1body1xyzabc0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1xyzabc0).Attributes.Length);
            Assert.AreEqual("xyz:abc", dochtml1body1xyzabc0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1xyzabc0.NodeType);
        }

        [Test]
        public void UnknownElementWithUnknownNamespaceInBodyBeforeSpan()
        {
            var doc = (@"<!DOCTYPE html><xyz:abc></xyz:abc>").ToHtmlDocument();

            var docType0 = doc.ChildNodes[0] as DocumentType;
            Assert.IsNotNull(docType0);
            Assert.AreEqual(NodeType.DocumentType, docType0.NodeType);
            Assert.AreEqual(@"html", docType0.Name);

            var dochtml1 = doc.ChildNodes[1];
            Assert.AreEqual(2, dochtml1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1).Attributes.Length);
            Assert.AreEqual("html", dochtml1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1.NodeType);

            var dochtml1head0 = dochtml1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1head0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1head0).Attributes.Length);
            Assert.AreEqual("head", dochtml1head0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1head0.NodeType);

            var dochtml1body1 = dochtml1.ChildNodes[1];
            Assert.AreEqual(2, dochtml1body1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1).Attributes.Length);
            Assert.AreEqual("body", dochtml1body1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1.NodeType);

            var dochtml1body1xyzabc0 = dochtml1body1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1body1xyzabc0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1xyzabc0).Attributes.Length);
            Assert.AreEqual("xyz:abc", dochtml1body1xyzabc0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1xyzabc0.NodeType);

            var dochtml1body1span1 = dochtml1body1.ChildNodes[1];
            Assert.AreEqual(0, dochtml1body1span1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1span1).Attributes.Length);
            Assert.AreEqual("span", dochtml1body1span1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1span1.NodeType);
        }

        [Test]
        public void UnknownElementWithUnknownNamespaceInHtmlWithUnknownAttribute()
        {
            var doc = (@"<!DOCTYPE html><xyz:abc></xyz:abc>").ToHtmlDocument();

            var docType0 = doc.ChildNodes[0] as DocumentType;
            Assert.IsNotNull(docType0);
            Assert.AreEqual(NodeType.DocumentType, docType0.NodeType);
            Assert.AreEqual(@"html", docType0.Name);

            var dochtml1 = doc.ChildNodes[1];
            Assert.AreEqual(2, dochtml1.ChildNodes.Length);
            Assert.AreEqual(1, ((Element)dochtml1).Attributes.Length);
            Assert.AreEqual("html", dochtml1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1.NodeType);

            Assert.IsNotNull(((Element)dochtml1).GetAttribute("abc:def"));
            Assert.AreEqual("gh", ((Element)dochtml1).GetAttribute("abc:def"));

            var dochtml1head0 = dochtml1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1head0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1head0).Attributes.Length);
            Assert.AreEqual("head", dochtml1head0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1head0.NodeType);

            var dochtml1body1 = dochtml1.ChildNodes[1];
            Assert.AreEqual(1, dochtml1body1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1).Attributes.Length);
            Assert.AreEqual("body", dochtml1body1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1.NodeType);

            var dochtml1body1xyzabc0 = dochtml1body1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1body1xyzabc0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1xyzabc0).Attributes.Length);
            Assert.AreEqual("xyz:abc", dochtml1body1xyzabc0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1xyzabc0.NodeType);
        }

        [Test]
        public void DuplicatedHtmlTagWithMultipleXmlLangAttributes()
        {
            var doc = (@"<!DOCTYPE html>").ToHtmlDocument();

            var docType0 = doc.ChildNodes[0] as DocumentType;
            Assert.IsNotNull(docType0);
            Assert.AreEqual(NodeType.DocumentType, docType0.NodeType);
            Assert.AreEqual(@"html", docType0.Name);

            var dochtml1 = doc.ChildNodes[1];
            Assert.AreEqual(2, dochtml1.ChildNodes.Length);
            Assert.AreEqual(1, ((Element)dochtml1).Attributes.Length);
            Assert.AreEqual("html", dochtml1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1.NodeType);

            Assert.IsNotNull(((Element)dochtml1).GetAttribute("xml:lang"));
            Assert.AreEqual("bar", ((Element)dochtml1).GetAttribute("xml:lang"));

            var dochtml1head0 = dochtml1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1head0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1head0).Attributes.Length);
            Assert.AreEqual("head", dochtml1head0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1head0.NodeType);

            var dochtml1body1 = dochtml1.ChildNodes[1];
            Assert.AreEqual(0, dochtml1body1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1).Attributes.Length);
            Assert.AreEqual("body", dochtml1body1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1.NodeType);
        }

        [Test]
        public void NumericAttributeWithNumericValue()
        {
            var doc = (@"<!DOCTYPE html>").ToHtmlDocument();

            var docType0 = doc.ChildNodes[0] as DocumentType;
            Assert.IsNotNull(docType0);
            Assert.AreEqual(NodeType.DocumentType, docType0.NodeType);
            Assert.AreEqual(@"html", docType0.Name);

            var dochtml1 = doc.ChildNodes[1];
            Assert.AreEqual(2, dochtml1.ChildNodes.Length);
            Assert.AreEqual(1, ((Element)dochtml1).Attributes.Length);
            Assert.AreEqual("html", dochtml1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1.NodeType);

            Assert.IsNotNull(((Element)dochtml1).GetAttribute("123"));
            Assert.AreEqual("456", ((Element)dochtml1).GetAttribute("123"));

            var dochtml1head0 = dochtml1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1head0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1head0).Attributes.Length);
            Assert.AreEqual("head", dochtml1head0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1head0.NodeType);

            var dochtml1body1 = dochtml1.ChildNodes[1];
            Assert.AreEqual(0, dochtml1body1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1).Attributes.Length);
            Assert.AreEqual("body", dochtml1body1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1.NodeType);
        }

        [Test]
        public void DuplicatedHtmlTagWithDifferentNumericAttributes()
        {
            var doc = (@"<!DOCTYPE html>").ToHtmlDocument();

            var docType0 = doc.ChildNodes[0] as DocumentType;
            Assert.IsNotNull(docType0);
            Assert.AreEqual(NodeType.DocumentType, docType0.NodeType);
            Assert.AreEqual(@"html", docType0.Name);

            var dochtml1 = doc.ChildNodes[1];
            Assert.AreEqual(2, dochtml1.ChildNodes.Length);
            Assert.AreEqual(2, ((Element)dochtml1).Attributes.Length);
            Assert.AreEqual("html", dochtml1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1.NodeType);

            Assert.IsNotNull(((Element)dochtml1).GetAttribute("123"));
            Assert.AreEqual("456", ((Element)dochtml1).GetAttribute("123"));

            Assert.IsNotNull(((Element)dochtml1).GetAttribute("789"));
            Assert.AreEqual("012", ((Element)dochtml1).GetAttribute("789"));

            var dochtml1head0 = dochtml1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1head0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1head0).Attributes.Length);
            Assert.AreEqual("head", dochtml1head0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1head0.NodeType);

            var dochtml1body1 = dochtml1.ChildNodes[1];
            Assert.AreEqual(0, dochtml1body1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1body1).Attributes.Length);
            Assert.AreEqual("body", dochtml1body1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1.NodeType);
        }

        [Test]
        public void BodyTagWithNumericAttribute()
        {
            var doc = (@"<!DOCTYPE html>").ToHtmlDocument();

            var docType0 = doc.ChildNodes[0] as DocumentType;
            Assert.IsNotNull(docType0);
            Assert.AreEqual(NodeType.DocumentType, docType0.NodeType);
            Assert.AreEqual(@"html", docType0.Name);

            var dochtml1 = doc.ChildNodes[1];
            Assert.AreEqual(2, dochtml1.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1).Attributes.Length);
            Assert.AreEqual("html", dochtml1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1.NodeType);

            var dochtml1head0 = dochtml1.ChildNodes[0];
            Assert.AreEqual(0, dochtml1head0.ChildNodes.Length);
            Assert.AreEqual(0, ((Element)dochtml1head0).Attributes.Length);
            Assert.AreEqual("head", dochtml1head0.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1head0.NodeType);

            var dochtml1body1 = dochtml1.ChildNodes[1];
            Assert.AreEqual(0, dochtml1body1.ChildNodes.Length);
            Assert.AreEqual(1, ((Element)dochtml1body1).Attributes.Length);
            Assert.AreEqual("body", dochtml1body1.GetTagName());
            Assert.AreEqual(NodeType.Element, dochtml1body1.NodeType);

            Assert.IsNotNull(((Element)dochtml1body1).GetAttribute("789"));
            Assert.AreEqual("012", ((Element)dochtml1body1).GetAttribute("789"));
        }

        [Test]
        public void HtmlElementsAreUppercaseSvgElementsLowercase()
        {
            var doc = (HtmlWithNestedSvgElement).ToHtmlDocument();
            var body = doc.Body;
            var div = body.FirstElementChild;
            var span = div.FirstElementChild;
            var svg = span.FirstElementChild;
            Assert.AreEqual("BODY", body.TagName);
            Assert.AreEqual("DIV", div.TagName);
            Assert.AreEqual("SPAN", span.TagName);
            Assert.AreEqual("svg", svg.TagName);
        }

        [Test]
        public void NestedSvgElementHasSameNameAsNormalSvgElement()
        {
            var doc = (HtmlWithNestedSvgElement).ToHtmlDocument();
            var svg = doc.Body.FirstElementChild.FirstElementChild.FirstElementChild;
            var nestedSvg = svg.FirstElementChild;
            var circle = nestedSvg.FirstElementChild;
            Assert.AreEqual("svg", nestedSvg.TagName);
            Assert.AreEqual("circle", circle.TagName);
        }
    }
}

{'repo_name': 'AngleSharp/AngleSharp', 'stars': '3306', 'repo_language': 'C#', 'file_name': 'index.md', 'mime_type': 'text/plain', 'hash': -4047847629093384735, 'source_dataset': 'data'}


C/MEMBR ADD NAME=BOUNN,SSI=0
      subroutine bounn(adeg,acap12,vsn)
c!purpose
C  calculation of a bounn for vsn or acap12 for elliptic filters
c!
      implicit double precision (a-h,o-z)
c
      dimension dk(3), df(3)
      data de /1.0d+0/
      dff(dd) = (dellk(dd)*dkk/dellk(sqrt(de-dd*dd)))**ii - ddeg
      dpi=4.0d+0*atan(1.0d+00)
      if (acap12.le.0.0d+0) go to 10
      dcap12 = acap12
      deg = 1.0d+0/adeg
      ii = 1
      go to 20
  10  dcap12 = de/vsn
      deg = adeg
      ii = -1
  20  dcap14 = sqrt(de-dcap12*dcap12)
      dkk = dellk(dcap14)/dellk(dcap12)
      dq = exp(-dpi*dkk*deg)
      dk1 = 4.0d+0*sqrt(dq)
      if (dk1.lt.de) go to 30
      dq = 2.0d+0*dq
      dq = (de-dq)/(de+dq)
      dq = dq*dq
      dk1 = sqrt(de-dq*dq)
  30  dk(1) = dk1
      dk(2) = (de+dk(1))/2.0d+0
      ddeg = adeg
      df(1) = dff(dk(1))
      df(2) = dff(dk(2))
   40  dk(3) = dk(1) - df(1)*(dk(1)-dk(2))/(df(1)-df(2))
      df(3) = dff(dk(3))
      if (abs(df(3)).lt.1.0d-6) go to 60
      dmax = 0.0d+0
      do 50 j=1,3
        dab = abs(df(j))
        if (dmax.gt.dab) go to 50
        jj = j
        dmax = dab
  50  continue
      if (jj.eq.3) go to 40
      dk(jj) = dk(3)
      df(jj) = df(3)
      go to 40
  60  if (acap12.le.0.) go to 70
      dde = de/dk(3)
      vsn = dde
      return
  70  acap12 = dk(3)
      return
      end

{'repo_name': 'scilab/scilab', 'stars': '101', 'repo_language': 'Scilab', 'file_name': 'special_functions_gw.hxx', 'mime_type': 'text/x-c', 'hash': -6658491896615808797, 'source_dataset': 'data'}


///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2014.
// Copyright John Maddock 2014.
// Copyright Paul Bristow 2014.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

// <boost/cstdfloat.hpp> implements floating-point typedefs having
// specified widths, as described in N3626 (proposed for C++14).
// See: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3626.pdf

#ifndef BOOST_MATH_CSTDFLOAT_2014_01_09_HPP_
  #define BOOST_MATH_CSTDFLOAT_2014_01_09_HPP_

  // Include the floating-point type definitions.
  #include <boost/math/cstdfloat/cstdfloat_types.hpp>

  // Support a specialization of std::numeric_limits<> for the wrapped quadmath library (if available).
  #if !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_LIMITS)
    #include <boost/math/cstdfloat/cstdfloat_limits.hpp>
  #endif

  // Support <cmath> functions for the wrapped quadmath library (if available).
  #if !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_CMATH)
    #include <boost/math/cstdfloat/cstdfloat_cmath.hpp>
  #endif

  // Support I/O stream operations for the wrapped quadmath library (if available).
  #if !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_IOSTREAM)
    #if defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_CMATH)
    #error You can not use <boost/math/cstdfloat/cstdfloat_iostream.hpp> with BOOST_CSTDFLOAT_NO_LIBQUADMATH_CMATH defined.
    #endif
    #include <boost/math/cstdfloat/cstdfloat_iostream.hpp>
  #endif

  // Support a specialization of std::complex<> for the wrapped quadmath library (if available).
  #if !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_COMPLEX)
    #if defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_LIMITS)
    #error You can not use <boost/math/cstdfloat/cstdfloat_complex.hpp> with BOOST_CSTDFLOAT_NO_LIBQUADMATH_LIMITS defined.
    #endif
    #if defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_CMATH)
    #error You can not use <boost/math/cstdfloat/cstdfloat_complex.hpp> with BOOST_CSTDFLOAT_NO_LIBQUADMATH_CMATH defined.
    #endif
    #if defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_IOSTREAM)
    #error You can not use <boost/math/cstdfloat/cstdfloat_complex.hpp> with BOOST_CSTDFLOAT_NO_LIBQUADMATH_IOSTREAM defined.
    #endif
    #include <boost/math/cstdfloat/cstdfloat_complex.hpp>
  #endif

  // Undefine BOOST_NO_FLOAT128_T because this constant is not meant for public use.
  #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T)
  #undef BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T
  #endif

#endif // BOOST_MATH_CSTDFLOAT_2014_01_09_HPP_

{'repo_name': 'boostorg/math', 'stars': '143', 'repo_language': 'C++', 'file_name': 'numerical_differentiation.qbk', 'mime_type': 'text/x-c++', 'hash': 1850518359039718692, 'source_dataset': 'data'}


# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

from aliyunsdkcore.request import RpcRequest
from aliyunsdklive.endpoint import endpoint_data

class UpdateBoardCallbackRequest(RpcRequest):

	def __init__(self):
		RpcRequest.__init__(self, 'live', '2016-11-01', 'UpdateBoardCallback','live')
		self.set_method('POST')
		if hasattr(self, "endpoint_map"):
			setattr(self, "endpoint_map", endpoint_data.getEndpointMap())
		if hasattr(self, "endpoint_regional"):
			setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional())

	def get_AuthKey(self):
		return self.get_query_params().get('AuthKey')

	def set_AuthKey(self,AuthKey):
		self.add_query_param('AuthKey',AuthKey)

	def get_CallbackEnable(self):
		return self.get_query_params().get('CallbackEnable')

	def set_CallbackEnable(self,CallbackEnable):
		self.add_query_param('CallbackEnable',CallbackEnable)

	def get_CallbackEvents(self):
		return self.get_query_params().get('CallbackEvents')

	def set_CallbackEvents(self,CallbackEvents):
		self.add_query_param('CallbackEvents',CallbackEvents)

	def get_OwnerId(self):
		return self.get_query_params().get('OwnerId')

	def set_OwnerId(self,OwnerId):
		self.add_query_param('OwnerId',OwnerId)

	def get_CallbackUri(self):
		return self.get_query_params().get('CallbackUri')

	def set_CallbackUri(self,CallbackUri):
		self.add_query_param('CallbackUri',CallbackUri)

	def get_AppId(self):
		return self.get_query_params().get('AppId')

	def set_AppId(self,AppId):
		self.add_query_param('AppId',AppId)

	def get_AuthSwitch(self):
		return self.get_query_params().get('AuthSwitch')

	def set_AuthSwitch(self,AuthSwitch):
		self.add_query_param('AuthSwitch',AuthSwitch)

{'repo_name': 'aliyun/aliyun-openapi-python-sdk', 'stars': '725', 'repo_language': 'Python', 'file_name': 'AssumeRoleWithSAMLRequest.py', 'mime_type': 'text/x-python', 'hash': 744572079186713097, 'source_dataset': 'data'}


//
//  MQMessageFormInputModel.m
//  MeiQiaSDK
//
//  Created by bingoogolapple on 16/5/6.
//  Copyright © 2016年 MeiQia Inc. All rights reserved.
//

#import "MQMessageFormInputModel.h"

@implementation MQMessageFormInputModel

-(instancetype)init {
    if(self = [super init]) {
        self.tip = @"";
        self.placeholder = @"";
        self.key = @"";
        self.isRequired = NO;
        self.isSingleLine = NO;
        self.keyboardType = UIKeyboardTypeDefault;
    }
    return self;
}

@end

{'repo_name': 'Meiqia/MQChatViewController', 'stars': '253', 'repo_language': 'Objective-C', 'file_name': 'MQServiceToViewInterface.m', 'mime_type': 'text/x-objective-c', 'hash': 2043007609174830972, 'source_dataset': 'data'}


/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

#ifndef SkHighContrastFilter_DEFINED
#define SkHighContrastFilter_DEFINED

#include "SkColorFilter.h"
#include "SkPaint.h"

/**
 *  Configuration struct for SkHighContrastFilter.
 *
 *  Provides transformations to improve contrast for users with low vision.
 */
struct SkHighContrastConfig {
    enum class InvertStyle {
        kNoInvert,
        kInvertBrightness,
        kInvertLightness,

        kLast = kInvertLightness
    };

    SkHighContrastConfig() {
        fGrayscale = false;
        fInvertStyle = InvertStyle::kNoInvert;
        fContrast = 0.0f;
    }

    SkHighContrastConfig(bool grayscale,
                         InvertStyle invertStyle,
                         SkScalar contrast)
        : fGrayscale(grayscale),
          fInvertStyle(invertStyle),
          fContrast(contrast) {}

    // Returns true if all of the fields are set within the valid range.
    bool isValid() const {
        return fInvertStyle >= InvertStyle::kNoInvert &&
            fInvertStyle <= InvertStyle::kInvertLightness &&
            fContrast >= -1.0 &&
            fContrast <= 1.0;
    }

    // If true, the color will be converted to grayscale.
    bool fGrayscale;

    // Whether to invert brightness, lightness, or neither.
    InvertStyle fInvertStyle;

    // After grayscale and inverting, the contrast can be adjusted linearly.
    // The valid range is -1.0 through 1.0, where 0.0 is no adjustment.
    SkScalar  fContrast;
};

/**
 *  Color filter that provides transformations to improve contrast
 *  for users with low vision.
 *
 *  Applies the following transformations in this order. Each of these
 *  can be configured using SkHighContrastConfig.
 *
 *    - Conversion to grayscale
 *    - Color inversion (either in RGB or HSL space)
 *    - Increasing the resulting contrast.
 *
 * Calling SkHighContrastFilter::Make will return nullptr if the config is
 * not valid, e.g. if you try to call it with a contrast outside the range of
 * -1.0 to 1.0.
 */

class SK_API SkHighContrastFilter {
public:
    // Returns the filter, or nullptr if the config is invalid.
    static sk_sp<SkColorFilter> Make(const SkHighContrastConfig& config);

    static void InitializeFlattenables();
};

#endif

{'repo_name': 'Zubnix/skia-wasm-port', 'stars': '119', 'repo_language': 'C++', 'file_name': 'SkTouchGesture.h', 'mime_type': 'text/x-c++', 'hash': -1481712438696883691, 'source_dataset': 'data'}


/****************************************************************************
 *
 *  Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.
 *
 *  http://www.real.com/devzone
 *
 *  This program contains proprietary
 *  information of Progressive Networks, Inc, and is licensed
 *  subject to restrictions on use and distribution.
 *
 *
 *  RealMedia Architecture Plug-in Interfaces.
 *
 */

#ifndef _RMAVALUE_H_
#define _RMAVALUE_H_

/*
 * Forward declarations of some interfaces defined or used here-in.
 */
typedef _INTERFACE  IUnknown			    IUnknown;
typedef _INTERFACE  IRMABuffer			    IRMABuffer;
typedef _INTERFACE  IRMAKeyValueList		    IRMAKeyValueList;
typedef _INTERFACE  IRMAKeyValueListIter            IRMAKeyValueListIter;
typedef _INTERFACE  IRMAKeyValueListIterOneKey      IRMAKeyValueListIterOneKey;
typedef _INTERFACE  IRMAValues			    IRMAValues;
typedef _INTERFACE  IRMAOptions			    IRMAOptions;

/* Note : GUIDS 3101 - 3107 are deprecated. */

/****************************************************************************
 *
 *  Interface:
 *
 *	IRMAKeyValueList
 *
 *  Purpose:
 *
 *	Stores a list of strings, where strings are keyed by not necessarily
 *      unique keys.
 *
 *
 *  IRMAKeyValueList:
 *
 *	{0x00003108-0901-11d1-8B06-00A024406D59}
 *
 */
DEFINE_GUID(IID_IRMAKeyValueList, 0x00003108, 0x901, 0x11d1,
	    0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
#define CLSID_IRMAKeyValueList IID_IRMAKeyValueList

#undef  INTERFACE
#define INTERFACE   IRMAKeyValueList

DECLARE_INTERFACE_(IRMAKeyValueList, IUnknown)
{
    /*
     *	IUnknown methods
     */
    STDMETHOD(QueryInterface)	(THIS_
				REFIID riid,
				void** ppvObj) PURE;

    STDMETHOD_(ULONG,AddRef)	(THIS) PURE;

    STDMETHOD_(ULONG,Release)	(THIS) PURE;

    /*
     * Regular methods
     */

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueList::AddKeyValue
     *	Purpose:
     *      Add a new key/value tuple to our list of strings.  You can have
     *      multiple strings for the same key.
     */
    STDMETHOD(AddKeyValue)	(THIS_
				const char* pKey,
				IRMABuffer* pStr) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueList::GetIter
     *	Purpose:
     *      Return an iterator that allows you to iterate through all the
     *      key/value tuples in our list of strings.
     */
    STDMETHOD(GetIter)		(THIS_
				REF(IRMAKeyValueListIter*) pIter) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueList::GetIterOneKey
     *	Purpose:
     *      Return an iterator that allows you to iterate through all the
     *      strings for a particular key.
     */
    STDMETHOD(GetIterOneKey)	(THIS_
				const char* pKey,
				REF(IRMAKeyValueListIterOneKey*) pIter) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueList::AppendAllListItems
     *	Purpose:
     *      Append all the key/string tuples from another list to this list.
     *      (You can have duplicate keys.)
     */
    STDMETHOD(AppendAllListItems)   (THIS_
				    IRMAKeyValueList* pList) PURE;
     /************************************************************************
     *	Method:
     *	    IRMAKeyValueList::KeyExists
     *	Purpose:
     *      See whether any strings exist for a particular key.
     */
    STDMETHOD_(BOOL,KeyExists)  (THIS_
				const char* pKey) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueList::CreateObject
     *	Purpose:
     *      Create an empty object that is the same class as the current object.
     */
    STDMETHOD(CreateObject)	(THIS_
				REF(IRMAKeyValueList*) pNewList) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueList::ImportValues.
     *	Purpose:
     *      Import all the strings from an IRMAValues object into this object.
     *      If this object also supports IRMAValues, it should also import the
     *      ULONGs and Buffers.  You can have duplicate keys, and old data is
     *      left untouched.
     */
    STDMETHOD(ImportValues)	(THIS_
				IRMAValues* pValues) PURE;
};

/****************************************************************************
 *
 *  Interface:
 *
 *	IRMAKeyValueListIter
 *
 *  Purpose:
 *
 *	Iterate over all the items in a CKeyValueList.
 *      Call IRMAKeyValueList::GetIter to create an iterator.
 *
 *
 *  IRMAKeyValueListIter:
 *
 *	{0x00003109-0901-11d1-8B06-00A024406D59}
 *
 */
DEFINE_GUID(IID_IRMAKeyValueListIter,   0x00003109, 0x901, 0x11d1,
	    0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);

#define CLSID_IRMAKeyValueListIter IID_IRMAKeyValueListIter

#undef  INTERFACE
#define INTERFACE   IRMAKeyValueListIter

DECLARE_INTERFACE_(IRMAKeyValueListIter, IUnknown)
{
    /*
     *	IUnknown methods
     */
    STDMETHOD(QueryInterface)	(THIS_
				REFIID riid,
				void** ppvObj) PURE;

    STDMETHOD_(ULONG,AddRef)	(THIS) PURE;

    STDMETHOD_(ULONG,Release)	(THIS) PURE;

    /*
     * Regular methods
     */

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueListIter::GetNextPair
     *	Purpose:
     *      Each call to this method returns one key/value tuple from your
     *      list of strings.  Strings are returned in same order that they
     *      were inserted.
     */
    STDMETHOD(GetNextPair)	(THIS_
				REF(const char*) pKey,
				REF(IRMABuffer*) pStr) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueListIter::ReplaceCurr
     *	Purpose:
     *      Replaces the value in the key/value tuple that was returned
     *      in the last call to GetNextPair with a new string.
     */
    STDMETHOD(ReplaceCurr)	(THIS_
				IRMABuffer* pStr) PURE;
};

/****************************************************************************
 *
 *  Interface:
 *
 *	IRMAKeyValueListIterOneKey
 *
 *  Purpose:
 *
 *	Iterate over all the items in a CKeyValueList that match a particular key.
 *      Call IRMAKeyValueList::GetIterOneKey to create an iterator.
 *
 *
 *  IRMAKeyValueListIterOneKey:
 *
 *	{0x00003110-0901-11d1-8B06-00A024406D59}
 *
 */
DEFINE_GUID(IID_IRMAKeyValueListIterOneKey,   0x00003110, 0x901, 0x11d1,
	    0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);

#define CLSID_IRMAKeyValueListIterOneKey IID_IRMAKeyValueListIterOneKey

#undef  INTERFACE
#define INTERFACE   IRMAKeyValueListIterOneKey

DECLARE_INTERFACE_(IRMAKeyValueListIterOneKey, IUnknown)
{
    /*
     *	IUnknown methods
     */
    STDMETHOD(QueryInterface)	(THIS_
				REFIID riid,
				void** ppvObj) PURE;

    STDMETHOD_(ULONG,AddRef)	(THIS) PURE;

    STDMETHOD_(ULONG,Release)	(THIS) PURE;

    /*
     * Regular methods
     */

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueListIterOneKey::GetNextString
     *	Purpose:
     *      Each call to this method returns one string that matches the
     *      key for this iterator.  Strings are returned in same order that they
     *      were inserted.
     *
     */
    STDMETHOD(GetNextString)	(THIS_
				REF(IRMABuffer*) pStr) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAKeyValueListIterOneKey::ReplaceCurr
     *	Purpose:
     *      Replaces the value in the key/value tuple that was referenced
     *      in the last call to GetNextString with a new string.
     *
     */
    STDMETHOD(ReplaceCurr)	(THIS_
				IRMABuffer* pStr) PURE;
};

/****************************************************************************
 *
 *  Interface:
 *
 *	IRMAOptions
 *
 *  Purpose:
 *
 *	This is a generic options interface, implemented by any object to
 *	allow its options to be read and set by another component of the
 *	system.
 *
 *
 *  IRMAOptions:
 *
 *	{0x00003111-0901-11d1-8B06-00A024406D59}
 *
 */
DEFINE_GUID(IID_IRMAOptions,   0x00003111, 0x901, 0x11d1,
	    0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);

#define CLSID_IRMAOptions IID_IRMAOptions

#undef  INTERFACE
#define INTERFACE   IRMAOptions

DECLARE_INTERFACE_(IRMAOptions, IUnknown)
{
    /*
     *	IUnknown methods
     */
    STDMETHOD(QueryInterface)	(THIS_
				REFIID riid,
				void** ppvObj) PURE;

    STDMETHOD_(ULONG,AddRef)	(THIS) PURE;

    STDMETHOD_(ULONG,Release)	(THIS) PURE;

    /*
     * Regular methods
     */

     /************************************************************************
     *	Method:
     *	    IRMAOptions::GetOptions
     *	Purpose:
     *      This method returns a list of the options supported by this
     *	    particular object, along with the value currently set for each
     *	    option. Enumerate the members of the returned IRMAValues object
     *	    to discover what options a component supports and the type of
     *	    each of those options. The value for each name-value pair is
     *	    the current setting for that option.
     *
     */
    STDMETHOD(GetOptions)	(THIS_
				REF(IRMAValues*) pOptions) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAOptions::SetOptionULONG32
     *	Purpose:
     *      Sets the value of a ULONG32 option. The return value indicates
     *	    whether or not the SetOptionULONG32 call succeeded.
     *
     */
    STDMETHOD(SetOptionULONG32)	(THIS_
				const char* pName,
				ULONG32 ulValue) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAOptions::SetOptionCString
     *	Purpose:
     *      Sets the value of a CString option. The return value indicates
     *	    whether or not the SetOptionCString call succeeded.
     *
     */
    STDMETHOD(SetOptionCString)	(THIS_
				const char* pName,
				IRMABuffer* pValue) PURE;

     /************************************************************************
     *	Method:
     *	    IRMAOptions::SetOptionBuffer
     *	Purpose:
     *      Sets the value of a Buffer option. The return value indicates
     *	    whether or not the SetOptionBuffer call succeeded.
     *
     */
    STDMETHOD(SetOptionBuffer)	(THIS_
				const char* pName,
				IRMABuffer* pValue) PURE;
};

#endif /* !_RMAVALUE_H_ */

{'repo_name': 'mpc-hc/mpc-hc', 'stars': '2888', 'repo_language': 'C', 'file_name': 'rmaaconf.h', 'mime_type': 'text/x-c', 'hash': 7904022486056907853, 'source_dataset': 'data'}


<?php

use Phpmig\Migration\Migration;

class XapiStatementArchive extends Migration
{
    /**
     * Do the migration
     */
    public function up()
    {
        $biz = $this->getContainer();
        $db = $biz['db'];

        $db->exec("CREATE TABLE `xapi_statement_archive` (
          `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
          `uuid` varchar(64) NOT NULL,
          `version` varchar(32) NOT NULL DEFAULT '' COMMENT '版本号',
          `push_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上报时间',
          `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属用户',
          `verb` varchar(32) NOT NULL DEFAULT '' COMMENT '用户行为',
          `target_id` int(10) DEFAULT NULL COMMENT '目标Id',
          `target_type` varchar(32) NOT NULL COMMENT '目标类型',
          `status` varchar(16) NOT NULL DEFAULT 'created' COMMENT '状态: created, pushing, pushed',
          `data` text COMMENT '数据',
          `occur_time` int(10) unsigned NOT NULL COMMENT '行为发生时间',
          `created_time` int(10) unsigned NOT NULL COMMENT '创建时间',
          PRIMARY KEY (`id`),
          UNIQUE KEY `uuid` (`uuid`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    }

    /**
     * Undo the migration
     */
    public function down()
    {
        $biz = $this->getContainer();
        $db = $biz['db'];
        $db->exec('DROP TABLE `xapi_statement_archive`');
    }
}

{'repo_name': 'edusoho/edusoho', 'stars': '1355', 'repo_language': 'JavaScript', 'file_name': '20180206163424_user_add_uuid.php', 'mime_type': 'text/x-php', 'hash': -8980136754088249066, 'source_dataset': 'data'}


// according to the offical reference (EN)
// https://ichigojam.net/IchigoJam-en.html
Prism.languages.ichigojam = {
	'comment': /(?:\B'|REM)(?:[^\n\r]*)/i,
	'string': {
		pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,
		greedy: true
	},
	'number': /\B#[0-9A-F]+|\B`[01]+|(?:\b\d+\.?\d*|\B\.\d+)(?:E[+-]?\d+)?/i,
	'keyword': /\b(?:BEEP|BPS|CASE|CLEAR|CLK|CLO|CLP|CLS|CLT|CLV|CONT|COPY|ELSE|END|FILE|FILES|FOR|GOSUB|GSB|GOTO|IF|INPUT|KBD|LED|LET|LIST|LOAD|LOCATE|LRUN|NEW|NEXT|OUT|RIGHT|PLAY|POKE|PRINT|PWM|REM|RENUM|RESET|RETURN|RTN|RUN|SAVE|SCROLL|SLEEP|SRND|STEP|STOP|SUB|TEMPO|THEN|TO|UART|VIDEO|WAIT)(?:\$|\b)/i,
	'function': /\b(?:ABS|ANA|ASC|BIN|BTN|DEC|END|FREE|HELP|HEX|I2CR|I2CW|IN|INKEY|LEN|LINE|PEEK|RND|SCR|SOUND|STR|TICK|USR|VER|VPEEK|ZER)(?:\$|\b)/i,
	'label': /(?:\B@[^\s]+)/i,
	'operator': /<[=>]?|>=?|\|\||&&|[+\-*\/=|&^~!]|\b(?:AND|NOT|OR)\b/i,
	'punctuation': /[\[,;:()\]]/
};

{'repo_name': 'DuHouAn/Java', 'stars': '328', 'repo_language': 'None', 'file_name': '3_死锁.md', 'mime_type': 'text/plain', 'hash': 4151131254810325278, 'source_dataset': 'data'}


// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace Cake.Common.IO
{
    /// <summary>
    /// Contains settings used by <c>DeleteDirectory</c>.
    /// </summary>
    public class DeleteDirectorySettings
    {
        /// <summary>
        /// Gets or sets a value indicating whether to perform a recursive delete if set to <c>true</c>.
        /// <remarks>
        /// It is set to <c>false</c> by default.
        /// </remarks>
        /// </summary>
        public bool Recursive { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether to delete read-only files if set to <c>true</c>.
        /// <remarks>
        /// It is set to <c>false</c> by default.
        /// </remarks>
        /// </summary>
        public bool Force { get; set; }
    }
}

{'repo_name': 'cake-build/cake', 'stars': '2554', 'repo_language': 'C#', 'file_name': 'ToolLocator.cake', 'mime_type': 'text/plain', 'hash': -8988316451159443865, 'source_dataset': 'data'}


Active Record Basics
====================

Active Record is a design pattern that mitigates the mind-numbing mental gymnastics often needed to get your application to communicate with a database. This guide explains in detail how This guide uses a mix of real-world examples, metaphors and detailed explanations of the actual Rails source code to help you make the most of AcitveRecord.

After reading this guide readers should have a strong grasp of the Active Record pattern and how it can be used with or without Rails. Hopefully, some of the philosophical and theoretical intentions discussed here will also make them a stronger and better developer.

== ORM The Blueprint of Active Record

If Active Record is the engine of Rails then ORM is the blueprint of that engine. ORM is short for “Object Relational Mapping” and is a programming concept used to make structures within a system relational. As a thought experiment imagine the components that make up a typical car. There are doors, seats, windows, engines etc. Viewed independently they are simple parts, yet when bolted together through the aid of a blueprint, the parts become a more complex device. ORM is the blueprint that describes how the individual parts relate to one another and in some cases infers the part’s purpose through the way the associations are described.

== Active Record The Engine of Rails

Active Record is a design pattern used to access data within a database. The name “Active Record” was coined by Martin Fowler in his book “Patterns of Enterprise Application Architecture”. Essentially, when a record is returned from the database instead of being just the data it is wrapped in a class, which gives you methods to control that data with. The rails framework is built around the MVC (Model View Controller) design patten and the Active Record is used as the default Model.

The Rails community added several useful concepts to their version of Active Record, including inheritance and associations, which are extremely useful for web applications. The associations are created by using a DSL (domain specific language) of macros, and inheritance is achieved through the use of STI (Single Table Inheritance) at the database level.

By following a few simple conventions the Rails Active Record will automatically map between:

* Classes & Database Tables
* Class attributes & Database Table Columns

=== Rails Active Record Conventions
Here are the key conventions to consider when using Active Record.

==== Naming Conventions
Database Table - Plural with underscores separating words i.e. (book_clubs)
Model Class - Singular with the first letter of each word capitalized i.e. (BookClub)
Here are some additional Examples:

[grid="all"]
`-------------`---------------
Model / Class Table / Schema
----------------------------
Post          posts
LineItem      line_items
Deer          deer
Mouse         mice
Person        people
----------------------------

==== Schema Conventions

To take advantage of some of the magic of Rails database tables must be modeled
to reflect the ORM decisions that Rails makes.

[grid="all"]
`-------------`---------------------------------------------------------------------------------
Convention
-------------------------------------------------------------------------------------------------
Foreign keys  These fields are named table_id i.e. (item_id, order_id)
Primary Key   Rails automatically creates a primary key column named "id" unless told otherwise.
-------------------------------------------------------------------------------------------------

==== Magic Field Names

When these optional fields are used in your database table definition they give the Active Record
instance additional features.

NOTE: While these column names are optional they are in fact reserved by ActiveRecord. Steer clear of reserved keywords unless you want the extra functionality. For example, "type" is a reserved keyword
used to designate a table using Single Table Inheritance. If you are not using STI, try an analogous
keyword like "context", that may still accurately describe the data you are modeling.

[grid="all"]
`------------------------`------------------------------------------------------------------------------
Attribute                 Purpose
------------------------------------------------------------------------------------------------------
created_at / created_on  Rails stores the current date & time to this field when creating the record.
updated_at / updated_on  Rails stores the current date & time to this field when updating the record.
lock_version             Adds optimistic locking to a model link:http://api.rubyonrails.com/classes/ActiveRecord/Locking.html[more about optimistic locking].
type                     Specifies that the model uses Single Table Inheritance link:http://api.rubyonrails.com/classes/ActiveRecord/Base.html[more about STI].
id                       All models require an id. the default is name is "id" but can be changed using the "set_primary_key" or "primary_key" methods.
_table_name_\_count       Can be used to caches the number of belonging objects on the associated class.
------------------------------------------------------------------------------------------------------

By default rails assumes all tables will use “id” as their primary key to identify each record. Though fortunately you won’t have explicitly declare this, Rails will automatically create that field unless you tell it not to.

For example suppose you created a database table called cars:

[source, sql]
-------------------------------------------------------
mysql> CREATE TABLE cars (
         id INT,
         color VARCHAR(100),
         doors INT,
         horses INT,
         model VARCHAR(100)
       );
-------------------------------------------------------

Now you created a class named Car, which is to represent an instance of a record from your table.

[source, ruby]
-------------------------------------------------------
class Car
end
-------------------------------------------------------

As you might expect without defining the explicit mappings between your class and the table it is impossible for Rails or any other program to correctly map those relationships.

[source, ruby]
-------------------------------------------------------
>> c = Car.new
=> #<Class:0x11e1e90>
>> c.doors
NoMethodError: undefined method `doors' for #<Class:0x11e1e90>
        from (irb):2
-------------------------------------------------------

Now you could define a door methods to write and read data to and from the database. In a nutshell this is what ActiveRecord does. According to the Rails API:
“Active Record objects don‘t specify their attributes directly, but rather infer them from the table definition with which they‘re linked. Adding, removing, and changing attributes and their type is done directly in the database. Any change is instantly reflected in the Active Record objects. The mapping that binds a given Active Record class to a certain database table will happen automatically in most common cases, but can be overwritten for the uncommon ones.”
Lets try our Car class again, this time inheriting from ActiveRecord.

[source, ruby]
-------------------------------------------------------
class Car < ActiveRecord::Base
end
-------------------------------------------------------

Now if we try to access an attribute of the table ActiveRecord automatically handles the mappings for us, as you can see in the following example.

[source, ruby]
-------------------------------------------------------
>> c = Car.new
=> #<Car id: nil, doors: nil, color: nil, horses: nil, model: nil>
>> c.doors
=> nil
-------------------------------------------------------

Rails further extends this model by giving each ActiveRecord a way of describing the variety of ways records are associated with one another. We will touch on some of these associations later in the guide but I encourage readers who are interested to read the guide to ActiveRecord associations for an in-depth explanation of the variety of ways rails can model associations.
- Associations between objects controlled by meta-programming macros.

== Philosophical Approaches & Common Conventions
Rails has a reputation of being a zero-config  framework which means that it aims to get you off the ground with as little pre-flight checking as possible. This speed benefit is achieved by following “Convention over Configuration”, which is to say that if you agree to live with the defaults then you benefit from a the inherent speed-boost. As Courtneay Gasking put it to me once “You don’t want to off-road on Rails”. ActiveRecord is no different, while it’s possible to override or subvert any of the conventions of AR, unless you have a good reason for doing so you will probably be happy with the defaults. The following is a list of the common conventions of ActiveRecord

== ActiveRecord Magic
 - timestamps
 - updates

== How ActiveRecord Maps your Database.
- sensible defaults
- overriding conventions

== Growing Your Database Relationships Naturally

== Attributes
 - attribute accessor method. How to override them?
 - attribute?
 - dirty records
 -
== ActiveRecord handling the CRUD of your Rails application - Understanding the life-cycle of an ActiveRecord

== Validations & Callbacks
- Validations
    *  create!
    * validates_acceptance_of
    * validates_associated
    * validates_confirmation_of
    * validates_each
    * validates_exclusion_of
    * validates_format_of
    * validates_inclusion_of
    * validates_length_of
    * validates_numericality_of
    * validates_presence_of
    * validates_size_of
    * validates_uniqueness_of
 - Callback
    * (-) save
    * (-) valid
    * (1) before_validation
    * (2) before_validation_on_create
    * (-) validate
    * (-) validate_on_create
    * (3) after_validation
    * (4) after_validation_on_create
    * (5) before_save
    * (6) before_create
    * (-) create
    * (7) after_create
    * (8) after_save

{'repo_name': 'xlsuite/xlsuite', 'stars': '208', 'repo_language': 'JavaScript', 'file_name': 'index.js', 'mime_type': 'text/plain', 'hash': -4256210338450666428, 'source_dataset': 'data'}


<!DOCTYPE html>

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.ui.Menu</title>

  Here's a menu defined in markup:

Annual Report.pdf

Quarterly Update.pdf

Enemies List.txt

  Here's a menu which has been rendered with an explicit content node:

Drizzle

Rain

Deluge

  Here's a scrollable menu:

Auk

Bird

Crow

Duck

Emu

{'repo_name': 'ReactiveX/reactivex.github.io', 'stars': '119', 'repo_language': 'JavaScript', 'file_name': 'simple.html', 'mime_type': 'text/plain', 'hash': -6860367919296858359, 'source_dataset': 'data'}