text:
module Azure::Monitor::Mgmt::V2018_03_01
  #
  # Monitor Management Client
  #
  class ActionGroups
    include MsRestAzure

    #
    # Creates and initializes a new instance of the ActionGroups class.
    # @param client service class for accessing basic functionality.
    #
    def initialize(client)
      @client = client
    end

    # @return [MonitorManagementClient] reference to the MonitorManagementClient
    attr_reader :client

    #
    # Create a new action group or update an existing one.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param action_group [ActionGroupResource] The action group to create or use
    # for the update.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ActionGroupResource] operation results.
    #
    def create_or_update(resource_group_name, action_group_name, action_group, custom_headers:nil)
      response = create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Create a new action group or update an existing one.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param action_group [ActionGroupResource] The action group to create or use
    # for the update.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def create_or_update_with_http_info(resource_group_name, action_group_name, action_group, custom_headers:nil)
      create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers:custom_headers).value!
    end

    #
    # Create a new action group or update an existing one.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param action_group [ActionGroupResource] The action group to create or use
    # for the update.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers:nil)
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
      fail ArgumentError, 'action_group is nil' if action_group.nil?
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
      request_content = @client.serialize(request_mapper,  action_group)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
          query_params: {'api-version' => @client.api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:put, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 201
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end
        # Deserialize Response
        if status_code == 201
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Get an action group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ActionGroupResource] operation results.
    #
    def get(resource_group_name, action_group_name, custom_headers:nil)
      response = get_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get an action group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def get_with_http_info(resource_group_name, action_group_name, custom_headers:nil)
      get_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
    end

    #
    # Get an action group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def get_async(resource_group_name, action_group_name, custom_headers:nil)
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Delete an action group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def delete(resource_group_name, action_group_name, custom_headers:nil)
      response = delete_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
      nil
    end

    #
    # Delete an action group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def delete_with_http_info(resource_group_name, action_group_name, custom_headers:nil)
      delete_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
    end

    #
    # Delete an action group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def delete_async(resource_group_name, action_group_name, custom_headers:nil)
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:delete, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 204
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Updates an existing action group's tags. To update other fields use the
    # CreateOrUpdate method.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param action_group_patch [ActionGroupPatchBody] Parameters supplied to the
    # operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ActionGroupResource] operation results.
    #
    def update(resource_group_name, action_group_name, action_group_patch, custom_headers:nil)
      response = update_async(resource_group_name, action_group_name, action_group_patch, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Updates an existing action group's tags. To update other fields use the
    # CreateOrUpdate method.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param action_group_patch [ActionGroupPatchBody] Parameters supplied to the
    # operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def update_with_http_info(resource_group_name, action_group_name, action_group_patch, custom_headers:nil)
      update_async(resource_group_name, action_group_name, action_group_patch, custom_headers:custom_headers).value!
    end

    #
    # Updates an existing action group's tags. To update other fields use the
    # CreateOrUpdate method.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param action_group_patch [ActionGroupPatchBody] Parameters supplied to the
    # operation.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def update_async(resource_group_name, action_group_name, action_group_patch, custom_headers:nil)
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, 'action_group_patch is nil' if action_group_patch.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupPatchBody.mapper()
      request_content = @client.serialize(request_mapper,  action_group_patch)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name},
          query_params: {'api-version' => @client.api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:patch, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Get a list of all action groups in a subscription.
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ActionGroupList] operation results.
    #
    def list_by_subscription_id(custom_headers:nil)
      response = list_by_subscription_id_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get a list of all action groups in a subscription.
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_by_subscription_id_with_http_info(custom_headers:nil)
      list_by_subscription_id_async(custom_headers:custom_headers).value!
    end

    #
    # Get a list of all action groups in a subscription.
    #
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_by_subscription_id_async(custom_headers:nil)
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupList.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Get a list of all action groups in a resource group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [ActionGroupList] operation results.
    #
    def list_by_resource_group(resource_group_name, custom_headers:nil)
      response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get a list of all action groups in a resource group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
      list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
    end

    #
    # Get a list of all action groups in a resource group.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_by_resource_group_async(resource_group_name, custom_headers:nil)
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupList.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Enable a receiver in an action group. This changes the receiver's status from
    # Disabled to Enabled. This operation is only supported for Email or SMS
    # receivers.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param enable_request [EnableRequest] The receiver to re-enable.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def enable_receiver(resource_group_name, action_group_name, enable_request, custom_headers:nil)
      response = enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers:custom_headers).value!
      nil
    end

    #
    # Enable a receiver in an action group. This changes the receiver's status from
    # Disabled to Enabled. This operation is only supported for Email or SMS
    # receivers.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param enable_request [EnableRequest] The receiver to re-enable.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def enable_receiver_with_http_info(resource_group_name, action_group_name, enable_request, custom_headers:nil)
      enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers:custom_headers).value!
    end

    #
    # Enable a receiver in an action group. This changes the receiver's status from
    # Disabled to Enabled. This operation is only supported for Email or SMS
    # receivers.
    #
    # @param resource_group_name [String] The name of the resource group.
    # @param action_group_name [String] The name of the action group.
    # @param enable_request [EnableRequest] The receiver to re-enable.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers:nil)
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
      fail ArgumentError, 'enable_request is nil' if enable_request.nil?
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::EnableRequest.mapper()
      request_content = @client.serialize(request_mapper,  enable_request)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
          query_params: {'api-version' => @client.api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 409
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

  end
end


text:
require 'json_cli/version'
require 'json_cli/cli'
require 'json_cli/command/base'
require 'json_cli/command/join'
require 'json_cli/command/unwind'

# Base module
module JsonCli
end

redpajama_set_name: RedPajamaGithub


text:
Phone

                Type
                <select id="phone-event-types" class="ui-state-default ui-corner-all"></select>

                Call id
                <input id="phone-call-id" type="text" class="ui-state-default ui-corner-all">

                Error
                <select id="phone-event-error-types" class="ui-state-default ui-corner-all"></select>

                    <button id="phone-logs-clear" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
                        Clear Logs
                    </button>

                    <button id="phone-event-send" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
                        Fire Event
                    </button>


text:
module SpreePromoVariantRule
  class Engine < Rails::Engine
    require 'spree/core'
    isolate_namespace Spree
    engine_name 'spree_promo_variant_rule'

    config.autoload_paths += %W(#{config.root}/lib)

    # use rspec for tests
    config.generators do |g|
      g.test_framework :rspec
    end

    def self.activate
      Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end
    end

    initializer 'spree.promo.register.promotions.rules', after: 'spree.promo.register.promotions.actions' do |app|
      app.config.spree.promotions.rules << Spree::Promotion::Rules::Variant
    end

    config.to_prepare &method(:activate).to_proc
  end
end


text:
<?php

class HtmlTaglineSiteConfigTest extends SapphireTest
{
    public function testUpdateCMSFields()
    {
        $siteConfig = new SiteConfig();
        $fields = $siteConfig->getCMSFields();
        $tab = $fields->findOrMakeTab('Root.Main');
        $fields = $tab->fieldList();
        $names = array();
        foreach ($fields as $field) {
            array_push($names, $field->getName());
        }
        error_log(print_r($names,1));

        // Check that TagLine has been replaced by HTMLTagLine
        $this->assertContains('HTMLTagLine', $names);
        $this->assertNotContains('TagLine', $names);
    }

    public function testPopulateDefaults()
    {
        $siteConfig = new SiteConfig();
        $siteConfig->populateDefaults();
        $fields = $siteConfig->getCMSFields();
        $tab = $fields->findOrMakeTab('Root.Main');
        $fields = $tab->fieldList();
        $value = $fields->fieldByName('HTMLTagLine')->value();
        $this->assertEquals('
your tagline here
', $value);
    }
}


text:
@interface THQueue : NSObject {
  dispatch_queue_t queue;
  dispatch_group_t group;
}

-(id)initWithName:(NSString *)name;
-(id)initWithName:(NSString *)name attributes:(dispatch_queue_attr_t)attr;

+(THQueue *)queueWithName:(NSString *)name;
+(THQueue *)queueWithName:(NSString *)name attributes:(dispatch_queue_attr_t)attr;

+(void)sync:(THSimpleBlock)block;
-(void)sync:(THSimpleBlock)block;

+(void)async:(THSimpleBlock)block;
-(void)async:(THSimpleBlock)block;

+(void)delay:(THSimpleBlock)block seconds:(NSTimeInterval)seconds;
-(void)delay:(THSimpleBlock)block seconds:(NSTimeInterval)seconds;

@end


text:
class CefJavaScriptDialog;

HHOOK CefJavaScriptDialog::msg_hook_ = NULL;
int CefJavaScriptDialog::msg_hook_user_count_ = 0;

INT_PTR CALLBACK CefJavaScriptDialog::DialogProc(HWND dialog,
                                                 UINT message,
                                                 WPARAM wparam,
                                                 LPARAM lparam) {
  switch (message) {
    case WM_INITDIALOG: {
      SetWindowLongPtr(dialog, DWL_USER, static_cast<LONG_PTR>(lparam));
      CefJavaScriptDialog* owner =
          reinterpret_cast<CefJavaScriptDialog*>(lparam);
      owner->dialog_win_ = dialog;
      SetDlgItemText(dialog, IDC_DIALOGTEXT, owner->message_text_.c_str());
      if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT)
        SetDlgItemText(dialog, IDC_PROMPTEDIT,
                       owner->default_prompt_text_.c_str());
      break;
    }
    case WM_CLOSE: {
      CefJavaScriptDialog* owner = reinterpret_cast<CefJavaScriptDialog*>(
          GetWindowLongPtr(dialog, DWL_USER));
      if (owner) {
        owner->Cancel();
        owner->callback_.Run(false, string16());
        owner->creator_->DialogClosed(owner);

        // No need for the system to call DestroyWindow() because it will be
        // called by the Cancel() method.
        return 0;
      }
      break;
    }
    case WM_COMMAND: {
      CefJavaScriptDialog* owner = reinterpret_cast<CefJavaScriptDialog*>(
          GetWindowLongPtr(dialog, DWL_USER));
      string16 user_input;
      bool finish = false;
      bool result;
      switch (LOWORD(wparam)) {
        case IDOK:
          finish = true;
          result = true;
          if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) {
            size_t length =
                GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1;
            GetDlgItemText(dialog, IDC_PROMPTEDIT,
                           WriteInto(&user_input, length), length);
          }
          break;
        case IDCANCEL:
          finish = true;
          result = false;
          break;
      }
      if (finish) {
        owner->Cancel();
        owner->callback_.Run(result, user_input);
        owner->creator_->DialogClosed(owner);
      }
      break;
    }
    default:
      return DefWindowProc(dialog, message, wparam, lparam);
  }
  return 0;
}

CefJavaScriptDialog::CefJavaScriptDialog(
    CefJavaScriptDialogCreator* creator,
    content::JavaScriptMessageType message_type,
    const string16& display_url,
    const string16& message_text,
    const string16& default_prompt_text,
    const content::JavaScriptDialogCreator::DialogClosedCallback& callback)
    : creator_(creator),
      callback_(callback),
      message_text_(message_text),
      default_prompt_text_(default_prompt_text),
      message_type_(message_type) {
  InstallMessageHook();

  int dialog_type;
  if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT)
    dialog_type = IDD_ALERT;
  else if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM)
    dialog_type = IDD_CONFIRM;
  else  // JAVASCRIPT_MESSAGE_TYPE_PROMPT
    dialog_type = IDD_PROMPT;

  FilePath file_path;
  HMODULE hModule = NULL;

  // Try to load the dialog from the DLL.
  if (PathService::Get(base::FILE_MODULE, &file_path))
    hModule = ::GetModuleHandle(file_path.value().c_str());
  if (!hModule)
    hModule = ::GetModuleHandle(NULL);
  DCHECK(hModule);

  parent_win_ = GetAncestor(creator->browser()->GetWindowHandle(), GA_ROOT);
  dialog_win_ = CreateDialogParam(hModule,
                                  MAKEINTRESOURCE(dialog_type),
                                  parent_win_,
                                  DialogProc,
                                  reinterpret_cast<LPARAM>(this));
  DCHECK(dialog_win_);

  if (!display_url.empty()) {
    // Add the display URL to the window title.
    TCHAR text[64];
    GetWindowText(dialog_win_, text, sizeof(text)/sizeof(TCHAR));

    string16 new_window_text = text + ASCIIToUTF16(" - ") + display_url;
    SetWindowText(dialog_win_, new_window_text.c_str());
  }

  // Disable the parent window so the user can't interact with it.
  if (IsWindowEnabled(parent_win_))
    EnableWindow(parent_win_, FALSE);

  ShowWindow(dialog_win_, SW_SHOWNORMAL);
}

CefJavaScriptDialog::~CefJavaScriptDialog() {
  Cancel();
  UninstallMessageHook();
}

void CefJavaScriptDialog::Cancel() {
  HWND parent = NULL;

  // Re-enable the parent before closing the popup to avoid focus/activation/
  // z-order issues.
  if (parent_win_ && IsWindow(parent_win_) && !IsWindowEnabled(parent_win_)) {
    parent = parent_win_;
    EnableWindow(parent_win_, TRUE);
    parent_win_ = NULL;
  }

  if (dialog_win_ && IsWindow(dialog_win_)) {
    SetWindowLongPtr(dialog_win_, DWL_USER, NULL);
    DestroyWindow(dialog_win_);
    dialog_win_ = NULL;
  }

  // Return focus to the parent window.
  if (parent)
    SetFocus(parent);
}

// static
LRESULT CALLBACK CefJavaScriptDialog::GetMsgProc(int code, WPARAM wparam,
                                                 LPARAM lparam) {
  // Mostly borrowed from http://support.microsoft.com/kb/q187988/
  // and http://www.codeproject.com/KB/atl/cdialogmessagehook.aspx.
  LPMSG msg = reinterpret_cast<LPMSG>(lparam);
  if (code >= 0 && wparam == PM_REMOVE &&
      msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST) {
    HWND hwnd = GetActiveWindow();
    if (::IsWindow(hwnd) && ::IsDialogMessage(hwnd, msg)) {
      // The value returned from this hookproc is ignored, and it cannot
      // be used to tell Windows the message has been handled. To avoid
      // further processing, convert the message to WM_NULL before
      // returning.
      msg->hwnd = NULL;
      msg->message = WM_NULL;
      msg->lParam = 0L;
      msg->wParam = 0;
    }
  }

  // Passes the hook information to the next hook procedure in
  // the current hook chain.
  return ::CallNextHookEx(msg_hook_, code, wparam, lparam);
}

// static
bool CefJavaScriptDialog::InstallMessageHook() {
  msg_hook_user_count_++;

  // Make sure we only call this once.
  if (msg_hook_ != NULL)
    return true;

  msg_hook_ = ::SetWindowsHookEx(WH_GETMESSAGE,
                                 &CefJavaScriptDialog::GetMsgProc,
                                 NULL,
                                 GetCurrentThreadId());
  DCHECK(msg_hook_ != NULL);
  return msg_hook_ != NULL;
}

// static
bool CefJavaScriptDialog::UninstallMessageHook() {
  msg_hook_user_count_--;
  DCHECK_GE(msg_hook_user_count_, 0);

  if (msg_hook_user_count_ > 0)
    return true;

  DCHECK(msg_hook_ != NULL);
  BOOL result = ::UnhookWindowsHookEx(msg_hook_);
  DCHECK(result);
  msg_hook_ = NULL;

  return result != FALSE;
}


text:
namespace ApiAuth.Models
{
    public class Client
    {
        public string Name { get; set; }
        public string Key { get; set; }
        public string Secret { get; set; }
    }
}


text:
require 'carrierwave/test/matchers'

RSpec.describe RoomPhotoUploader do
  include CarrierWave::Test::Matchers

  let!(:room) { create :room, name: 'Spinning room' }

  before do
    described_class.enable_processing = true
    @uploader = described_class.new(room.room_photos.new, :photo)
    @uploader.store!(Rails.root.join('spec', 'support', 'images', 'room.jpg').open)
  end

  after do
    described_class.enable_processing = false
    @uploader.remove!
  end

  it 'should make the image readable to all and writable only by owner' do
    expect(@uploader).to have_permissions(0644)
  end

  it 'should rename the file to room\'s name' do
    expect(@uploader.filename).to eq 'spinning_room.jpg'
  end

  context 'the thumb version' do
    it 'should scale down a photo to be exactly 200 by 200 pixels' do
      expect(@uploader.thumb).to have_dimensions(200, 200)
    end
  end
end


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Lichenum Dianome Nova 7 (1817)

#### Original name
Biatora E.M. Fries, 1817

### Remarks
null


text:
// -*- Mode:C++; Coding:us-ascii-unix; fill-column:158 -*-
/*******************************************************************************************************************************************************.H.S.**/
/**
 @file      collatz.cpp
 @author    Mitch Richling <https://www.mitchr.me>
 @brief     Draw a mandelbrot-like fractal with the collatz map.@EOL
 @std       C++20
 @see       https://www.mitchr.me/SS/collatz/index.html
 @copyright
  @parblock
  Copyright (c) 1988-2015, Mitchell Jay Richling <https://www.mitchr.me> All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation
     and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software
     without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  DAMAGE.
  @endparblock
*/
/*******************************************************************************************************************************************************.H.E.**/
/** @cond exj */

//--------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "ramCanvas.hpp"

//--------------------------------------------------------------------------------------------------------------------------------------------------------------
int main(void) {
  std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
  const int    NUMITR = 164;
  const int    IMXSIZ = 7680/2;
  const int    IMYSIZ = 7680/2;

  //mjr::ramCanvas3c8b theRamCanvas(IMXSIZ, IMYSIZ, -3.75, 3.75, -3.75, 3.75);            // 56  centered 0+0i
  //mjr::ramCanvas3c8b theRamCanvas(IMXSIZ, IMYSIZ, -0.99-0.15, -0.99+0.15, -0.15, 0.15); // 28  centered near 1+i
  mjr::ramCanvas3c8b theRamCanvas(IMXSIZ, IMYSIZ, -0.99-0.03, -0.99+0.03, -0.03, 0.03);   // 28  same, zoomed in

  for(int y=0;y<theRamCanvas.getNumPixY();y++) {
    for(int x=0;x<theRamCanvas.getNumPixX();x++) {
      std::complex<double> z = theRamCanvas.int2real(x, y);
      int count = 0;
      while((std::norm(z)<1e10) && (count<=NUMITR)) {
        z = 0.25 * (2.0 + 7.0*z - (2.0 + 5.0 * z) * std::cos(z * std::numbers::pi));
        count++;
      }
      if(count < NUMITR)
        theRamCanvas.drawPoint(x, y, mjr::ramCanvas3c8b::colorType::csCCsumRGB::c(static_cast<mjr::ramCanvas3c8b::csIntType>(count*28)));
    }
  }
  theRamCanvas.writeTIFFfile("collatz.tiff");
  std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
  std::cout << "Total Runtime " << runTime.count() << " sec" << std::endl;
}
/** @endcond */


text:
package com.github.crazymax.crossfitreader.processus;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;

import org.apache.log4j.Logger;

import com.github.crazymax.crossfitreader.Main;
import com.github.crazymax.crossfitreader.model.Configuration;
import com.github.crazymax.crossfitreader.util.Util;

/**
 * Config proc
 * @author CrazyMax
 * @license MIT License
 * @link https://github.com/crazy-max/crossfit-reader
 */
public class ConfigProc {

    private static final Logger LOGGER = Logger.getLogger(ConfigProc.class);

    private static final String PROP_TERMINAL_NAME = "terminalName";
    private static final String PROP_SENTRY_DSN = "sentryDSN";
    private static final String PROP_BOOKING_BASE_URL = "bookingBaseUrl";
    private static final String PROP_BOOKING_API_KEY = "bookingApiKey";
    private static final String PROP_BOOKING_TIMEOUT = "bookingTimeout";
    private static final String PROP_BOOKING_USER_PROFILE_PATH = "bookingUserProfilePath";
    private static final String PROP_BOOKING_USER_LIST_PATH = "bookingUserListPath";
    private static final String PROP_BOOKING_SCAN_CARD_PATH = "bookingScanCardPath";
    private static final String PROP_BOOKING_ASSOCIATE_CARD_PATH = "bookingAssociateCardPath";
    private static final String PROP_BOOKING_REMOVE_CARD_PATH = "bookingRemoveCardPath";

    private Path configPath;
    private Configuration config = new Configuration();

    private static class ConfigProcHandler {
        private final static ConfigProc instance = new ConfigProc();
    }

    public static ConfigProc getInstance() {
        return ConfigProcHandler.instance;
    }

    private ConfigProc() {
        super();
    }

    private void loadFile() {
        if (configPath == null) {
            configPath = Main.appPath.resolve(Main.appId + ".conf");
        }
    }

    public synchronized void loadConfig() {
        loadFile();

        Configuration result = new Configuration();
        result.setSentryDSN("https://public:private@host:port/1");
        result.setTerminalName("ACS ACR122");
        result.setBookingBaseUrl("http://localhost/crossfit-reader");
        result.setBookingApiKey("rLhsoB0AwtUVFJ0dE7Z06R5CmgXYt8ZL");
        result.setBookingTimeout(5000);
        result.setBookingUserProfilePath("/?userprofile&id=%s");
        result.setBookingUserListPath("/?userlist");
        result.setBookingScanCardPath("/?scancard");
        result.setBookingAssociateCardPath("/?associatecard");
        result.setBookingRemoveCardPath("/?removecard");

        Properties propConfig = new Properties();
        InputStream inputConfigProperties = null;
        OutputStream outputConfigProperties = null;
        if (Files.exists(configPath)) {
            LOGGER.info("Loading configuration file: " + configPath);
            try {
                inputConfigProperties = new FileInputStream(configPath.toFile());
                propConfig.load(inputConfigProperties);

                result.setSentryDSN(propConfig.getProperty(PROP_SENTRY_DSN, result.getSentryDSN()).trim());
                result.setTerminalName(propConfig.getProperty(PROP_TERMINAL_NAME, result.getTerminalName()).trim());
                result.setBookingBaseUrl(propConfig.getProperty(PROP_BOOKING_BASE_URL, result.getBookingBaseUrl()).trim());
                result.setBookingApiKey(propConfig.getProperty(PROP_BOOKING_API_KEY, result.getBookingApiKey()).trim());
                result.setBookingTimeout(Integer.parseInt(propConfig.getProperty(PROP_BOOKING_TIMEOUT, String.valueOf(result.getBookingTimeout())).trim()));
                result.setBookingUserProfilePath(propConfig.getProperty(PROP_BOOKING_USER_PROFILE_PATH, result.getBookingUserProfilePath()).trim());
                result.setBookingUserListPath(propConfig.getProperty(PROP_BOOKING_USER_LIST_PATH, result.getBookingUserListPath()).trim());
                result.setBookingScanCardPath(propConfig.getProperty(PROP_BOOKING_SCAN_CARD_PATH, result.getBookingScanCardPath()).trim());
                result.setBookingAssociateCardPath(propConfig.getProperty(PROP_BOOKING_ASSOCIATE_CARD_PATH, result.getBookingAssociateCardPath()).trim());
                result.setBookingRemoveCardPath(propConfig.getProperty(PROP_BOOKING_REMOVE_CARD_PATH, result.getBookingRemoveCardPath()).trim());
            } catch (IOException e) {
                Util.logErrorExit(Util.i18n("processus.error.loading.config.properties"), e);
            } finally {
                if (inputConfigProperties != null) {
                    try {
                        inputConfigProperties.close();
                    } catch (IOException e) {
                        Util.logErrorExit(Util.i18n("processus.error.close.config.properties"));
                    }
                }
            }
        } else {
            LOGGER.info("Init configuration file: " + configPath);
            try {
                outputConfigProperties = new FileOutputStream(configPath.toFile());
                propConfig.setProperty(PROP_SENTRY_DSN, result.getSentryDSN());
                propConfig.setProperty(PROP_TERMINAL_NAME, result.getTerminalName());
                propConfig.setProperty(PROP_BOOKING_BASE_URL, result.getBookingBaseUrl());
                propConfig.setProperty(PROP_BOOKING_API_KEY, result.getBookingApiKey());
                propConfig.setProperty(PROP_BOOKING_TIMEOUT, String.valueOf(result.getBookingTimeout()));
                propConfig.setProperty(PROP_BOOKING_USER_PROFILE_PATH, result.getBookingUserProfilePath());
                propConfig.setProperty(PROP_BOOKING_USER_LIST_PATH, result.getBookingUserListPath());
                propConfig.setProperty(PROP_BOOKING_SCAN_CARD_PATH, result.getBookingScanCardPath());
                propConfig.setProperty(PROP_BOOKING_ASSOCIATE_CARD_PATH, result.getBookingAssociateCardPath());
                propConfig.setProperty(PROP_BOOKING_REMOVE_CARD_PATH, result.getBookingRemoveCardPath());
                propConfig.store(outputConfigProperties, null);
            } catch (IOException e) {
                Util.logErrorExit(Util.i18n("common.error.loading.config.properties"), e);
            } finally {
                if (outputConfigProperties != null) {
                    try {
                        outputConfigProperties.close();
                    } catch (IOException e) {
                        Util.logErrorExit(Util.i18n("processus.error.close.config.properties"));
                    }
                }
            }
        }

        setConfig(result);
        LOGGER.info(config);
    }

    public Configuration getConfig() {
        synchronized (config) {
            return config;
        }
    }

    private void setConfig(final Configuration config) {
        synchronized (this.config) {
            this.config = config;
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<module>
    <name>Compression</name>
    <version>4.0.0</version>
    <requirements>
        <minimum_version>5.7.0</minimum_version>
    </requirements>
    <description>
        <![CDATA[Compress images used on your Fork CMS website with the TinyPNG/TinyJPG service. You'll get compressed images in return: smaller filesize without visual differences, resulting in much faster pageload times!]]>
    </description>
    <authors>
        <author>
            <name><![CDATA[Jesse Dobbelaere]]></name>
            <url><![CDATA[http://www.jessedobbelae.re]]></url>
        </author>
    </authors>
    <events>
    </events>
</module>


text:
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType

class GenericCollectionInlineModelAdmin(admin.options.InlineModelAdmin):
    ct_field = "content_type"
    ct_fk_field = "object_id"

    def __init__(self, parent_model, admin_site):
        super(GenericCollectionInlineModelAdmin, self).__init__(parent_model, admin_site)
        ctypes = ContentType.objects.all().order_by('id').values_list('id', 'app_label', 'model')
        elements = ["%s: '%s/%s'" % (x, y, z) for x, y, z in ctypes]
        self.content_types = "{%s}" % ",".join(elements)

    def get_formset(self, request, obj=None, **kwargs):
        result = super(GenericCollectionInlineModelAdmin, self).get_formset(request, obj, **kwargs)
        result.content_types = self.content_types
        result.ct_fk_field = self.ct_fk_field
        return result

class GenericCollectionTabularInline(GenericCollectionInlineModelAdmin):
    template = 'admin/edit_inline/gen_coll_tabular.html'

class GenericCollectionStackedInline(GenericCollectionInlineModelAdmin):
    template = 'admin/edit_inline/gen_coll_stacked.html'


text:
namespace blink {

const char kSVGPrefix[] = "svg-";
const unsigned kSVGPrefixLength = sizeof(kSVGPrefix) - 1;

static bool isSVGPrefixed(const String& property)
{
    return property.startsWith(kSVGPrefix);
}

static String removeSVGPrefix(const String& property)
{
    ASSERT(isSVGPrefixed(property));
    return property.substring(kSVGPrefixLength);
}

CSSPropertyID AnimationInputHelpers::keyframeAttributeToCSSProperty(const String& property, const Document& document)
{
    // Disallow prefixed properties.
    if (property[0] == '-' || isASCIIUpper(property[0]))
        return CSSPropertyInvalid;
    if (property == "cssFloat")
        return CSSPropertyFloat;
    StringBuilder builder;
    for (size_t i = 0; i < property.length(); ++i) {
        if (property[i] == '-')
            Deprecation::countDeprecation(document, UseCounter::WebAnimationHyphenatedProperty);
        if (isASCIIUpper(property[i]))
            builder.append('-');
        builder.append(property[i]);
    }
    return cssPropertyID(builder.toString());
}

CSSPropertyID AnimationInputHelpers::keyframeAttributeToPresentationAttribute(const String& property, const Element& element)
{
    if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElement() || !isSVGPrefixed(property))
        return CSSPropertyInvalid;

    String unprefixedProperty = removeSVGPrefix(property);
    if (SVGElement::isAnimatableCSSProperty(QualifiedName(nullAtom, AtomicString(unprefixedProperty), nullAtom)))
        return cssPropertyID(unprefixedProperty);

    return CSSPropertyInvalid;
}

using AttributeNameMap = HashMap<QualifiedName, const QualifiedName*>;

const AttributeNameMap& getSupportedAttributes()
{
    DEFINE_STATIC_LOCAL(AttributeNameMap, supportedAttributes, ());
    if (supportedAttributes.isEmpty()) {
        // Fill the set for the first use.
        // Animatable attributes from http://www.w3.org/TR/SVG/attindex.html
        const QualifiedName* attributes[] = {
            &HTMLNames::classAttr,
            &SVGNames::amplitudeAttr,
            &SVGNames::azimuthAttr,
            &SVGNames::baseFrequencyAttr,
            &SVGNames::biasAttr,
            &SVGNames::clipPathUnitsAttr,
            &SVGNames::cxAttr,
            &SVGNames::cyAttr,
            &SVGNames::dAttr,
            &SVGNames::diffuseConstantAttr,
            &SVGNames::divisorAttr,
            &SVGNames::dxAttr,
            &SVGNames::dyAttr,
            &SVGNames::edgeModeAttr,
            &SVGNames::elevationAttr,
            &SVGNames::exponentAttr,
            &SVGNames::filterUnitsAttr,
            &SVGNames::fxAttr,
            &SVGNames::fyAttr,
            &SVGNames::gradientTransformAttr,
            &SVGNames::gradientUnitsAttr,
            &SVGNames::heightAttr,
            &SVGNames::hrefAttr,
            &SVGNames::in2Attr,
            &SVGNames::inAttr,
            &SVGNames::interceptAttr,
            &SVGNames::k1Attr,
            &SVGNames::k2Attr,
            &SVGNames::k3Attr,
            &SVGNames::k4Attr,
            &SVGNames::kernelMatrixAttr,
            &SVGNames::kernelUnitLengthAttr,
            &SVGNames::lengthAdjustAttr,
            &SVGNames::limitingConeAngleAttr,
            &SVGNames::markerHeightAttr,
            &SVGNames::markerUnitsAttr,
            &SVGNames::markerWidthAttr,
            &SVGNames::maskContentUnitsAttr,
            &SVGNames::maskUnitsAttr,
            &SVGNames::methodAttr,
            &SVGNames::modeAttr,
            &SVGNames::numOctavesAttr,
            &SVGNames::offsetAttr,
            &SVGNames::opacityAttr,
            &SVGNames::operatorAttr,
            &SVGNames::orderAttr,
            &SVGNames::orientAttr,
            &SVGNames::pathLengthAttr,
            &SVGNames::patternContentUnitsAttr,
            &SVGNames::patternTransformAttr,
            &SVGNames::patternUnitsAttr,
            &SVGNames::pointsAtXAttr,
            &SVGNames::pointsAtYAttr,
            &SVGNames::pointsAtZAttr,
            &SVGNames::pointsAttr,
            &SVGNames::preserveAlphaAttr,
            &SVGNames::preserveAspectRatioAttr,
            &SVGNames::primitiveUnitsAttr,
            &SVGNames::rAttr,
            &SVGNames::radiusAttr,
            &SVGNames::refXAttr,
            &SVGNames::refYAttr,
            &SVGNames::resultAttr,
            &SVGNames::rotateAttr,
            &SVGNames::rxAttr,
            &SVGNames::ryAttr,
            &SVGNames::scaleAttr,
            &SVGNames::seedAttr,
            &SVGNames::slopeAttr,
            &SVGNames::spacingAttr,
            &SVGNames::specularConstantAttr,
            &SVGNames::specularExponentAttr,
            &SVGNames::spreadMethodAttr,
            &SVGNames::startOffsetAttr,
            &SVGNames::stdDeviationAttr,
            &SVGNames::stitchTilesAttr,
            &SVGNames::surfaceScaleAttr,
            &SVGNames::tableValuesAttr,
            &SVGNames::targetAttr,
            &SVGNames::targetXAttr,
            &SVGNames::targetYAttr,
            &SVGNames::textLengthAttr,
            &SVGNames::transformAttr,
            &SVGNames::typeAttr,
            &SVGNames::valuesAttr,
            &SVGNames::viewBoxAttr,
            &SVGNames::widthAttr,
            &SVGNames::x1Attr,
            &SVGNames::x2Attr,
            &SVGNames::xAttr,
            &SVGNames::xChannelSelectorAttr,
            &SVGNames::y1Attr,
            &SVGNames::y2Attr,
            &SVGNames::yAttr,
            &SVGNames::yChannelSelectorAttr,
            &SVGNames::zAttr,
        };
        for (size_t i = 0; i < WTF_ARRAY_LENGTH(attributes); i++)
            supportedAttributes.set(*attributes[i], attributes[i]);
    }
    return supportedAttributes;
}

QualifiedName svgAttributeName(const String& property)
{
    ASSERT(!isSVGPrefixed(property));
    return QualifiedName(nullAtom, AtomicString(property), nullAtom);
}

const QualifiedName* AnimationInputHelpers::keyframeAttributeToSVGAttribute(const String& property, Element& element)
{
    if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElement() || !isSVGPrefixed(property))
        return nullptr;

    SVGElement& svgElement = toSVGElement(element);
    if (isSVGSMILElement(svgElement))
        return nullptr;

    String unprefixedProperty = removeSVGPrefix(property);
    QualifiedName attributeName = svgAttributeName(unprefixedProperty);
    const AttributeNameMap& supportedAttributes = getSupportedAttributes();
    auto iter = supportedAttributes.find(attributeName);
    if (iter == supportedAttributes.end() || !svgElement.propertyFromAttribute(*iter->value))
        return nullptr;

    return iter->value;
}

PassRefPtr<TimingFunction> AnimationInputHelpers::parseTimingFunction(const String& string)
{
    if (string.isEmpty())
        return nullptr;

    RefPtrWillBeRawPtr<CSSValue> value = CSSParser::parseSingleValue(CSSPropertyTransitionTimingFunction, string);
    if (!value || !value->isValueList()) {
        ASSERT(!value || value->isCSSWideKeyword());
        return nullptr;
    }
    CSSValueList* valueList = toCSSValueList(value.get());
    if (valueList->length() > 1)
        return nullptr;
    return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true);
}

} // namespace blink


text:
package service

import (
	"github.com/muka/redzilla/api"
	"github.com/muka/redzilla/docker"
	"github.com/muka/redzilla/model"
	"github.com/sirupsen/logrus"
)

// Start the service
func Start(cfg *model.Config) error {

	msg := docker.ListenEvents(cfg)
	go func() {
		for {
			select {
			case ev := <-msg:

				instance := api.GetInstance(ev.Name, cfg)

				exists, err := instance.Exists()
				if err != nil {
					logrus.Errorf("Failed loading instance %s", ev.Name)
					continue
				}

				if !exists {
					continue
				}

				switch ev.Action {
				case "die":
					logrus.Warnf("Container exited %s", ev.Name)

					instance.StopLogsPipe()

					//reset cached informations
					rerr := instance.Reset()
					if rerr != nil {
						logrus.Warnf("Failed to reset detail for %s: %s", instance.GetStatus().Name, rerr.Error())
					}

					break
				case "start":
					err = instance.StartLogsPipe()
					if err != nil {
						logrus.Warnf("Cannot start logs pipe for %s: %s", ev.Name, err.Error())
					}

					//cache container IP
					instance.GetIP()
					instance.GetStatus().Status = model.InstanceStarted

					break
				default:
					logrus.Infof("Container %s %s", ev.Action, ev.Name)
					break
				}

				break
			}
		}
	}()

	err := api.Start(cfg)
	if err != nil {
		return err
	}

	return nil
}

// Stop the service
func Stop(cfg *model.Config) {
	api.CloseInstanceLoggers()
}


text:
@echo off
IF EXIST build-vs2015-x64\tundra-urho3d.sln del /Q build-vs2015-x64\tundra-urho3d.sln
pushd tools\Windows\
call RunCMake "Visual Studio 14 2015 Win64" %*
popd
pause


text:
<?xml version="1.0" encoding="utf-8"?>
<layer-list
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/community_aluminum" />
        </shape>
    </item>
    <item android:left="1.0dip" android:right="1.0dip" android:bottom="1.0dip">
        <shape android:shape="rectangle">
            <solid android:color="@color/common_bg" />
        </shape>
    </item>
</layer-list>


text:
require 'rails/generators'
class TopholdEngineGenerator < Rails::Generators::Base

  source_root File.expand_path('../templates', __FILE__)

  def install_engine_patch
    template "rails_engine_namespace_patch.rb", "config/initializers/rails_engine_namespace_patch.rb"
    template "sunspot_mongoid_patch.rb",        "config/initializers/sunspot_mongoid_patch.rb"
  end

end


text:
package org.wso2.extension.siddhi.io.http.source;

import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.wso2.extension.siddhi.io.http.source.util.HttpTestUtil;
import org.wso2.extension.siddhi.map.xml.sourcemapper.XmlSourceMapper;
import org.wso2.siddhi.core.SiddhiAppRuntime;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.event.Event;
import org.wso2.siddhi.core.query.output.callback.QueryCallback;
import org.wso2.siddhi.core.util.EventPrinter;
import org.wso2.siddhi.core.util.SiddhiTestHelper;
import org.wso2.siddhi.core.util.persistence.InMemoryPersistenceStore;
import org.wso2.siddhi.core.util.persistence.PersistenceStore;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Test cases for basic authentication.
 */
public class HttpSourceBasicAuthTestCases {
    private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger
            (HttpSourceBasicAuthTestCases.class);
    private AtomicInteger eventCount = new AtomicInteger(0);
    private int waitTime = 50;
    private int timeout = 30000;

    @BeforeMethod
    public void init() {
        eventCount.set(0);
    }

    /**
     * Creating test for publishing events with basic auth false.
     * @throws Exception Interrupted exception
     */
    @Test
    public void testBasicAuthFalse() throws Exception {
        logger.info(" Creating test for publishing events with basic auth false.");
        URI baseURI = URI.create(String.format("http://%s:%d", "localhost", 8005));
        List<String> receivedEventNameList = new ArrayList<>(2);
        PersistenceStore persistenceStore = new InMemoryPersistenceStore();
        SiddhiManager siddhiManager = new SiddhiManager();
        siddhiManager.setPersistenceStore(persistenceStore);
        siddhiManager.setExtension("xml-input-mapper", XmlSourceMapper.class);
        String inStreamDefinition = "@source(type='http', @map(type='xml'), receiver.url='http://localhost:8005"
                + "/endpoints/RecPro', basic.auth.enabled='false' )"
                + "define stream inputStream (name string, age int, country string);";
        String query = (
                "@info(name = 'query') "
                        + "from inputStream "
                        + "select * "
                        + "insert into outputStream;"
                        );
        SiddhiAppRuntime siddhiAppRuntime = siddhiManager
                .createSiddhiAppRuntime(inStreamDefinition + query);

        siddhiAppRuntime.addCallback("query", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                for (Event event : inEvents) {
                    eventCount.incrementAndGet();
                    receivedEventNameList.add(event.getData(0).toString());
                }
            }
        });
        siddhiAppRuntime.start();
        // publishing events
        List<String> expected = new ArrayList<>(2);
        expected.add("John");
        expected.add("Mike");
        String event1 = "<events>"
                            + "<event>"
                               + "<name>John</name>"
                               + "<age>100</age>"
                               + "<country>AUS</country>"
                            + "</event>"
                        + "</events>";
        String event2 = "<events>"
                             + "<event>"
                               + "<name>Mike</name>"
                               + "<age>20</age>"
                               + "<country>USA</country>"
                             + "</event>"
                        + "</events>";
        HttpTestUtil.httpPublishEvent(event1, baseURI, "/endpoints/RecPro",
                "POST");
        HttpTestUtil.httpPublishEvent(event2, baseURI, "/endpoints/RecPro",
                "POST");
        SiddhiTestHelper.waitForEvents(waitTime, 2, eventCount, timeout);
        Assert.assertEquals(receivedEventNameList.toString(), expected.toString());
        siddhiAppRuntime.shutdown();
    }

    /**
     * Creating test for publishing events with basic auth is not provided.
     * @throws Exception Interrupted exception
     */
    @Test
    public void testBasicAuthNotProvided() throws Exception {
        logger.info("Creating test for publishing events with basic auth is not provided.");
        URI baseURI = URI.create(String.format("http://%s:%d", "localhost", 8005));
        List<String> receivedEventNameList = new ArrayList<>(2);
        PersistenceStore persistenceStore = new InMemoryPersistenceStore();
        SiddhiManager siddhiManager = new SiddhiManager();
        siddhiManager.setPersistenceStore(persistenceStore);
        siddhiManager.setExtension("xml-input-mapper", XmlSourceMapper.class);
        String inStreamDefinition = "@source(type='http', @map(type='xml'), receiver.url='http://localhost:8005"
                + "/endpoints/RecPro' )"
                + "define stream inputStream (name string, age int, country string);";
        String query = (
                "@info(name = 'query') "
                        + "from inputStream "
                        + "select *  "
                        + "insert into outputStream;"
                        );
        SiddhiAppRuntime siddhiAppRuntime = siddhiManager
                .createSiddhiAppRuntime(inStreamDefinition + query);

        siddhiAppRuntime.addCallback("query", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                for (Event event : inEvents) {
                    eventCount.incrementAndGet();
                    receivedEventNameList.add(event.getData(0).toString());
                }
            }
        });
        siddhiAppRuntime.start();
        // publishing events
        List<String> expected = new ArrayList<>(2);
        expected.add("John");
        expected.add("Mike");
        String event1 = "<events>"
                            + "<event>"
                                + "<name>John</name>"
                                + "<age>100</age>"
                                + "<country>AUS</country>"
                            + "</event>"
                        + "</events>";
        String event2 = "<events>"
                            + "<event>"
                                + "<name>Mike</name>"
                                + "<age>20</age>"
                                + "<country>USA</country>"
                            + "</event>"
                        + "</events>";
        HttpTestUtil.httpPublishEvent(event1, baseURI, "/endpoints/RecPro",
                "POST");
        HttpTestUtil.httpPublishEvent(event2, baseURI, "/endpoints/RecPro",
                "POST");
        SiddhiTestHelper.waitForEvents(waitTime, 2, eventCount, timeout);
        Assert.assertEquals(receivedEventNameList.toString(), expected.toString());
        siddhiAppRuntime.shutdown();
    }
}


text:
// Generated by the gRPC protobuf plugin.
// If you make any local change, they will be lost.
// source: reflection.proto

#include <grpc++/ext/reflection.pb.h>
#include <grpc++/ext/reflection.grpc.pb.h>

#include <grpc++/impl/codegen/async_stream.h>
#include <grpc++/impl/codegen/async_unary_call.h>
#include <grpc++/impl/codegen/channel_interface.h>
#include <grpc++/impl/codegen/client_unary_call.h>
#include <grpc++/impl/codegen/method_handler_impl.h>
#include <grpc++/impl/codegen/rpc_service_method.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/sync_stream.h>
namespace grpc {
namespace reflection {
namespace v1alpha {

static const char* ServerReflection_method_names[] = {
  "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo",
};

std::unique_ptr< ServerReflection::Stub> ServerReflection::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
  std::unique_ptr< ServerReflection::Stub> stub(new ServerReflection::Stub(channel));
  return stub;
}

ServerReflection::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
  : channel_(channel), rpcmethod_ServerReflectionInfo_(ServerReflection_method_names[0], ::grpc::RpcMethod::BIDI_STREAMING, channel)
  {}

::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflection::Stub::ServerReflectionInfoRaw(::grpc::ClientContext* context) {
  return new ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>(channel_.get(), rpcmethod_ServerReflectionInfo_, context);
}

::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflection::Stub::AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
  return new ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>(channel_.get(), cq, rpcmethod_ServerReflectionInfo_, context, tag);
}

ServerReflection::Service::Service() {
  (void)ServerReflection_method_names;
  AddMethod(new ::grpc::RpcServiceMethod(
      ServerReflection_method_names[0],
      ::grpc::RpcMethod::BIDI_STREAMING,
      new ::grpc::BidiStreamingHandler< ServerReflection::Service, ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>(
          std::mem_fn(&ServerReflection::Service::ServerReflectionInfo), this)));
}

ServerReflection::Service::~Service() {
}

::grpc::Status ServerReflection::Service::ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) {
  (void) context;
  (void) stream;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

}  // namespace grpc
}  // namespace reflection
}  // namespace v1alpha


text:
<?php

namespace Csv\Engine\Parser;

use Csv\Engine\WorkerIterator;
use Csv\Exception\ParsingFinishedException;

/**
 * Row iterator.
 *
 * @author Jean-François Simon <contact@jfsimon.fr>
 */
class RowIterator extends WorkerIterator
{
    /**
     * @var Parser
     */
    private $parser;

    /**
     * @var array
     */
    private $row;

    /**
     * Constructor.
     *
     * @param Parser $parser
     */
    public function __construct(Parser $parser)
    {
        $this->parser = $parser;
        $this->row    = array();
    }

    /**
     * {@inheritdoc}
     */
    public function current()
    {
        return $this->row;
    }

    /**
     * {@inheritdoc}
     */
    protected function build()
    {
        try {
            $this->row = $this->parser->parse(new State());
        } catch (ParsingFinishedException $e) {
            $this->finish();
        }
    }

    /**
     * {@inheritdoc}
     */
    protected function reiterate()
    {
        throw new \RuntimeException('Reset not permitted.');
    }
}


text:
import { ImplicitLibVariableOptions } from '../variable';
export declare const es2015_core: Record<string, ImplicitLibVariableOptions>;
//# sourceMappingURL=es2015.core.d.ts.map


text:
<?xml version="1.0" encoding="UTF-8"?>

<recipeml version="0.5">
  <recipe>
    <head>
      <title>Almond-Filled Cheesecake</title>
      <categories>
        <cat>Desserts</cat></categories>
      <yield>12</yield></head>
    <ingredients>
      <ing>
        <amt>
          <qty>6</qty>
          <unit>tablespoons</unit></amt>
        <item>Butter; well-chilled, cut into 1/2" pieces</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>package</unit></amt>
        <item>Chocolate wafer cookies; 8.5 ounces</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>can</unit></amt>
        <item>Almond filling; 12 ounces</item></ing>
      <ing>
        <amt>
          <qty>3</qty>
          <unit>packages</unit></amt>
        <item>Cream cheese; 8 ounces</item></ing>
      <ing>
        <amt>
          <qty>3/4</qty>
          <unit>cups</unit></amt>
        <item>Granulated sugar</item></ing>
      <ing>
        <amt>
          <qty>3</qty>
          <unit/></amt>
        <item>Eggs</item></ing>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>pints</unit></amt>
        <item>Fresh strawberries; sliced & sweetened</item></ing></ingredients>
    <directions>
      <step>  Generously butter a 9" springform pan. Finely crush chocolate cookies in
  food processor, using on/off turns. Cut in butter until mixture begins to
  gather together. Press crumbs into bottom of pan and up sides to 3/4 inch
  from top; make sure there are no cracks. Refrigerate crust for at least 30
  minutes.

  Meanwhile, preheat oven to 325 degrees. Bake crust 10 minutes, cool.

  Spread the crust with the almond filling. In a large bowl, cream together
  the cream cheese and sugar until light. Add eggs, one at a time, beating
  well after each addition with electric mixer. Pour mixture carefully over
  almond layer, then bake about 65 minutes. Let cake cool for 1 hour, then
  refrigerate at least 5 hours.

  Serving Ideas : Cut into slices, top each serving with strawberries.

  Recipe by: Oregonian's Food Day Posted to MC-Recipe Digest V1 #745 by
  LBotsko@aol.com on Aug 16, 1997

</step></directions></recipe></recipeml>


text:
import { combineReducers } from 'redux'
import { routerReducer as routing } from 'react-router-redux'
import { reducer as form } from 'redux-form'
import core from './core'
import bakery from './bakery'
import cart from './cart'
import admin from './admin'
import about from './about'
import filter from './filter'

export default combineReducers({
    core,
    bakery,
    cart,
    admin,
    about,
    filter,
    routing,
    form
});


text:
module Cryptic
  # The version of the cryptic gem
  VERSION = '1.0.0.beta.11'
end


text:
using CodeMash.Models;

namespace CodeMash.Core.Tests
{
    [Collection("sdk-attribute")]
    public class AttributeEntity : Entity
    {
        [Field("field_1")]
        public string Attribute1 { get; set; }

        [Field("field_2")]
        public int Attribute2 { get; set; }

        public int Attribute3 { get; set; }

        public int attribute_4 { get; set; }
    }
}


text:
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons

import sys
from os.path import abspath, dirname, join
sys.path.append(join(dirname(abspath(__file__)), 'Support'))
from executablesSearch import isExecutableOfToolAvailable

_exe = TestSCons._exe
test = TestSCons.TestSCons()

if not isExecutableOfToolAvailable(test, 'dmd'):
    test.skip_test("Could not find 'dmd'; skipping test.\n")

test.write('SConstruct', """\
import os
env = Environment(tools=['dmd', 'link'])
env['ENV']['HOME'] = os.environ['HOME']  # Hack for gdmd
if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj'  # trick DMD
env.Program('foo', 'foo.d')
""")

test.write('foo.d', """\
import std.stdio;
int main(string[] args) {
    printf("Hello!");
    return 0;
}
""")

test.run()

test.run(program=test.workpath('foo'+_exe))

test.fail_test(not test.stdout() == 'Hello!')

test.pass_test()

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:


text:
require 'spec_helper'

describe Travis::CLI::Cancel do
  example 'travis cancel' do
    run_cli('cancel', '-t', 'token').should be_success
    $params['id'].should be == "4125095"
    $params['entity'].should be == "builds"
  end

  example 'travis cancel 6180.1' do
    run_cli('cancel', '6180.1', '-t', 'token').should be_success
    $params['id'].should be == "4125096"
    $params['entity'].should be == "jobs"
  end
end


text:
CannonLimits = {}

-- Fill out CannonLimits
for _,Config in pairs(CannonConfigs) do
   CannonLimits[Config.WeaponSlot] = Config.Limits
end

function CannonControl_Update(I)
   -- Pick highest priority target for each configured weapon slot
   local ToFire = {}
   local Fire = false -- Because # operator only works on sequences
   local Targets = C:Targets()
   local Velocity = C:Velocity()
   for Slot,Limits in pairs(CannonLimits) do
      local MinRange,MaxRange = Limits.MinRange,Limits.MaxRange
      local MinAltitude,MaxAltitude = Limits.MinAltitude,Limits.MaxAltitude
      for _,Target in ipairs(Targets) do
         local Range = Target.Range
         local Altitude = Target.Position.y
         if Range >= MinRange and Range <= MaxRange and Altitude >= MinAltitude and Altitude <= MaxAltitude then
            if not Target.RelativeVelocity then
               -- Add relative velocity to target table
               Target.RelativeVelocity = Target.Velocity - Velocity
            end
            -- Calculate constrained aim point
            local AimPoint,Waterline = Target.AimPoint,Limits.ConstrainWaterline
            AimPoint = Vector3(AimPoint.x, (Waterline and math.max(Waterline, AimPoint.y) or AimPoint.y), AimPoint.z)
            -- And queue up this slot
            ToFire[Slot] = { Target, AimPoint }
            Fire = true
            break
         end
      end
   end

   if Fire then
      -- Just assume all weapons have the same gravity
      local Gravity = -I:GetGravityForAltitude(C:Altitude())

      -- Aim & fire each turret/cannon
      for _,Weapon in pairs(C:WeaponControllers()) do
         local WeaponType = Weapon.Type
         local WeaponSlot = Weapon.Slot
         local FireSlot = ToFire[WeaponSlot]
         if FireSlot and (WeaponType == TURRET or WeaponType == CANNON) and not Weapon.PlayerControl then
            local Target,CannonAimPoint = unpack(FireSlot)
            local AimPoint = BallisticAimPoint(Weapon.Speed, CannonAimPoint - Weapon.FirePoint, Target.RelativeVelocity, Gravity+(Target.Acceleration or Vector3.zero))
            if AimPoint then
               -- Docs say this doesn't have to be normalized, but as of
               -- 2.02 or so, it does. (Otherwise crazy recoil happens...)
               AimPoint = AimPoint.normalized
               if I:AimWeaponInDirectionOnSubConstruct(Weapon.SubConstructId, Weapon.Index, AimPoint.x, AimPoint.y, AimPoint.z, WeaponSlot) > 0 and WeaponType == CANNON then
                  -- If this is a turret, its cannons will presumably be fired
                  -- in some other iteration of this loop.
                  I:FireWeaponOnSubConstruct(Weapon.SubConstructId, Weapon.Index, WeaponSlot)
               end
            end
         end
      end
   end
end


text:
from extract.globals import *
from extract.directive import DTDirective

from extract.default import default
from extract.reg import reg

##
# @brief Manage flash directives.
#
class DTFlash(DTDirective):

    def __init__(self):
        # Node of the flash
        self._flash_node = None

    def _extract_partition(self, node_address, yaml, prop, def_label):
        prop_def = {}
        prop_alias = {}
        node = reduced[node_address]

        partition_name = node['props']['label']
        partition_sectors = node['props']['reg']

        label_prefix = ["FLASH_AREA", partition_name]
        label = self.get_label_string(label_prefix + ["LABEL",])
        prop_def[label] = '"{}"'.format(partition_name)

        index = 0
        while index < len(partition_sectors):
            sector_index = int(index/2)
            sector_start_offset = partition_sectors[index]
            sector_size = partition_sectors[index + 1]
            label = self.get_label_string(
                label_prefix + ["OFFSET", str(sector_index)])
            prop_def[label] = "{}".format(sector_start_offset)
            label = self.get_label_string(
                label_prefix + ["SIZE", str(sector_index)])
            prop_def[label] = "{}".format(sector_size)
            index += 2
        # alias sector 0
        label = self.get_label_string(label_prefix + ["OFFSET",])
        prop_alias[label] = self.get_label_string(
            label_prefix + ["OFFSET", '0'])
        label = self.get_label_string(label_prefix + ["SIZE",])
        prop_alias[label] = self.get_label_string(
            label_prefix + ["SIZE", '0'])

        insert_defs(node_address, prop_def, prop_alias)

    def _extract_flash(self, node_address, yaml, prop, def_label):
        load_defs = {}

        if node_address == 'dummy-flash':
            # We will add addr/size of 0 for systems with no flash controller
            # This is what they already do in the Kconfig options anyway
            load_defs = {
                'CONFIG_FLASH_BASE_ADDRESS': 0,
                'CONFIG_FLASH_SIZE': 0
            }
            insert_defs(node_address, load_defs, {})
            self._flash_base_address = 0
            return

        self._flash_node = reduced[node_address]

        flash_props = ["label", "write-block-size", "erase-block-size"]
        for prop in flash_props:
            if prop in self._flash_node['props']:
                default.extract(node_address, None, prop, def_label)
        insert_defs(node_address, load_defs, {})

        #for address in reduced:
        #    if address.startswith(node_address) and 'partition@' in address:
        #        self._extract_partition(address, yaml, 'partition', None, def_label)

    def _extract_code_partition(self, node_address, yaml, prop, def_label):
        load_defs = {}

        if node_address == 'dummy-flash':
            node = None
        else:
            node = reduced[node_address]
            if self._flash_node is None:
                # No flash node scanned before-
                raise Exception(
                    "Code partition '{}' {} without flash definition."
                        .format(prop, node_address))

        if node and node is not self._flash_node:
            # only compute the load offset if the code partition
            # is not the same as the flash base address
            load_offset = str(int(node['props']['reg'][0]) \
                              - int(self._flash_node['props']['reg'][0]))
            load_defs['CONFIG_FLASH_LOAD_OFFSET'] = load_offset
            load_size = node['props']['reg'][1]
            load_defs['CONFIG_FLASH_LOAD_SIZE'] = load_size
        else:
            load_defs['CONFIG_FLASH_LOAD_OFFSET'] = 0
            load_defs['CONFIG_FLASH_LOAD_SIZE'] = 0

        insert_defs(node_address, load_defs, {})

    ##
    # @brief Extract flash
    #
    # @param node_address Address of node owning the
    #                     flash definition.
    # @param yaml YAML definition for the owning node.
    # @param prop compatible property name
    # @param def_label Define label string of node owning the
    #                  compatible definition.
    #
    def extract(self, node_address, yaml, prop, def_label):

        if prop == 'zephyr,flash':
            # indicator for flash
            self._extract_flash(node_address, yaml, prop, def_label)
        elif prop == 'zephyr,code-partition':
            # indicator for code_partition
            self._extract_code_partition(node_address, yaml, prop, def_label)
        elif prop == 'reg':
            # indicator for partition
            self._extract_partition(node_address, yaml, prop, def_label)
        else:
            raise Exception(
                "DTFlash.extract called with unexpected directive ({})."
                    .format(prop))
##
# @brief Management information for flash.
flash = DTFlash()


text:
package com.xd.adhocroute1s.route;

import android.content.Context;
import android.preference.EditTextPreference;
import android.text.method.DigitsKeyListener;
import android.util.AttributeSet;
import android.view.View;
import android.widget.EditText;

import com.googlecode.android.wifi.tether.R;
import com.googlecode.android.wifi.tether.TetherApplication;
/**
 * 支持判断是否是合法的用斜杠和数字表示的子网号
 * @author qhyuan1992
 *
 */
public class NetIPEditPreference extends EditTextPreference {
	public NetIPEditPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); }
	public NetIPEditPreference(Context context, AttributeSet attrs) { super(context, attrs); }
	public NetIPEditPreference(Context context) { super(context); }

	@Override
	protected void onAddEditTextToDialogView(View dialogView, EditText editText) {
		editText.setKeyListener(DigitsKeyListener.getInstance("0123456789./"));
		super.onAddEditTextToDialogView(dialogView, editText);
	}
	public boolean netIPCheck(String text) {
		if (text.isEmpty()) return true;
        if (text != null && !text.isEmpty()) {
            String regex = "^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\."
                    + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."
                    + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."
                    + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)"
                    + "/\\d+$";
            if (text.matches(regex)) {
                return true;
            } else {
                return false;
            }
        }
        return false;
    }
	public  boolean validate(String addr) {
		return netIPCheck(addr);
	}

	@Override
	protected void onDialogClosed(boolean positiveResult) {
		if (positiveResult) {
			String addr = getEditText().getText().toString();
			if (!validate(addr)) {
				((TetherApplication)getContext().getApplicationContext()).adhocRouteApp.showToastMsg(R.string.toast_setting_preference_format_error);
				positiveResult = false;
			}
		}
		super.onDialogClosed(positiveResult);
	}
}


text:
package com.buyexpressly.api.resource.merchant;

import com.buyexpressly.api.resource.server.Customer;
import com.buyexpressly.api.resource.server.Metadata;

public final class CustomerDataResponse {
    private Metadata meta;
    private Customer data;

    private CustomerDataResponse(Builder builder) {
        this.meta = builder.meta;
        this.data = builder.data;
    }

    private CustomerDataResponse() {
    }

    public static Builder builder() {
        return new Builder();
    }

    public Metadata getMeta() {
        return meta;
    }

    public Customer getData() {
        return data;
    }

    public static final class Builder {
        private Metadata meta;
        private Customer data;

        public Builder withMeta(Metadata meta) {
            this.meta = meta;
            return this;
        }

        public Builder withData(Customer data) {
            this.data = data;
            return this;
        }

        public CustomerDataResponse build() {
            return new CustomerDataResponse(this);
        }
    }

}


text:
'use strict';

// //////////////////////////////////////////////////////////////////////////////
// / @brief active failover leadership change
// /
// / @file
// /
// / DISCLAIMER
// /
// / Copyright 2014 ArangoDB GmbH, Cologne, Germany
// / Copyright 2011-2014 triAGENS GmbH, Cologne, Germany
// /
// / Licensed under the Apache License, Version 2.0 (the "License")
// / you may not use this file except in compliance with the License.
// / You may obtain a copy of the License at
// /
// /     http://www.apache.org/licenses/LICENSE-2.0
// /
// / Unless required by applicable law or agreed to in writing, software
// / distributed under the License is distributed on an "AS IS" BASIS,
// / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// / See the License for the specific language governing permissions and
// / limitations under the License.
// /
// / Copyright holder is ArangoDB GmbH, Cologne, Germany
// /
// / @author Alan Plum
// / @author Copyright 2021, ArangoDB GmbH, Cologne, Germany
// //////////////////////////////////////////////////////////////////////////////

(function(){
  "use strict";
  if (require("internal").threadNumber === 0) {
    require("@arangodb/foxx/manager").healAll();
  }
}());


text:
package com.mongodb.client.model;

import com.mongodb.DBObject;
import com.mongodb.ReadConcern;
import com.mongodb.ReadPreference;

/**
 * The options for a distinct operation.
 *
 * @since 3.4
 * @mongodb.driver.manual reference/command/count/ Count
 */
public class DBCollectionDistinctOptions {
    private DBObject filter;
    private ReadPreference readPreference;
    private ReadConcern readConcern;
    private Collation collation;

    /**
     * Construct a new instance
     */
    public DBCollectionDistinctOptions() {
    }

    /**
     * Gets the selection query to determine the subset of documents from which to retrieve the distinct values
     *
     * @return the query
     */
    public DBObject getFilter() {
        return filter;
    }

    /**
     * Sets the selection query to determine the subset of documents from which to retrieve the distinct values.
     *
     * @param filter the selection query to determine the subset of documents from which to retrieve the distinct values
     * @return this
     */
    public DBCollectionDistinctOptions filter(final DBObject filter) {
        this.filter = filter;
        return this;
    }

    /**
     * Returns the readPreference
     *
     * @return the readPreference
     */
    public ReadPreference getReadPreference() {
        return readPreference;
    }

    /**
     * Sets the readPreference
     *
     * @param readPreference the readPreference
     * @return this
     */
    public DBCollectionDistinctOptions readPreference(final ReadPreference readPreference) {
        this.readPreference = readPreference;
        return this;
    }

    /**
     * Returns the readConcern
     *
     * @return the readConcern
     * @mongodb.server.release 3.2
     */
    public ReadConcern getReadConcern() {
        return readConcern;
    }

    /**
     * Sets the readConcern
     *
     * @param readConcern the readConcern
     * @return this
     * @mongodb.server.release 3.2
     */
    public DBCollectionDistinctOptions readConcern(final ReadConcern readConcern) {
        this.readConcern = readConcern;
        return this;
    }

    /**
     * Returns the collation options
     *
     * @return the collation options
     * @mongodb.server.release 3.4
     */
    public Collation getCollation() {
        return collation;
    }

    /**
     * Sets the collation
     *
     * @param collation the collation
     * @return this
     * @mongodb.server.release 3.4
     */
    public DBCollectionDistinctOptions collation(final Collation collation) {
        this.collation = collation;
        return this;
    }
}


text:
using System;

/*Problem 4. Hello World

Create, compile and run a "Hello C#" console application.
Ensure you have named the application well (e.g. ""HelloCSharp"). */

class HelloCSharp
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello C#");
        }
    }


text:
---
uid: SolidEdgeFrameworkSupport.SmartFrame2dStyle.Margin
summary:
remarks: The distance is specified in container units.
---


text:
<title>EntityBonePitch</title>

EntityBonePitch()

Syntax

Result = EntityBonePitch(#Entity, Bone$)

Description

Returns the pitch of the entity bone.

Parameters

#Entity

The entity to use.

Bone$

The bone name in the OGRE mesh.

Return value

The current pitch value of the bone. This value is always between -180.0 and 180.0 degrees.

See Also

EntityBoneYaw(), EntityBoneRoll()

Supported OS
All

<- EntityAngularFactor() - Entity Index - EntityBoneRoll() ->


text:
require('./polyfills/Element')();
require('./polyfills/events')();
require('./polyfills/hasOwnProperty')();
require('./polyfills/String')();
require('./polyfills/whichIE')();
require('./polyfills/pageOffset.js')();
require('./polyfills/rAF.js')();

if (typeof define === 'function' && define.amd && typeof exports === 'object') {
    var oldAmd = define.amd;
    delete define.amd;

    require('es5-shim/es5-shim');
    require('es5-shim/es5-sham');

    define.amd = oldAmd;
} else {
    require('es5-shim/es5-shim');
    require('es5-shim/es5-sham');
}

module.exports = {};

if (typeof skyComponents === "undefined") window.skyComponents = {};
skyComponents.polyfill = module.exports;