text:
package com.amazonaws.services.lambda;

import com.amazonaws.*;
import com.amazonaws.regions.*;
import com.amazonaws.services.lambda.model.*;

/**
 * Interface for accessing AWSLambda.
 * AWS Lambda

 * Overview
 *

 *

 * This is the AWS Lambda API Reference .
 * The AWS Lambda Developer Guide provides additional information.
 * For the service overview, go to
 *  What is AWS Lambda  , and for information about how the service works, go to  AWS Lambda: How it Works
 * in the AWS Lambda Developer Guide .
 *

 */
public interface AWSLambda {

    /**
     * Overrides the default endpoint for this client ("https://lambda.us-east-1.amazonaws.com/").
     * Callers can use this method to control which AWS region they want to work with.
     *

     * Callers can pass in just the endpoint (ex: "lambda.us-east-1.amazonaws.com/") or a full
     * URL, including the protocol (ex: "https://lambda.us-east-1.amazonaws.com/"). If the
     * protocol is not specified here, the default protocol from this client's
     * {@link ClientConfiguration} will be used, which by default is HTTPS.
     *

     * For more information on using AWS regions with the AWS SDK for Java, and
     * a complete list of all available endpoints for all AWS services, see:
     *
     * http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912
     *

     * This method is not threadsafe. An endpoint should be configured when the
     * client is created and before any service requests are made. Changing it
     * afterwards creates inevitable race conditions for any service requests in
     * transit or retrying.
     *
     * @param endpoint
     *            The endpoint (ex: "lambda.us-east-1.amazonaws.com/") or a full URL,
     *            including the protocol (ex: "https://lambda.us-east-1.amazonaws.com/") of
     *            the region specific AWS endpoint this client will communicate
     *            with.
     *
     * @throws IllegalArgumentException
     *             If any problems are detected with the specified endpoint.
     */
    public void setEndpoint(String endpoint) throws java.lang.IllegalArgumentException;

    /**
     * An alternative to {@link AWSLambda#setEndpoint(String)}, sets the
     * regional endpoint for this client's service calls. Callers can use this
     * method to control which AWS region they want to work with.
     *

     * By default, all service endpoints in all regions use the https protocol.
     * To use http instead, specify it in the {@link ClientConfiguration}
     * supplied at construction.
     *

     * This method is not threadsafe. A region should be configured when the
     * client is created and before any service requests are made. Changing it
     * afterwards creates inevitable race conditions for any service requests in
     * transit or retrying.
     *
     * @param region
     *            The region this client will communicate with. See
     *            {@link Region#getRegion(com.amazonaws.regions.Regions)} for
     *            accessing a given region.
     * @throws java.lang.IllegalArgumentException
     *             If the given region is null, or if this service isn't
     *             available in the given region. See
     *             {@link Region#isServiceSupported(String)}
     * @see Region#getRegion(com.amazonaws.regions.Regions)
     * @see Region#createClient(Class, com.amazonaws.auth.AWSCredentialsProvider, ClientConfiguration)
     */
    public void setRegion(Region region) throws java.lang.IllegalArgumentException;

    /**
     *

     * Using this API you can update function version to which the alias
     * points to and alias description. For more information, see
     *  Introduction to AWS Lambda Aliases
     *
     *

     *

     * This requires permission for the lambda:UpdateAlias action.
     *

     *
     * @param updateAliasRequest Container for the necessary parameters to
     *           execute the UpdateAlias service method on AWSLambda.
     *
     * @return The response from the UpdateAlias service method, as returned
     *         by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public UpdateAliasResult updateAlias(UpdateAliasRequest updateAliasRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Deletes the specified Lambda function code and configuration.
     *

     *

     * If you don't specify a function version, AWS Lambda will delete the
     * function, including all its versions, and any aliases pointing to the
     * function versions.
     *

     *

     * When you delete a function the associated resource policy is also
     * deleted. You will need to delete the event source mappings explicitly.
     *

     *

     * For information about function versioning, see
     *  AWS Lambda Function Versioning and Aliases
     * .
     *

     *

     * This operation requires permission for the
     * lambda:DeleteFunction action.
     *

     *
     * @param deleteFunctionRequest Container for the necessary parameters to
     *           execute the DeleteFunction service method on AWSLambda.
     *
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     * @throws ResourceConflictException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public void deleteFunction(DeleteFunctionRequest deleteFunctionRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Adds a permission to the resource policy associated with the
     * specified AWS Lambda function. You use resource policies to grant
     * permissions to event sources that use "push" model. In "push" model,
     * event sources (such as Amazon S3 and custom applications) invoke your
     * Lambda function. Each permission you add to the resource policy allows
     * an event source, permission to invoke the Lambda function.
     *

     *

     * For information about the push model, see
     *  AWS Lambda: How it Works
     * .
     *

     *

     * If you are using versioning feature (see
     *  AWS Lambda Function Versioning and Aliases
     * ), a Lambda function can have multiple ARNs that can be used to
     * invoke the function. Note that, each permission you add to resource
     * policy using this API is specific to an ARN, specified using the
     * Qualifier parameter
     *

     *

     * This operation requires permission for the
     * lambda:AddPermission action.
     *

     *
     * @param addPermissionRequest Container for the necessary parameters to
     *           execute the AddPermission service method on AWSLambda.
     *
     * @return The response from the AddPermission service method, as
     *         returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws PolicyLengthExceededException
     * @throws ResourceConflictException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public AddPermissionResult addPermission(AddPermissionRequest addPermissionRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns a list of your Lambda functions. For each function, the
     * response includes the function configuration information. You must use
     * GetFunction to retrieve the code for your function.
     *

     *

     * This operation requires permission for the
     * lambda:ListFunctions action.
     *

     *
     * @param listFunctionsRequest Container for the necessary parameters to
     *           execute the ListFunctions service method on AWSLambda.
     *
     * @return The response from the ListFunctions service method, as
     *         returned by AWSLambda.
     *
     * @throws ServiceException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public ListFunctionsResult listFunctions(ListFunctionsRequest listFunctionsRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns the specified alias information such as the alias ARN,
     * description, and function version it is pointing to. For more
     * information, see
     *  Introduction to AWS Lambda Aliases
     *
     *

     *

     * This requires permission for the lambda:GetAlias action.
     *

     *
     * @param getAliasRequest Container for the necessary parameters to
     *           execute the GetAlias service method on AWSLambda.
     *
     * @return The response from the GetAlias service method, as returned by
     *         AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public GetAliasResult getAlias(GetAliasRequest getAliasRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * You can remove individual permissions from an resource policy
     * associated with a Lambda function by providing a statement ID that you
     * provided when you addded the permission. The API removes corresponding
     * permission that is associated with the specific ARN identified by the
     * Qualifier parameter.
     *

     *

     * Note that removal of a permission will cause an active event source
     * to lose permission to the function.
     *

     *

     * You need permission for the lambda:RemovePermission
     * action.
     *

     *
     * @param removePermissionRequest Container for the necessary parameters
     *           to execute the RemovePermission service method on AWSLambda.
     *
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public void removePermission(RemovePermissionRequest removePermissionRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Creates a new Lambda function. The function metadata is created from
     * the request parameters, and the code for the function is provided by a
     * .zip file in the request body. If the function name already exists,
     * the operation will fail. Note that the function name is
     * case-sensitive.
     *

     *

     * This operation requires permission for the
     * lambda:CreateFunction action.
     *

     *
     * @param createFunctionRequest Container for the necessary parameters to
     *           execute the CreateFunction service method on AWSLambda.
     *
     * @return The response from the CreateFunction service method, as
     *         returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws CodeStorageExceededException
     * @throws ResourceConflictException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public CreateFunctionResult createFunction(CreateFunctionRequest createFunctionRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * You can update an event source mapping. This is useful if you want to
     * change the parameters of the existing mapping without losing your
     * position in the stream. You can change which function will receive the
     * stream records, but to change the stream itself, you must create a new
     * mapping.
     *

     *

     * This operation requires permission for the
     * lambda:UpdateEventSourceMapping action.
     *

     *
     * @param updateEventSourceMappingRequest Container for the necessary
     *           parameters to execute the UpdateEventSourceMapping service method on
     *           AWSLambda.
     *
     * @return The response from the UpdateEventSourceMapping service method,
     *         as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     * @throws ResourceConflictException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public UpdateEventSourceMappingResult updateEventSourceMapping(UpdateEventSourceMappingRequest updateEventSourceMappingRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Publishes a version of your function from the current snapshot of
     * HEAD. That is, AWS Lambda takes a snapshot of the function code and
     * configuration information from HEAD and publishes a new version. The
     * code and handler of this specific Lambda function version
     * cannot be modified after publication, but you can modify the
     * configuration information.
     *

     *
     * @param publishVersionRequest Container for the necessary parameters to
     *           execute the PublishVersion service method on AWSLambda.
     *
     * @return The response from the PublishVersion service method, as
     *         returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws CodeStorageExceededException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public PublishVersionResult publishVersion(PublishVersionRequest publishVersionRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * IMPORTANT:This API is deprecated. We recommend you use Invoke
     * API (see Invoke).
     *

     *

     * Submits an invocation request to AWS Lambda. Upon receiving the
     * request, Lambda executes the specified function asynchronously. To see
     * the logs generated by the Lambda function execution, see the
     * CloudWatch logs console.
     *

     *

     * This operation requires permission for the
     * lambda:InvokeFunction action.
     *

     *
     * @param invokeAsyncRequest Container for the necessary parameters to
     *           execute the InvokeAsync service method on AWSLambda.
     *
     * @return The response from the InvokeAsync service method, as returned
     *         by AWSLambda.
     *
     * @throws InvalidRequestContentException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    @Deprecated
    public InvokeAsyncResult invokeAsync(InvokeAsyncRequest invokeAsyncRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Updates the configuration parameters for the specified Lambda
     * function by using the values provided in the request. You provide only
     * the parameters you want to change. This operation must only be used on
     * an existing Lambda function and cannot be used to update the
     * function's code.
     *

     *

     * This operation requires permission for the
     * lambda:UpdateFunctionConfiguration action.
     *

     *
     * @param updateFunctionConfigurationRequest Container for the necessary
     *           parameters to execute the UpdateFunctionConfiguration service method
     *           on AWSLambda.
     *
     * @return The response from the UpdateFunctionConfiguration service
     *         method, as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public UpdateFunctionConfigurationResult updateFunctionConfiguration(UpdateFunctionConfigurationRequest updateFunctionConfigurationRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Invokes a specific Lambda function version.
     *

     *

     * If you don't provide the Qualifier parameter, it uses
     * the unqualified function ARN which results in invocation of the
     * $LATEST version of the Lambda function (when you create a Lambda
     * function, the $LATEST is the version). The AWS Lambda versioning and
     * aliases feature allows you to publish multiple versions of a Lambda
     * function and also create aliases for each function version. So each
     * your Lambda function version can be invoked using multiple ARNs. For
     * more information, see
     *  AWS Lambda Function Versioning and Aliases
     * . Using the Qualifier parameter, you can specify a
     * function version or alias name to invoke specific function version. If
     * you specify function version, the API uses the qualified function ARN
     * to invoke a specific function version. If you specify alias name, the
     * API uses the alias ARN to invoke the function version to which the
     * alias points.
     *

     *

     * This operation requires permission for the
     * lambda:InvokeFunction action.
     *

     *
     * @param invokeRequest Container for the necessary parameters to execute
     *           the Invoke service method on AWSLambda.
     *
     * @return The response from the Invoke service method, as returned by
     *         AWSLambda.
     *
     * @throws InvalidRequestContentException
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws RequestTooLargeException
     * @throws ResourceNotFoundException
     * @throws UnsupportedMediaTypeException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public InvokeResult invoke(InvokeRequest invokeRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns the resource policy, containing a list of permissions that
     * apply to a specific to an ARN that you specify via the
     * Qualifier paramter.
     *

     *

     * For informration about adding permissions, see AddPermission.
     *

     *

     * You need permission for the lambda:GetPolicy action.
     *

     *
     * @param getPolicyRequest Container for the necessary parameters to
     *           execute the GetPolicy service method on AWSLambda.
     *
     * @return The response from the GetPolicy service method, as returned by
     *         AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public GetPolicyResult getPolicy(GetPolicyRequest getPolicyRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns configuration information for the specified event source
     * mapping (see CreateEventSourceMapping).
     *

     *

     * This operation requires permission for the
     * lambda:GetEventSourceMapping action.
     *

     *
     * @param getEventSourceMappingRequest Container for the necessary
     *           parameters to execute the GetEventSourceMapping service method on
     *           AWSLambda.
     *
     * @return The response from the GetEventSourceMapping service method, as
     *         returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public GetEventSourceMappingResult getEventSourceMapping(GetEventSourceMappingRequest getEventSourceMappingRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns a list of event source mappings you created using the
     * CreateEventSourceMapping (see CreateEventSourceMapping),
     * where you identify a stream as an event source. This list does not
     * include Amazon S3 event sources.
     *

     *

     * For each mapping, the API returns configuration information. You can
     * optionally specify filters to retrieve specific event source mappings.
     *

     *

     * This operation requires permission for the
     * lambda:ListEventSourceMappings action.
     *

     *
     * @param listEventSourceMappingsRequest Container for the necessary
     *           parameters to execute the ListEventSourceMappings service method on
     *           AWSLambda.
     *
     * @return The response from the ListEventSourceMappings service method,
     *         as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public ListEventSourceMappingsResult listEventSourceMappings(ListEventSourceMappingsRequest listEventSourceMappingsRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Deletes specified Lambda function alias. For more information, see
     *  Introduction to AWS Lambda Aliases
     *
     *

     *

     * This requires permission for the lambda:DeleteAlias action.
     *

     *
     * @param deleteAliasRequest Container for the necessary parameters to
     *           execute the DeleteAlias service method on AWSLambda.
     *
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public void deleteAlias(DeleteAliasRequest deleteAliasRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns the configuration information of the Lambda function. This
     * the same information you provided as parameters when uploading the
     * function by using CreateFunction.
     *

     *

     * You can use the optional Qualifier parameter to retrieve
     * configuration information for a specific Lambda function version. If
     * you don't provide it, the API returns information about the $LATEST
     * version of the function. For more information about versioning, see
     *  AWS Lambda Function Versioning and Aliases
     * .
     *

     *

     * This operation requires permission for the
     * lambda:GetFunctionConfiguration operation.
     *

     *
     * @param getFunctionConfigurationRequest Container for the necessary
     *           parameters to execute the GetFunctionConfiguration service method on
     *           AWSLambda.
     *
     * @return The response from the GetFunctionConfiguration service method,
     *         as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public GetFunctionConfigurationResult getFunctionConfiguration(GetFunctionConfigurationRequest getFunctionConfigurationRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Removes an event source mapping. This means AWS Lambda will no longer
     * invoke the function for events in the associated source.
     *

     *

     * This operation requires permission for the
     * lambda:DeleteEventSourceMapping action.
     *

     *
     * @param deleteEventSourceMappingRequest Container for the necessary
     *           parameters to execute the DeleteEventSourceMapping service method on
     *           AWSLambda.
     *
     * @return The response from the DeleteEventSourceMapping service method,
     *         as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public DeleteEventSourceMappingResult deleteEventSourceMapping(DeleteEventSourceMappingRequest deleteEventSourceMappingRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Identifies a stream as an event source for a Lambda function. It can
     * be either an Amazon Kinesis stream or an Amazon DynamoDB stream. AWS
     * Lambda invokes the specified function when records are posted to the
     * stream.
     *

     *

     * This is the pull model, where AWS Lambda invokes the function. For
     * more information, go to
     *  AWS Lambda: How it Works
     * in the AWS Lambda Developer Guide .
     *

     *

     * This association between an Amazon Kinesis stream and a Lambda
     * function is called the event source mapping. You provide the
     * configuration information (for example, which stream to read from and
     * which Lambda function to invoke) for the event source mapping in the
     * request body.
     *

     *

     * Each event source, such as an Amazon Kinesis or a DynamoDB stream,
     * can be associated with multiple AWS Lambda function. A given Lambda
     * function can be associated with multiple AWS event sources.
     *

     *

     * This operation requires permission for the
     * lambda:CreateEventSourceMapping action.
     *

     *
     * @param createEventSourceMappingRequest Container for the necessary
     *           parameters to execute the CreateEventSourceMapping service method on
     *           AWSLambda.
     *
     * @return The response from the CreateEventSourceMapping service method,
     *         as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceConflictException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public CreateEventSourceMappingResult createEventSourceMapping(CreateEventSourceMappingRequest createEventSourceMappingRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Updates the code for the specified Lambda function. This operation
     * must only be used on an existing Lambda function and cannot be used to
     * update the function configuration.
     *

     *

     * This operation requires permission for the
     * lambda:UpdateFunctionCode action.
     *

     *
     * @param updateFunctionCodeRequest Container for the necessary
     *           parameters to execute the UpdateFunctionCode service method on
     *           AWSLambda.
     *
     * @return The response from the UpdateFunctionCode service method, as
     *         returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws CodeStorageExceededException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public UpdateFunctionCodeResult updateFunctionCode(UpdateFunctionCodeRequest updateFunctionCodeRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns list of aliases created for a Lambda function. For each
     * alias, the response includes information such as the alias ARN,
     * description, alias name, and the function version to which it points.
     * For more information, see
     *  Introduction to AWS Lambda Aliases
     *
     *

     *

     * This requires permission for the lambda:ListAliases action.
     *

     *
     * @param listAliasesRequest Container for the necessary parameters to
     *           execute the ListAliases service method on AWSLambda.
     *
     * @return The response from the ListAliases service method, as returned
     *         by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public ListAliasesResult listAliases(ListAliasesRequest listAliasesRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * List all versions of a function.
     *

     *
     * @param listVersionsByFunctionRequest Container for the necessary
     *           parameters to execute the ListVersionsByFunction service method on
     *           AWSLambda.
     *
     * @return The response from the ListVersionsByFunction service method,
     *         as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public ListVersionsByFunctionResult listVersionsByFunction(ListVersionsByFunctionRequest listVersionsByFunctionRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns the configuration information of the Lambda function and a
     * presigned URL link to the .zip file you uploaded with CreateFunction
     * so you can download the .zip file. Note that the URL is valid for up
     * to 10 minutes. The configuration information is the same information
     * you provided as parameters when uploading the function.
     *

     *

     * Using the optional Qualifier parameter, you can specify
     * a specific function version for which you want this information. If
     * you don't specify this parameter, the API uses unqualified function
     * ARN which return information about the $LATEST version of the Lambda
     * function. For more information, see
     *  AWS Lambda Function Versioning and Aliases
     * .
     *

     *

     * This operation requires permission for the
     * lambda:GetFunction action.
     *

     *
     * @param getFunctionRequest Container for the necessary parameters to
     *           execute the GetFunction service method on AWSLambda.
     *
     * @return The response from the GetFunction service method, as returned
     *         by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public GetFunctionResult getFunction(GetFunctionRequest getFunctionRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Creates an alias to the specified Lambda function version. For more
     * information, see
     *  Introduction to AWS Lambda Aliases
     *
     *

     *

     * This requires permission for the lambda:CreateAlias action.
     *

     *
     * @param createAliasRequest Container for the necessary parameters to
     *           execute the CreateAlias service method on AWSLambda.
     *
     * @return The response from the CreateAlias service method, as returned
     *         by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws ResourceConflictException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public CreateAliasResult createAlias(CreateAliasRequest createAliasRequest)
            throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns a list of your Lambda functions. For each function, the
     * response includes the function configuration information. You must use
     * GetFunction to retrieve the code for your function.
     *

     *

     * This operation requires permission for the
     * lambda:ListFunctions action.
     *

     *
     * @return The response from the ListFunctions service method, as
     *         returned by AWSLambda.
     *
     * @throws ServiceException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public ListFunctionsResult listFunctions() throws AmazonServiceException, AmazonClientException;

    /**
     *

     * Returns a list of event source mappings you created using the
     * CreateEventSourceMapping (see CreateEventSourceMapping),
     * where you identify a stream as an event source. This list does not
     * include Amazon S3 event sources.
     *

     *

     * For each mapping, the API returns configuration information. You can
     * optionally specify filters to retrieve specific event source mappings.
     *

     *

     * This operation requires permission for the
     * lambda:ListEventSourceMappings action.
     *

     *
     * @return The response from the ListEventSourceMappings service method,
     *         as returned by AWSLambda.
     *
     * @throws InvalidParameterValueException
     * @throws ServiceException
     * @throws ResourceNotFoundException
     * @throws TooManyRequestsException
     *
     * @throws AmazonClientException
     *             If any internal errors are encountered inside the client while
     *             attempting to make the request or handle the response.  For example
     *             if a network connection is not available.
     * @throws AmazonServiceException
     *             If an error response is returned by AWSLambda indicating
     *             either a problem with the data in the request, or a server side issue.
     */
    public ListEventSourceMappingsResult listEventSourceMappings() throws AmazonServiceException, AmazonClientException;

    /**
     * Shuts down this client object, releasing any resources that might be held
     * open. This is an optional method, and callers are not expected to call
     * it, but can if they want to explicitly release any open resources. Once a
     * client has been shutdown, it should not be used to make any more
     * requests.
     */
    public void shutdown();

    /**
     * Returns additional metadata for a previously executed successful request, typically used for
     * debugging issues where a service isn't acting as expected.  This data isn't considered part
     * of the result data returned by an operation, so it's available through this separate,
     * diagnostic interface.
     *

     * Response metadata is only cached for a limited period of time, so if you need to access
     * this extra diagnostic information for an executed request, you should use this method
     * to retrieve it as soon as possible after executing a request.
     *
     * @param request
     *            The originally executed request.
     *
     * @return The response metadata for the specified request, or null if none
     *         is available.
     */
    public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request);
}


text:
#ifndef CORE_SOCKET_CONNECTION_H
#define CORE_SOCKET_CONNECTION_H

#include "connection.h"

#include <stdint.h>
#include <memory>

namespace core {

// Connection object using a native socket
class SocketConnection : public Connection {
public:
    ~SocketConnection();

    // Creates a new socket connection listening on the specified hostname and port. Returns a
    // connection object on successful open or a nullptr if opening the connection is unsuccessful
    static std::unique_ptr<Connection> createSocket(const char* hostname, const char* port);

    // Creates a new pipe connection listening on the specified UNIX pipename, without
    // pipe creation on the local file system if abstract is true. Returns a connection object
    // on successful open or a nullptr if opening the connection is unsuccessful
    static std::unique_ptr<Connection> createPipe(const char* pipename, bool abstract);

    // Implementation of the Connection interface
    size_t send(const void* data, size_t size) override;
    size_t recv(void* data, size_t size) override;
    const char* error() override;
    std::unique_ptr<Connection> accept(int timeoutMs = NO_TIMEOUT) override;

private:
    // Private constructor used only by the static create function
    explicit SocketConnection(int socket);

    // Network initializer class to handle the initialization of the network driver. A socket
    // function can be called only if there is at least one active network initializer is in
    // the system
    struct NetworkInitializer {
        NetworkInitializer();
        ~NetworkInitializer();
    };

    // The underlying socket for the connection
    int mSocket;

    // Network initializer instance lasts for the lifetime of the connection
    NetworkInitializer mNetworkInitializer;
};

}  // namespace core

#endif

redpajama_set_name: RedPajamaGithub


text:
package io.gatling.core.session.el

import java.nio.charset.Charset
import java.util.{ Collection => JCollection, List => JList, Map => JMap }

import scala.annotation.tailrec
import scala.concurrent.forkjoin.ThreadLocalRandom
import scala.reflect.ClassTag
import scala.util.control.NonFatal
import scala.util.parsing.combinator.RegexParsers

import io.gatling.commons.NotNothing
import io.gatling.commons.util.TypeCaster
import io.gatling.commons.util.TypeHelper._
import io.gatling.commons.util.StringHelper._
import io.gatling.commons.util.NumberHelper._
import io.gatling.commons.validation._
import io.gatling.core.json.Json
import io.gatling.core.session._

object ElMessages {
  def undefinedSeqIndex(name: String, index: Int) = s"Seq named '$name' is undefined for index $index".failure
  def undefinedSessionAttribute(name: String) = s"No attribute named '$name' is defined".failure
  def undefinedMapKey(map: String, key: String) = s"Map named '$map' does not contain key '$key'".failure
  def sizeNotSupported(value: Any, name: String) = s"$value named '$name' does not support .size function".failure
  def accessByKeyNotSupported(value: Any, name: String) = s"$value named '$name' does not support access by key".failure
  def randomNotSupported(value: Any, name: String) = s"$value named '$name' does not support .random function".failure
  def indexAccessNotSupported(value: Any, name: String) = s"$value named '$name' does not support index access".failure
  def outOfRangeAccess(name: String, value: Any, index: Int) = s"Product $value named $name has no element with index $index".failure
  def tupleAccessNotSupported(name: String, value: Any) = s"Product $value named $name do not support tuple access".failure
}

trait Part[+T] extends Expression[T]

case class StaticPart(string: String) extends Part[String] {
  def apply(session: Session): Validation[String] = string.success
}

case class AttributePart(name: String) extends Part[Any] {
  def apply(session: Session): Validation[Any] = session(name).validate[Any]
}

case class SizePart(seqPart: Part[Any], name: String) extends Part[Int] {
  def apply(session: Session): Validation[Int] =
    seqPart(session).flatMap {
      case t: Traversable[_]          => t.size.success
      case collection: JCollection[_] => collection.size.success
      case map: JMap[_, _]            => map.size.success
      case arr: Array[_]              => arr.length.success
      case product: Product           => product.productArity.success
      case other                      => ElMessages.sizeNotSupported(other, name)
    }
}

case class RandomPart(seq: Part[Any], name: String) extends Part[Any] {
  def apply(session: Session): Validation[Any] = {
      def random(size: Int) = ThreadLocalRandom.current.nextInt(size)

    seq(session).flatMap {
      case seq: Seq[_]      => seq(random(seq.size)).success
      case list: JList[_]   => list.get(random(list.size)).success
      case arr: Array[_]    => arr(random(arr.length)).success
      case product: Product => product.productElement(random(product.productArity)).success
      case other            => ElMessages.randomNotSupported(other, name)
    }
  }
}

case class ExistsPart(part: Part[Any], name: String) extends Part[Boolean] {
  def apply(session: Session): Validation[Boolean] =
    part(session) match {
      case f: Failure => FalseSuccess
      case _          => TrueSuccess
    }
}

case class IsUndefinedPart(part: Part[Any], name: String) extends Part[Boolean] {
  def apply(session: Session): Validation[Boolean] =
    part(session) match {
      case f: Failure => TrueSuccess
      case _          => FalseSuccess
    }
}

case class JsonStringify(part: Part[Any], name: String) extends Part[String] {
  def apply(session: Session): Validation[String] =
    part(session) match {
      case Success(value)   => Json.stringify(value, isRootObject = false).success
      case NullValueFailure => NullStringSuccess
      case failure: Failure => failure
    }
}

case class SeqElementPart(seq: Part[Any], seqName: String, index: String) extends Part[Any] {
  def apply(session: Session): Validation[Any] = {

      def seqElementPart(index: Int): Validation[Any] = seq(session).flatMap {
        case seq: Seq[_] =>
          if (seq.isDefinedAt(index)) seq(index).success
          else ElMessages.undefinedSeqIndex(seqName, index)

        case arr: Array[_] =>
          if (index < arr.length) arr(index).success
          else ElMessages.undefinedSeqIndex(seqName, index)

        case list: JList[_] =>
          if (index < list.size) list.get(index).success
          else ElMessages.undefinedSeqIndex(seqName, index)

        case other => ElMessages.indexAccessNotSupported(other, seqName)
      }

    index match {
      case IntString(i) => seqElementPart(i)
      case _            => session(index).validate[Int].flatMap(seqElementPart)
    }
  }
}

case class MapKeyPart(map: Part[Any], mapName: String, key: String) extends Part[Any] {

  def apply(session: Session): Validation[Any] = map(session).flatMap {
    case m: Map[_, _] => m.asInstanceOf[Map[Any, _]].get(key) match {
      case Some(value) => value.success
      case None        => ElMessages.undefinedMapKey(mapName, key)
    }

    case map: JMap[_, _] =>
      if (map.containsKey(key)) map.get(key).success
      else ElMessages.undefinedMapKey(mapName, key)

    case other => ElMessages.accessByKeyNotSupported(other, mapName)
  }
}

case class TupleAccessPart(tuple: Part[Any], tupleName: String, index: Int) extends Part[Any] {
  def apply(session: Session): Validation[Any] = tuple(session).flatMap {
    case product: Product =>
      if (index > 0 && product.productArity >= index) product.productElement(index - 1).success
      else ElMessages.outOfRangeAccess(tupleName, product, index)

    case other => ElMessages.tupleAccessNotSupported(tupleName, other)
  }
}

class ElParserException(string: String, msg: String) extends Exception(s"Failed to parse $string with error '$msg'")

object ElCompiler {

  val NameRegex = "[^.${}()]+".r

  val TheELCompiler = new ThreadLocal[ElCompiler] {
    override def initialValue = new ElCompiler
  }

  def parse(string: String): List[Part[Any]] = TheELCompiler.get.parseEl(string)

  def compile[T: TypeCaster: ClassTag: NotNothing](string: String): Expression[T] =
    parse(string) match {
      case List(StaticPart(staticStr)) =>
        val runtimeClass = implicitly[ClassTag[T]].runtimeClass
        if (runtimeClass == classOf[String] || runtimeClass == classOf[Any] || runtimeClass == classOf[Object]) {
          StaticStringExpression(staticStr).asInstanceOf[Expression[T]]
        } else {
          val stringV = staticStr.asValidation[T]
          _ => stringV
        }

      case List(dynamicPart) => dynamicPart(_).flatMap(_.asValidation[T])

      case parts =>
        (session: Session) => parts.foldLeft(stringBuilder.success) { (sb, part) =>
          part match {
            case StaticPart(s) => sb.map(_.append(s))
            case _ =>
              for {
                sb <- sb
                part <- part(session)
              } yield sb.append(part)
          }
        }.flatMap(_.toString.asValidation[T])
    }

  def compile2BytesSeq(string: String, charset: Charset): Expression[Seq[Array[Byte]]] = {

    sealed trait Bytes { def bytes: Expression[Array[Byte]] }
    case class StaticBytes(bytes: Expression[Array[Byte]]) extends Bytes
    case class DynamicBytes(part: Part[Any]) extends Bytes {
      val bytes: Expression[Array[Byte]] = part.map(_.toString.getBytes(charset))
    }

      @tailrec
      def loop(session: Session, bytes: List[Bytes], resolved: List[Array[Byte]]): Validation[Seq[Array[Byte]]] = bytes match {
        case Nil => resolved.reverse.success
        case head :: tail => head.bytes(session) match {
          case Success(bs)      => loop(session, tail, bs :: resolved)
          case failure: Failure => failure
        }
      }

    val parts = ElCompiler.parse(string)
    val bytes = parts.map {
      case StaticPart(s) =>
        val bs = s.getBytes(charset).success
        StaticBytes(session => bs)
      case part => DynamicBytes(part)
    }

    session: Session => loop(session, bytes, Nil)
  }
}

class ElCompiler extends RegexParsers {

  import ElCompiler._

  sealed trait AccessToken { def token: String }
  case class AccessIndex(pos: String, token: String) extends AccessToken
  case class AccessKey(key: String, token: String) extends AccessToken
  sealed trait AccessFunction extends AccessToken { protected def functionToken(functionName: String) = s".$functionName()" }
  case object AccessRandom extends AccessFunction { val token = functionToken("random") }
  case object AccessSize extends AccessFunction { val token = functionToken("size") }
  case object AccessExists extends AccessFunction { val token = functionToken("exists") }
  case object AccessIsUndefined extends AccessFunction { val token = functionToken("isUndefined") }
  case object AccessJSONStringify extends AccessFunction { val token = functionToken("jsonStringify") }
  case class AccessTuple(index: String, token: String) extends AccessToken

  override def skipWhitespace = false

  def parseEl(string: String): List[Part[Any]] = {

    val parseResult =
      try { parseAll(expr, string) }
      catch { case NonFatal(e) => throw new ElParserException(string, e.getMessage) }

    parseResult match {
      case Success(parts, _) => parts
      case ns: NoSuccess     => throw new ElParserException(string, ns.msg)
    }
  }

  val expr: Parser[List[Part[Any]]] = multivaluedExpr | (elExpr ^^ { case part: Part[Any] => List(part) })

  def multivaluedExpr: Parser[List[Part[Any]]] = (elExpr | staticPart) *

  val staticPartPattern = new Parser[String] {
    def apply(in: Input) = {
      val source = in.source
      val offset = in.offset
      val end = source.length

        def success(i: Int) = Success(source.subSequence(offset, i).toString, in.drop(i - offset))
        def failure = Failure("Not a static part", in)

      source.indexOf("${", offset) match {
        case -1 if offset == end => failure
        case -1                  => success(end)
        case n if n == offset    => failure
        case n                   => success(n)
      }
    }
  }

  def staticPart: Parser[StaticPart] = staticPartPattern ^^ { case staticStr => StaticPart(staticStr) }

  def elExpr: Parser[Part[Any]] = "${" ~> sessionObject <~ "}"

  def sessionObject: Parser[Part[Any]] = (objectName ~ (valueAccess *) ^^ {
    case objectPart ~ accessTokens =>

      val (part, _) = accessTokens.foldLeft(objectPart.asInstanceOf[Part[Any]] -> objectPart.name)((partName, token) => {
        val (subPart, subPartName) = partName

        val part = token match {
          case AccessIndex(pos, tokenName)   => SeqElementPart(subPart, subPartName, pos)
          case AccessKey(key, tokenName)     => MapKeyPart(subPart, subPartName, key)
          case AccessRandom                  => RandomPart(subPart, subPartName)
          case AccessSize                    => SizePart(subPart, subPartName)
          case AccessExists                  => ExistsPart(subPart, subPartName)
          case AccessIsUndefined             => IsUndefinedPart(subPart, subPartName)
          case AccessJSONStringify           => JsonStringify(subPart, subPartName)
          case AccessTuple(index, tokenName) => TupleAccessPart(subPart, subPartName, index.toInt)
        }

        val newPartName = subPartName + token.token
        part -> newPartName
      })

      part
  }) | emptyAttribute

  def objectName: Parser[AttributePart] = NameRegex ^^ { case name => AttributePart(name) }

  def functionAccess(access: AccessFunction) = access.token ^^ { case _ => access }

  def valueAccess =
    tupleAccess |
      indexAccess |
      functionAccess(AccessRandom) |
      functionAccess(AccessSize) |
      functionAccess(AccessExists) |
      functionAccess(AccessIsUndefined) |
      functionAccess(AccessJSONStringify) |
      keyAccess |
      (elExpr ^^ { case _ => throw new Exception("nested attribute definition is not allowed") })

  def indexAccess: Parser[AccessToken] = "(" ~> NameRegex <~ ")" ^^ { case posStr => AccessIndex(posStr, s"($posStr)") }

  def keyAccess: Parser[AccessToken] = "." ~> NameRegex ^^ { case keyName => AccessKey(keyName, "." + keyName) }

  def tupleAccess: Parser[AccessTuple] = "._" ~> "[0-9]+".r ^^ { case indexPart => AccessTuple(indexPart, "._" + indexPart) }

  def emptyAttribute: Parser[Part[Any]] = "" ^^ { case _ => throw new Exception("attribute name is missing") }
}


text:
from __future__ import absolute_import  # NOQA
"""This module implements Swak input plugin of Dummy."""

import click

from swak.plugin import RecordInput

class Dummy(RecordInput):
    """Dummy class."""

    def __init__(self, record, max_count=3):
        """Init.

        Args:
            record (dict): A user input record.
            max_count (int): Maximum count to input.
        """
        super(RecordInput, self).__init__()
        self.record = record
        self.max_count = max_count
        self.count = 0

    def generate_record(self):
        """Generate records.

        Note: This function can be written in synchronous or asynchronous
         manner. But flushing with time interval does not work if this function
         is blocking. To guarantee flushing with time interval work, return an
         empty record in blocking situations.

        Yields:
            dict: A record.
        """
        for i in range(self.max_count):
            yield self.record

@click.command(help="Generate user input as dummy event.")
@click.argument('record')
@click.option('-c', '--count', help="Counter to repeat dummy record.")
@click.pass_context
def main(ctx, record, count):
    """Plugin entry."""
    return Dummy(record, count)

if __name__ == '__main__':
    main()


text:
+ **In memory of Joe Armstrong** (@joeerl), creator of `erlang`
  + Why do we need modules at all? - http://erlang.org/pipermail/erlang-questions/2011-May/058768.html
  + [video] The Mess We're In - https://www.youtube.com/watch?v=lKXe3HUG2l4

+ Dave Sullivan, **Agile Lite** - https://github.com/davebs/AgileLite
+ Cody Lindley, **JavaScript Enlightenment *updated for ES-2015+*** - https://frontendmasters.com/books/javascript-enlightenment/

+ **Accessibility**

  + Adrian Roselli, **Avoid Messages Under Fields** - http://adrianroselli.com/2017/01/avoid-messages-under-fields.html
  + Matt Reyer, **Developing a JavaScript-free Frontend** - https://javascript.works-hub.com/learn/a-javascript-free-frontend-61275
  + Brad Frost, **Enforcing Accessibility Best Practices with Automatically-Generated IDs** - http://bradfrost.com/blog/post/enforcing-accessibility-best-practices-with-automatically-generated-ids/

+ **Other good stuff**

  + Sebastiano Guerriero, Theme-switching with CSS custom properties (variables) - https://codyhouse.co/blog/post/dark-light-switch-css-javascript
  + Avik Das, A graphical introduction to **dynamic programming** - https://avikdas.com/2019/04/15/a-graphical-introduction-to-dynamic-programming.html
  + Iven Marquardt, **Taming the DOM** - https://medium.com/@iquardt/taming-the-dom-50c8f1a6e892
    - (gist) Functional Reactive Programming **(FRP)** implemented with a couple rules, types and combinators - https://gist.github.com/ivenmarquardt/9f9d53e2469b3df438f3628297e2dc9f
  + Bret Cameron, Useful tips for writing more concise and performant JavaScript - https://medium.com/@bretcameron/12-javascript-tricks-you-wont-find-in-most-tutorials-a9c9331f169d

+ **Monorepos**

  + Michal Zalecki, **Solve code sharing and setup project with Lerna and monorepo** - https://michalzalecki.com/solve-code-sharing-and-setup-project-with-lerna-and-monorepo/ - this one uses `lerna` and `create-react-app` - *good, fast, **and** cheap*
  + Markus Oberlehner, Monorepos in the Wild - https://medium.com/@maoberlehner/monorepos-in-the-wild-33c6eb246cb9
  + John Tucker, Monorepos by Example:
    + Part 1 - https://codeburst.io/monorepos-by-example-part-1-3a883b49047e
    + Part 2 - https://codeburst.io/monorepos-by-example-part-2-4153712cfa31
    + Part 3 - https://codeburst.io/monorepos-by-example-part-3-1ebdea7ccbea
  + `Lerna`, A tool for managing JavaScript projects with multiple packages - https://github.com/lerna/lerna
    + sidebar on `npm-scope` - https://docs.npmjs.com/misc/scope
  + Andrico Karoulla, Develop and Deploy your own React monorepo app in under 2 hours, using Lerna, Travis and Now. - https://codeburst.io/develop-and-deploy-your-own-react-monorepo-app-in-under-2-hours-using-lerna-travis-and-now-2b140d647238
    + git repo: Lerna Monorepo Article (Starter) - https://github.com/andrico1234/lerna-monorepo-finisher

+ M.J. Parnell, ***The use of "science" (or "best practices" or "it's a standard") as a superficial lacquer designed to impress (or silence), with scant regard for truth, has only one description: bullshit.*** - http://mjparnell.com/bullshit_science_ux_design/ - fire the pretentious dilettante charlatans who know they can't bullshit you but still do it anyway, hoping you'll shut up and do as you're told.

+ **Examples of Bullshit with Harmful Consequences**

  + **Liferay** 7 + React (JS)

    + Portlet API - http://portals.apache.org/pluto/portlet-1.0-apidocs/
    + **Deploy jar files into running docker instance of liferay** - https://stackoverflow.com/questions/46434606/how-to-deploy-the-jar-files-into-liferay-running-on-docker-from-local-machine
    + **Sharing session data across portlets** - https://community.liferay.com/blogs/-/blogs/how-can-i-share-session-data-across-portlets-in-liferay-
    + Search for **"map LDAP"** - https://liferay4all.blogspot.com/
    + Customize liferay **navigation** (persist) - https://community.liferay.com/forums/-/message_boards/message/94612790
    + A Liferay JavaScript portlet to speed up development - https://github.com/hannikkala/liferay-javascript-portlet
    + Alexander Konovalov, Liferay 7 + React JS (or anyone other JS framework) - https://medium.com/@s2dent/liferay-7-react-js-or-anyone-other-js-framework-cb7193f6dbfa
    + Liferay npm bundler - https://community.liferay.com/it/blogs/-/blogs/why-we-need-a-new-liferay-npm-bundler-2-of-3-

  + React/JSX, Redux...:

    + Anton Lavrenov (@lavrton), **Optimizing react-redux store for high performance updates** - https://lavrton.com/optimizing-react-redux-store-for-high-performance-updates-3ae6f7f1e4c1/
    + Alex Gilleran, JSX Control Statements - https://github.com/AlexGilleran/jsx-control-statements - (JSTL/XSLT tags but for the browser, so it's "cool" now)
    + Matt Crowder, `mapToDispatchProps` - https://dev.to/mcrowder65/you-ve-been-doing-mapdispatchtoprops-wrong-this-entire-time-582m
    + Koen Bok, ES6 / React Cheatsheet - https://paper.dropbox.com/doc/ES6-React-Cheatsheet-Th7joG9fFSSiyZgOFYqj6

  + JSX alternatives:

    - `react-hyperscript` - https://github.com/mlmorg/react-hyperscript
    - `htm` by Jason Miller (@\_developit) - https://github.com/developit/htm - do it at build time, or on the server...
    - `ijk` - https://github.com/lukejacksonn/ijk

  + React alternatives:

    - preact by @\_developit - https://preactjs.com/
    - **hyperapp** (version coming soon) - https://github.com/jorgebucaran/hyperapp

  + React application testing

    + @Raathigesh, `Majestic`, Zero Config desktop UI for Jest - https://majestic.debuggable.io/ - electron app, pretty snazzy
    + Dominic Frazer, Testing React with Jest and Enzyme:
      + Part I - https://medium.com/codeclan/testing-react-with-jest-and-enzyme-20505fec4675
      + Part II - https://codeburst.io/testing-react-events-with-jest-and-enzyme-ii-46fbe4b8b589
    + Dominic Frazer, Mocking HTTP requests with Nock - https://codeburst.io/testing-mocking-http-requests-with-nock-480e3f164851
    + Vijay Thirugnanam, Unit Testing React Components: Jest or Enzyme? - https://www.codementor.io/vijayst/unit-testing-react-components-jest-or-enzyme-du1087lh8
    + Kent C. Dodds, `react-testing-library` - https://github.com/kentcdodds/react-testing-library
    + Matt Crowder, How to test implementation details with react-testing-library - https://dev.to/mcrowder65/how-to-test-implementation-details-with-react-testing-library-4bln


text:
package io.qameta.allure.category;

import io.qameta.allure.entity.TestResult;
import io.qameta.allure.trend.TrendItem;

import java.util.ArrayList;
import java.util.List;

/**
 * @author charlie (Dmitry Baev).
 */
public class CategoriesTrendItem extends TrendItem {

    public void increaseCategories(final TestResult result) {
        result.<List<Category>>getExtraBlock("categories", new ArrayList<>()).stream()
                .map(Category::getName)
                .forEach(this::increaseCategories);
    }

    private void increaseCategories(final String name) {
        increaseMetric(name);
    }

}


text:
package main

import (
	"log"
	"os"

	"gopkg.in/gcfg.v1"

	"github.com/bluedevel/mosel/moseld/server"
	"github.com/bluedevel/mosel/config"
)

func main() {

	config, err := loadConfig()

	if err != nil {
		log.Fatal(err)
		os.Exit(1)
	}

	server := moseldserver.NewMoseldServer(*config)
	log.Fatal(server.Run())
}

func loadConfig() (*moselconfig.MoseldServerConfig, error) {
	config := new(moselconfig.MoseldServerConfig)
	err := gcfg.ReadFileInto(config, "/etc/mosel/moseld.conf")
	return config, err
}


text:
package YAJSL.Swing.Beans;

import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.imageio.ImageIO;
import javax.swing.SwingConstants;

/**
 *
 * @author Giuseppe Gallo
 */
public class ImagePanel extends javax.swing.JPanel {

    /** The image shown */
    protected BufferedImage image = null;

    /** The scaled image shown */
    protected Image scaledImage = null;

    /** The previous scale of the image */
    protected float prevScale = 0;

    /** The scaled width of the image */
    protected int scaledSizeX = 1;

    /** The scaled height of the image */
    protected int scaledSizeY = 1;

    /** True if the image is valid */
    protected boolean valid = true;

    /** The rendering hints used for diplaying the image */
    protected Map<RenderingHints.Key,Object> renderingHints = null;

    /** The title of the image */
    protected String title = null;

    /** The font of the title of the image */
    protected Font titleFont = null;

    /** The color of the title of the image */
    protected Color titleColor = Color.BLACK;

    /** The horizontal alignment for the title of the image */
    protected int horizontalTitleAlignment = SwingConstants.CENTER;

    /** The vertical alignment for the title of the image */
    protected int verticalTitleAlignment = SwingConstants.CENTER;

    /** The size of the upper curtain (in %) */
    protected float upperCurtainSize = 0f;

    /** The size of the lower curtain (in %) */
    protected float lowerCurtainSize = 0f;

    /** The color of the curtains */
    protected Color curtainColor = Color.DARK_GRAY;

    /** The opacity of the curtains */
    protected float curtainOpacity = 0.5f;

    /** True if the curtains are shown */
    protected boolean curtainShown = false;

    /** The color to be used when the image is invalid */
    protected Color invalidColor = Color.GRAY;

    /** True if the zoom circle is enabled. The zoom circle displays at 100% the area around the mouse cursor. */
    protected boolean zoomEnabled = false;

    /** The position of the mouse cursor */
    protected Point mouseXY = null;

    /** The size of the zoom circle. The zoom circle displays at 100% the area around the mouse cursor. */
    protected float zoomCircleSize = 0.5f;

    /** The color of the outline of the zoom circle. The zoom circle displays at 100% the area around the mouse cursor. */
    protected Color zoomCircleColor = Color.BLACK;

    /** The size of the outline of the zoom circle. The zoom circle displays at 100% the area around the mouse cursor. */
    protected int zoomCircleLineSize = 4;

    /**
     * Default constructor
     */
    public ImagePanel() {
        initComponents();

        // Init rendering hints
        renderingHints = new HashMap<>();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabelTitle = new javax.swing.JLabel();

        jLabelTitle.setFont(titleFont);
        jLabelTitle.setForeground(titleColor);
        jLabelTitle.setHorizontalAlignment(horizontalTitleAlignment);
        jLabelTitle.setText(title);
        jLabelTitle.setVerticalAlignment(verticalTitleAlignment);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabelTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabelTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabelTitle;
    // End of variables declaration//GEN-END:variables

    /**
     * If the zoon is enabled, displays the zoom circle showing at 100%
     * zoom the area around the specified point.
     *
     * @param zoomXY  the center of the area to be zoomed
     */
    public void zoomAt(Point zoomXY) {
        mouseXY = zoomXY;
        if (zoomEnabled) repaint();
    }

    /**
     * Returns the rendering hints used for displaying the image.
     *
     * @return   the rendering hints used for displaying the image
     */
    public Map<?,?> getRenderingHints() {
        return renderingHints;
    }

    /**
     * Sets the rendering hints used for displaying the image.
     *
     * @param hints   the rendering hints to be used for displaying the image
     */
    public void setRenderingHints(Map<RenderingHints.Key,Object> hints) {
        renderingHints = hints;
    }

    /**
     * Sets a rendering hint used for displaying the image.
     *
     * @param key   the rendering key to be set
     * @param hint  the rendering hint to be set
     */
    public void setRenderingHint(RenderingHints.Key key, Object hint) {
        renderingHints.put(key, hint);
    }

    /**
     * Returns the title of the image.
     *
     * @return   the title of the image
     */
    public String getTitle() {
        return title;
    }

    /**
     * Sets the title of the image.
     *
     * @param title   the title for the image
     */
    public void setTitle(String title) {
        this.title = title;
        if (jLabelTitle != null) jLabelTitle.setText(title);
        repaint();
    }

    /**
     * Returns the horizontal alignment of the image title.
     *
     * @return   the horizontal alignment of the image title
     */
    public int getHorizontalTitleAlignment() {
        return horizontalTitleAlignment;
    }

    /**
     * Sets the horizontal alignment of the image title.
     *
     * @param horizontalTitleAlignment   the horizontal alignment for the image title
     */
    public void setHorizontalTitleAlignment(int horizontalTitleAlignment) {
        this.horizontalTitleAlignment = horizontalTitleAlignment;
        if (jLabelTitle != null) jLabelTitle.setHorizontalAlignment(horizontalTitleAlignment);
        if (title != null) repaint();
    }

    /**
     * Returns the vertical alignment of the image title.
     *
     * @return   the vertical alignment of the image title
     */
    public int getVerticalTitleAlignment() {
        return verticalTitleAlignment;
    }

    /**
     * Sets the vertical alignment of the image title.
     *
     * @param verticalTitleAlignment   the vertical alignment for the image title
     */
    public void setVerticalTitleAlignment(int verticalTitleAlignment) {
        this.verticalTitleAlignment = verticalTitleAlignment;
        if (jLabelTitle != null) jLabelTitle.setVerticalAlignment(verticalTitleAlignment);
        if (title != null) repaint();
    }

    /**
     * Returns the color of the image title
     *
     * @return   the color of the image title
     */
    public Color getTitleColor() {
        return titleColor;
    }

    /**
     * Sets the color of the image title.
     *
     * @param titleColor   the color for the image title
     */
    public void setTitleColor(Color titleColor) {
        this.titleColor = titleColor;
        if (jLabelTitle != null) jLabelTitle.setForeground(titleColor);
        if (title != null) repaint();
    }

    /**
     * Returns the font of the image title.
     *
     * @return   the font of the image title
     */
    public Font getTitleFont() {
        return titleFont;
    }

    /**
     * Sets the font of the image title.
     *
     * @param titleFont   the font for the image title
     */
    public void setTitleFont(Font titleFont) {
        this.titleFont = titleFont;
        if (jLabelTitle != null) jLabelTitle.setFont(titleFont);
        if (title != null) repaint();
    }

    /**
     * Returns the color of the cross shown when an invalid image is loaded.
     *
     * @return   the color of the cross shown when an invalid image is loaded
     */
    public Color getInvalidColor() {
        return invalidColor;
    }

    /**
     * Sets the color of the cross shown when an invalid image is loaded.
     *
     * @param invalidColor   the color for the cross shown when an invalid image is loaded
     */
    public void setInvalidColor(Color invalidColor) {
        this.invalidColor = invalidColor;
        if (!valid) repaint();
    }

    /**
     * Returns the color of the "curtains" used to restrict the view to a particular
     * section of the image.
     *
     * @return   the color of the "curtains" used to restrict the view to a particular
     *           section of the image
     */
    public Color getCurtainColor() {
        return curtainColor;
    }

    /**
     * Sets the color of the "curtains" used to restrict the view to a particular
     * section of the image.
     *
     * @param curtainColor   the color for the "curtains" used to restrict the view
     *                       to a particular section of the image
     */
    public void setCurtainColor(Color curtainColor) {
        this.curtainColor = curtainColor;
        if (curtainShown) repaint();
    }

    /**
     * Returns the opacity (from 0 = transparent to 1 = opaque) of the "curtains"
     * used to restrict the view to a particular section of the image.
     *
     * @return   the opacity (from 0 = transparent to 1 = opaque) of the "curtains"
     *           used to restrict the view to a particular section of the image
     */
    public float getCurtainOpacity() {
        return curtainOpacity;
    }

    /**
     * Sets the opacity (from 0 = transparent to 1 = opaque) of the "curtains"
     * used to restrict the view to a particular section of the image.
     *
     * @param curtainOpacity   the opacity (from 0 = transparent to 1 = opaque)
     *                         for the "curtains" used to restrict the view to a
     *                         particular section of the image
     */
    public void setCurtainOpacity(float curtainOpacity) {
        this.curtainOpacity = curtainOpacity;
        if (curtainShown) repaint();
    }

    /**
     * Returns the size (in % of the image height) of the lower "curtain".
     *
     * @return   the size (in % of the image height) of the lower "curtain"
     */
    public float getLowerCurtainSize() {
        return lowerCurtainSize;
    }

    /**
     * Sets the size (in % of the image height) of the lower "curtain".
     *
     * @param lowerCurtainSize   the size (in % of the image height) for
     *                           the lower "curtain"
     */
    public void setLowerCurtainSize(float lowerCurtainSize) {
        this.lowerCurtainSize = lowerCurtainSize;
        if (curtainShown) repaint();
    }

    /**
     * Returns the size (in % of the image height) of the upper "curtain".
     *
     * @return   the size (in % of the image height) of the upper "curtain"
     */
    public float getUpperCurtainSize() {
        return upperCurtainSize;
    }

    /**
     * Sets the size (in % of the image height) of the upper "curtain".
     *
     * @param upperCurtainSize  the size (in % of the image height) of the upper "curtain".
     */
    public void setUpperCurtainSize(float upperCurtainSize) {
        this.upperCurtainSize = upperCurtainSize;
        if (curtainShown) repaint();
    }

    /**
     * Returns true if the curtains are shown.
     *
     * @return  true if the curtains are shown
     */
    public boolean isCurtainShown() {
        return curtainShown;
    }

    /**
     * Sets if the curtains need to be shown.
     *
     * @param curtainShown  true if the curtains need to be shown
     */
    public void setCurtainShown(boolean curtainShown) {
        this.curtainShown = curtainShown;
        repaint();
    }

    /**
     * Returns true if the zoom circle is enabled.
     *
     * @return  true if the zoom circle is enabled
     */
    public boolean isZoomEnabled() {
        return zoomEnabled;
    }

    /**
     * Sets if the zoom circle is enabled.
     *
     * @param zoomEnabled  true if the zoom circle needs to be enabled
     */
    public void setZoomEnabled(boolean zoomEnabled) {
        this.zoomEnabled = zoomEnabled;
        repaint();
    }

    /**
     * Returns the color of the outline of the zoom circle. The zoom circle displays at 100% the area around the mouse cursor.
     *
     * @return  the color of the outline of the zoom circle
     */
    public Color getZoomCircleColor() {
        return zoomCircleColor;
    }

    /**
     * Sets the color of the outline of the zoom circle. The zoom circle displays at 100% the area around the mouse cursor.
     *
     * @param zoomCircleColor  the color of the outline of the zoom circle
     */
    public void setZoomCircleColor(Color zoomCircleColor) {
        this.zoomCircleColor = zoomCircleColor;
        if (zoomEnabled) repaint();
    }

    /**
     * Returns the size of the zoom circle. The zoom circle displays at 100% the area around the mouse cursor.
     *
     * @return  the size of the zoom circle
     */
    public float getZoomCircleSize() {
        return zoomCircleSize;
    }

    /**
     * Sets the size of the zoom circle. The zoom circle displays at 100% the area around the mouse cursor.
     *
     * @param zoomCircleSize  the size of the zoom circle
     */
    public void setZoomCircleSize(float zoomCircleSize) {
        this.zoomCircleSize = zoomCircleSize;
        if (zoomEnabled) repaint();
    }

    /**
     * Calculates the size of the scaled image.
     */
    protected void calculateScale() {
        int cmpSizeX = getSize().width - getInsets().left - getInsets().right;
        int cmpSizeY = getSize().height - getInsets().top - getInsets().bottom;

        if (image != null) {
            int imgSizeX = image.getWidth();
            int imgSizeY = image.getHeight();

            float cmpRatio = (float)cmpSizeX/(float)cmpSizeY;
            float imgRatio = (float)imgSizeX/(float)imgSizeY;

            float scale;
            if (cmpRatio > imgRatio) {
                scale = (float)cmpSizeY/(float)imgSizeY;
            } else {
                scale = (float)cmpSizeX/(float)imgSizeX;
            }

            scaledSizeX = (int)Math.floor(imgSizeX*scale);
            scaledSizeY = (int)Math.floor(imgSizeY*scale);
        } else {
            prevScale = 0;
            scaledSizeX = cmpSizeX;
            scaledSizeY = cmpSizeY;
        }
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

        Graphics2D g2d = (Graphics2D) g;
        int cmpSizeX = getSize().width - getInsets().left - getInsets().right;
        int cmpSizeY = getSize().height - getInsets().top - getInsets().bottom;
        int imgSizeX;
        int imgSizeY;
        scaledSizeX = cmpSizeX;
        scaledSizeY = cmpSizeY;
        float scale = 1;

        if (image != null) {
            imgSizeX = image.getWidth();
            imgSizeY = image.getHeight();
            int posX = getInsets().left;
            int posY = getInsets().top;

            float cmpRatio = (float)cmpSizeX/(float)cmpSizeY;
            float imgRatio = (float)imgSizeX/(float)imgSizeY;

            if (cmpRatio > imgRatio) {
                scale = (float)cmpSizeY/(float)imgSizeY;
                posX += (int)Math.floor((cmpSizeX - imgSizeX*scale)/2);
            } else {
                scale = (float)cmpSizeX/(float)imgSizeX;
                posY += (int)Math.floor((cmpSizeY - imgSizeY*scale)/2);
            }

            scaledSizeX = (int)Math.floor(imgSizeX*scale);
            scaledSizeY = (int)Math.floor(imgSizeY*scale);

            if (scale != prevScale || scaledImage == null) {
                scaledImage = image.getScaledInstance(scaledSizeX, scaledSizeY, Image.SCALE_SMOOTH);
                prevScale = scale;
            }

            g2d.setRenderingHints(renderingHints);
            g2d.drawImage(scaledImage, posX, posY, null);
        }

        if (!valid) {
            g2d.setColor(invalidColor);
            g2d.setStroke(new BasicStroke(Math.min(cmpSizeX, cmpSizeY)/20));
            g2d.setClip(getInsets().left, getInsets().top, cmpSizeX, cmpSizeY);
            g2d.drawLine(getInsets().left, getInsets().top, getInsets().left + cmpSizeX, getInsets().top + cmpSizeY);
            g2d.drawLine(getInsets().left, getInsets().top + cmpSizeY, getInsets().left + cmpSizeX, getInsets().top);
        }

        if (curtainShown) {
            g2d.setColor(curtainColor);
            g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, curtainOpacity));
            int border = (cmpSizeY - scaledSizeY)/2;
            int ucSize = (int)Math.floor(upperCurtainSize*scaledSizeY) + border;
            int lcSize = (int)Math.floor(lowerCurtainSize*scaledSizeY) + border;
            g2d.fillRect(getInsets().left, getInsets().top, cmpSizeX, ucSize);
            g2d.fillRect(getInsets().left, getInsets().top + cmpSizeY - lcSize, cmpSizeX, lcSize);
            g2d.setComposite(AlphaComposite.SrcAtop);
        }

        if (image != null && zoomEnabled && mouseXY != null) {
            int circleSize = (int)Math.floor(Math.min(cmpSizeX, cmpSizeY)*this.zoomCircleSize);
            g2d.setColor(zoomCircleColor);
            g2d.setStroke(new BasicStroke(zoomCircleLineSize));

            int minX = (cmpSizeX - scaledSizeX)/2;
            int minY = (cmpSizeY - scaledSizeY)/2;
            int maxX = cmpSizeX - minX;
            int maxY = cmpSizeY - minY;

            int mx = (mouseXY.x < minX) ? minX : (mouseXY.x > maxX) ? maxX : mouseXY.x;
            int my = (mouseXY.y < minY) ? minY : (mouseXY.y > maxY) ? maxY : mouseXY.y;

            // Calculate where to show the circle depending on the mouse position
            int cx = getInsets().left + ((mx >= getSize().width/2) ? zoomCircleLineSize : cmpSizeX - circleSize - zoomCircleLineSize);
            int cy = getInsets().top + ((my >= getSize().height/2) ? zoomCircleLineSize : cmpSizeY - circleSize - zoomCircleLineSize);

            // Draw the circle
            Ellipse2D.Float circle = new Ellipse2D.Float(cx, cy, circleSize, circleSize);
            g2d.draw(circle);
            g2d.setColor(getBackground());
            g2d.fill(circle);

            // Draw the zoomed image inside the circle
            int imgX = (int)Math.floor((mx - minX)/scale);
            int imgY = (int)Math.floor((my - minY)/scale);
            g2d.clip(circle);
            g2d.drawImage(image, AffineTransform.getTranslateInstance(circle.getCenterX() - imgX, circle.getCenterY() - imgY), null);
        }
    }

    /**
     * Loads the image from the given file name.
     *
     * @param fileName  the name of the file from which the image needs to be loaded
     */
    public void loadImage(String fileName) {
        loadImage((fileName == null) ? null : new File(fileName));
    }

    /**
     * Sets the image to be shown.
     *
     * @param img  the image to be shown
     */
    public void setImage(BufferedImage img) {
        prevScale = 0;
        scaledImage = null;
        image = img;
        repaint();
    }

    /**
     * Loads the image from the given file.
     *
     * @param file  the file from which the image needs to be loaded
     */
    public void loadImage(File file) {
        if (file == null) {
            image = null;
            valid = true;
        } else {
            try {
                image = ImageIO.read(file);
                valid = true;
            } catch (IOException ex) {
                image = null;
                valid = false;
            }
        }
        scaledImage = null;
        prevScale = 0;
        repaint();
    }

    /**
     * Returns the aspect ratio of this component.
     *
     * @return  the aspect ratio of this component
     */
    public float getRatio() {
        float cmpSizeX = getSize().width - getInsets().left - getInsets().right;
        float cmpSizeY = getSize().height - getInsets().top - getInsets().bottom;

        return (cmpSizeY == 0) ? 0 : cmpSizeX/cmpSizeY;
    }
}


text:
{% extends "andablog/base.html" %}
{% load andablog_tags %}

{% block andablog_meta %}
    <meta name="description" content="Latest blog entries">
{% endblock %}

{% block andablog_page_title %}
    Latest Blog Entries
{% endblock %}

{% block andablog_content %}
    {% for entry in entries %}

{{ entry.title }}{% if not entry.is_published %} Draft{% endif %}

{{ entry.published_timestamp|date:"DATE_FORMAT" }}{% if entry.author %} by {{ entry.author|authordisplay }}{% endif %}

                        {% if entry.preview_content %}
                            {% if entry.preview_image %}

                            {% endif %}
                            {{ entry.preview_content }}
                        {% else %}
                            {# Truncate derived from: Avg reading speed (3.33 words/s) * Average attention span (8s) #}
                            {{ entry.content|truncatewords_html:26 }} (More...) {% include "andablog/comments_count_snippet.html" with comment_object=entry %}
                        {% endif %}

    {% endfor %}

    {% include "andablog/pagination_snippet.html" with page_obj=page_obj %}
{% endblock %}


text:
import mock

from quantum.tests.unit import test_db_plugin as test_plugin

class RyuPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):

    _plugin_name = 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2'

    def _patch_fake_ryu_client(self):
        ryu_mod = mock.Mock()
        ryu_app_mod = ryu_mod.app
        ryu_app_client = ryu_app_mod.client
        rest_nw_id = ryu_app_mod.rest_nw_id
        rest_nw_id.NW_ID_EXTERNAL = '__NW_ID_EXTERNAL__'
        rest_nw_id.NW_ID_UNKNOWN = '__NW_ID_UNKNOWN__'
        return mock.patch.dict('sys.modules',
                               {'ryu': ryu_mod,
                                'ryu.app': ryu_app_mod,
                                'ryu.app.client': ryu_app_client,
                                'ryu.app.rest_nw_id': rest_nw_id})

    def setUp(self):
        self.ryu_patcher = self._patch_fake_ryu_client()
        self.ryu_patcher.start()
        super(RyuPluginV2TestCase, self).setUp(self._plugin_name)

class TestRyuBasicGet(test_plugin.TestBasicGet, RyuPluginV2TestCase):
    pass

class TestRyuV2HTTPResponse(test_plugin.TestV2HTTPResponse,
                            RyuPluginV2TestCase):
    pass

class TestRyuPortsV2(test_plugin.TestPortsV2, RyuPluginV2TestCase):
    pass

class TestRyuNetworksV2(test_plugin.TestNetworksV2, RyuPluginV2TestCase):
    pass

class TestRyuSubnetsV2(test_plugin.TestSubnetsV2, RyuPluginV2TestCase):
    pass


text: export default (...args) => a => args.reduceRight((acc, func) => func(acc), a)


text:
"""dblog URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from blog.views import index, about, detail, blogcontent, blog, archives, category, search
from upload.views import upload

admin.autodiscover()

urlpatterns = [
    url(r'^grappelli/', include('grappelli.urls')),
    url(r'^admin/', admin.site.urls),
    url(r'^index/', index, name='index'),
    url(r'^about/', about, name='about'),
    url(r'^$', blogcontent, name='blogcontent'),
    url(r'^blogindex/(?P<id>\d+)/', detail, name='detail'),
    url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$',archives, name='archives'),
    url(r'^category/(?P<pk>[0-9]+)/$',category, name='category'),
    url(r'^search/$', search,name='search'),
    url(r'^upload/', upload,name='upload'),

]