text:
module Azure::DataFactory::Mgmt::V2017_09_01_preview
  #
  # The Azure Data Factory V2 management API provides a RESTful set of web
  # services that interact with Azure Data Factory V2 services.
  #
  class Factories
    include MsRestAzure

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

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

    #
    # Lists factories under the specified subscription.
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array<Factory>] operation results.
    #
    def list(custom_headers:nil)
      first_page = list_as_lazy(custom_headers:custom_headers)
      first_page.get_all_items
    end

    #
    # Lists factories under the specified 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_with_http_info(custom_headers:nil)
      list_async(custom_headers:custom_headers).value!
    end

    #
    # Lists factories under the specified 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_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.DataFactory/factories'

      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::DataFactory::Mgmt::V2017_09_01_preview::Models::FactoryListResponse.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

    #
    # Updates a factory's repo information.
    #
    # @param location_id [String] The location identifier.
    # @param factory_repo_update [FactoryRepoUpdate] Update factory repo request
    # definition.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Factory] operation results.
    #
    def configure_factory_repo(location_id, factory_repo_update, custom_headers:nil)
      response = configure_factory_repo_async(location_id, factory_repo_update, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Updates a factory's repo information.
    #
    # @param location_id [String] The location identifier.
    # @param factory_repo_update [FactoryRepoUpdate] Update factory repo request
    # definition.
    # @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 configure_factory_repo_with_http_info(location_id, factory_repo_update, custom_headers:nil)
      configure_factory_repo_async(location_id, factory_repo_update, custom_headers:custom_headers).value!
    end

    #
    # Updates a factory's repo information.
    #
    # @param location_id [String] The location identifier.
    # @param factory_repo_update [FactoryRepoUpdate] Update factory repo request
    # definition.
    # @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 configure_factory_repo_async(location_id, factory_repo_update, custom_headers:nil)
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, 'location_id is nil' if location_id.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, 'factory_repo_update is nil' if factory_repo_update.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::DataFactory::Mgmt::V2017_09_01_preview::Models::FactoryRepoUpdate.mapper()
      request_content = @client.serialize(request_mapper,  factory_repo_update)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id,'locationId' => location_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
          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::DataFactory::Mgmt::V2017_09_01_preview::Models::Factory.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

    #
    # Lists factories.
    #
    # @param resource_group_name [String] The resource group name.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array<Factory>] operation results.
    #
    def list_by_resource_group(resource_group_name, custom_headers:nil)
      first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
      first_page.get_all_items
    end

    #
    # Lists factories.
    #
    # @param resource_group_name [String] The resource group name.
    # @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

    #
    # Lists factories.
    #
    # @param resource_group_name [String] The resource group name.
    # @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, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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.DataFactory/factories'

      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},
          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::DataFactory::Mgmt::V2017_09_01_preview::Models::FactoryListResponse.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

    #
    # Creates or updates a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param factory [Factory] Factory resource definition.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Factory] operation results.
    #
    def create_or_update(resource_group_name, factory_name, factory, custom_headers:nil)
      response = create_or_update_async(resource_group_name, factory_name, factory, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Creates or updates a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param factory [Factory] Factory resource definition.
    # @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, factory_name, factory, custom_headers:nil)
      create_or_update_async(resource_group_name, factory_name, factory, custom_headers:custom_headers).value!
    end

    #
    # Creates or updates a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param factory [Factory] Factory resource definition.
    # @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, factory_name, factory, 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, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'factory_name is nil' if factory_name.nil?
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MaxLength': '63'" if !factory_name.nil? && factory_name.length > 63
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MinLength': '3'" if !factory_name.nil? && factory_name.length < 3
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'" if !factory_name.nil? && factory_name.match(Regexp.new('^^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$$')).nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, 'factory is nil' if factory.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::DataFactory::Mgmt::V2017_09_01_preview::Models::Factory.mapper()
      request_content = @client.serialize(request_mapper,  factory)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}'

      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,'factoryName' => factory_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(: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
          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::DataFactory::Mgmt::V2017_09_01_preview::Models::Factory.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

    #
    # Updates a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param factory_update_parameters [FactoryUpdateParameters] The parameters for
    # updating a factory.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Factory] operation results.
    #
    def update(resource_group_name, factory_name, factory_update_parameters, custom_headers:nil)
      response = update_async(resource_group_name, factory_name, factory_update_parameters, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Updates a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param factory_update_parameters [FactoryUpdateParameters] The parameters for
    # updating a factory.
    # @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, factory_name, factory_update_parameters, custom_headers:nil)
      update_async(resource_group_name, factory_name, factory_update_parameters, custom_headers:custom_headers).value!
    end

    #
    # Updates a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param factory_update_parameters [FactoryUpdateParameters] The parameters for
    # updating a factory.
    # @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, factory_name, factory_update_parameters, 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, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'factory_name is nil' if factory_name.nil?
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MaxLength': '63'" if !factory_name.nil? && factory_name.length > 63
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MinLength': '3'" if !factory_name.nil? && factory_name.length < 3
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'" if !factory_name.nil? && factory_name.match(Regexp.new('^^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$$')).nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, 'factory_update_parameters is nil' if factory_update_parameters.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::DataFactory::Mgmt::V2017_09_01_preview::Models::FactoryUpdateParameters.mapper()
      request_content = @client.serialize(request_mapper,  factory_update_parameters)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}'

      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,'factoryName' => factory_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::DataFactory::Mgmt::V2017_09_01_preview::Models::Factory.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

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

    #
    # Gets a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @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, factory_name, custom_headers:nil)
      get_async(resource_group_name, factory_name, custom_headers:custom_headers).value!
    end

    #
    # Gets a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @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, factory_name, 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, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'factory_name is nil' if factory_name.nil?
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MaxLength': '63'" if !factory_name.nil? && factory_name.length > 63
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MinLength': '3'" if !factory_name.nil? && factory_name.length < 3
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'" if !factory_name.nil? && factory_name.match(Regexp.new('^^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$$')).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.DataFactory/factories/{factoryName}'

      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,'factoryName' => factory_name},
          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::DataFactory::Mgmt::V2017_09_01_preview::Models::Factory.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

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

    #
    # Deletes a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @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, factory_name, custom_headers:nil)
      delete_async(resource_group_name, factory_name, custom_headers:custom_headers).value!
    end

    #
    # Deletes a factory.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @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, factory_name, 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, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'factory_name is nil' if factory_name.nil?
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MaxLength': '63'" if !factory_name.nil? && factory_name.length > 63
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MinLength': '3'" if !factory_name.nil? && factory_name.length < 3
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'" if !factory_name.nil? && factory_name.match(Regexp.new('^^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$$')).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.DataFactory/factories/{factoryName}'

      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,'factoryName' => factory_name},
          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

    #
    # Cancel a pipeline run by its run ID.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param run_id [String] The pipeline run identifier.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def cancel_pipeline_run(resource_group_name, factory_name, run_id, custom_headers:nil)
      response = cancel_pipeline_run_async(resource_group_name, factory_name, run_id, custom_headers:custom_headers).value!
      nil
    end

    #
    # Cancel a pipeline run by its run ID.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param run_id [String] The pipeline run identifier.
    # @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 cancel_pipeline_run_with_http_info(resource_group_name, factory_name, run_id, custom_headers:nil)
      cancel_pipeline_run_async(resource_group_name, factory_name, run_id, custom_headers:custom_headers).value!
    end

    #
    # Cancel a pipeline run by its run ID.
    #
    # @param resource_group_name [String] The resource group name.
    # @param factory_name [String] The factory name.
    # @param run_id [String] The pipeline run identifier.
    # @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 cancel_pipeline_run_async(resource_group_name, factory_name, run_id, 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, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'factory_name is nil' if factory_name.nil?
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MaxLength': '63'" if !factory_name.nil? && factory_name.length > 63
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'MinLength': '3'" if !factory_name.nil? && factory_name.length < 3
      fail ArgumentError, "'factory_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'" if !factory_name.nil? && factory_name.match(Regexp.new('^^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$$')).nil?
      fail ArgumentError, 'run_id is nil' if run_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.DataFactory/factories/{factoryName}/cancelpipelinerun/{runId}'

      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,'factoryName' => factory_name,'runId' => run_id},
          query_params: {'api-version' => @client.api_version},
          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
          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

    #
    # Lists factories under the specified subscription.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [FactoryListResponse] operation results.
    #
    def list_next(next_page_link, custom_headers:nil)
      response = list_next_async(next_page_link, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Lists factories under the specified subscription.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List 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 list_next_with_http_info(next_page_link, custom_headers:nil)
      list_next_async(next_page_link, custom_headers:custom_headers).value!
    end

    #
    # Lists factories under the specified subscription.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List 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 list_next_async(next_page_link, custom_headers:nil)
      fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nextLink' => next_page_link},
          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::DataFactory::Mgmt::V2017_09_01_preview::Models::FactoryListResponse.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

    #
    # Lists factories.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [FactoryListResponse] operation results.
    #
    def list_by_resource_group_next(next_page_link, custom_headers:nil)
      response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Lists factories.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List 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 list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
    end

    #
    # Lists factories.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List 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 list_by_resource_group_next_async(next_page_link, custom_headers:nil)
      fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nextLink' => next_page_link},
          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::DataFactory::Mgmt::V2017_09_01_preview::Models::FactoryListResponse.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

    #
    # Lists factories under the specified subscription.
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [FactoryListResponse] which provide lazy access to pages of the
    # response.
    #
    def list_as_lazy(custom_headers:nil)
      response = list_async(custom_headers:custom_headers).value!
      unless response.nil?
        page = response.body
        page.next_method = Proc.new do |next_page_link|
          list_next_async(next_page_link, custom_headers:custom_headers)
        end
        page
      end
    end

    #
    # Lists factories.
    #
    # @param resource_group_name [String] The resource group name.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [FactoryListResponse] which provide lazy access to pages of the
    # response.
    #
    def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
      response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
      unless response.nil?
        page = response.body
        page.next_method = Proc.new do |next_page_link|
          list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
        end
        page
      end
    end

  end
end


text:
import { Schema } from 'mongoose';
import mongoose from '../../services/mongoose';

const showSchema = new Schema({
  tvmazeID: {
    type: String,
    required: true,
    unique: true,
  },
  imdbID: {
    type: String,
    unique: true,
  },
  name: {
    type: String,
    required: true,
  },
  current_season: Number,
  magnets: [{
    sd: {
      title: String,
      link: String,
    },
    _720p: {
      title: String,
      link: String,
    },
    _1080p: {
      title: String,
      link: String,
    },
  }, { timestamps: true }],
});

const model = mongoose.model('TvShow', showSchema);

export const schema = model.schema;
export default model;

redpajama_set_name: RedPajamaGithub


text:
using System.Web;
using System.Web.Mvc;

namespace BootstrapComponents.Components.Images
{
    public static class ImageExtensions
    {
        public static IHtmlString Image(this HtmlHelper html, string src, string alt, Image.Style style, bool responsive = false)
        {
            return new Image(src, alt, style, responsive);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Monitorian.Core.Models
{
	internal class DocumentService
	{
		public static string ReadEmbeddedFile(string fileName)
		{
			var assembly = Assembly.GetEntryAssembly();

			try
			{
				var resourceName = assembly.GetManifestResourceNames().FirstOrDefault(x => x.EndsWith(fileName));
				if (resourceName is null)
					return null;

				using (var s = assembly.GetManifestResourceStream(resourceName))
				using (var sr = new StreamReader(s))
					return sr.ReadToEnd();
			}
			catch (Exception ex)
			{
				Debug.WriteLine("Failed to read an embedded file." + Environment.NewLine
					+ ex);
				return null;
			}
		}

		public static string SaveTempFileAsHtml(string fileName, string title, string body)
		{
			var filePath = Path.Combine(Path.GetTempPath(), $"{Path.GetFileNameWithoutExtension(fileName)}.html");
			SaveFileAsHtml(filePath, title, body);
			return filePath;
		}

		public static void SaveFileAsHtml(string filePath, string title, string body)
		{
			if (string.IsNullOrWhiteSpace(filePath))
				throw new ArgumentNullException(nameof(filePath));

			if (string.IsNullOrWhiteSpace(title))
				title = Path.GetFileNameWithoutExtension(filePath);

			var html = BuildHtml(title, body);

			using (var sw = new StreamWriter(filePath, false, Encoding.UTF8)) // BOM will be emitted.
				sw.Write(html);
		}

		private static string BuildHtml(string title, string body)
		{
			body = body?
				.Split(new[] { "\r\n\r\n", "\n\n" /* two consecutive line breaks */ }, StringSplitOptions.RemoveEmptyEntries)
				.Select(x =>
				{
					var array = x.Split(Array.Empty<char>(), 2, StringSplitOptions.RemoveEmptyEntries);
					var (tag, content) = array.First() switch
					{
						"#" => ("h1", array.Last()),
						"##" => ("h2", array.Last()),
						"###" => ("h3", array.Last()),
						_ => ("p", x)
					};
					return $"<{tag}>{content}</{tag}>";
				})
				.Aggregate((w, n) => $"{w}\r\n{n}");

			return $@"<!DOCTYPE html>
<html>
<head>
<meta charset=""utf-8""/>
<title>{title}</title>
<style type=""text/css"">
<!-- body {{ margin: 0 30px; font-family: Consolas, monospace; }} -->
</style>
</head>
<body>
{body}
</body>
</html>";
		}
	}
}


text:
{% extends "base.html" %}
{% load static core_tags wagtailcore_tags wagtailimages_tags %}

{% block content %}

            {% block share_links %}
                {% include 'articles/includes/share_links.html' %}
            {% endblock %}

{{ self.get_parent.title }}

{{ self.title }}

{{ self.subtitle|richtext }}

                {% if self.authors %}

Series Contributors:

                            {% for author in self.authors %}

{{ author.first_name }} {{ author.last_name }}

                            {% endfor %}

               {% endif %}

            {% if self.include_main_image %}

                    {% image self.main_image fill-940x627 %}

                {% if self.main_image.credit %}

                        {{ self.main_image.credit }}

                {% endif %}
                {% if self.main_image.source %}

                        {{ self.main_image.source }}

                {% endif %}
            {% endif %}

{{ self.body }}

In the series

                {% with articles=self.articles %}
                    {% block in_the_series %}
                        {% include 'articles/includes/in_the_series.html' %}
                    {% endblock %}
                {% endwith %}

            {% if self.topics %}

 Topics:

                        {% for topic in self.topics %}

{{ topic }}

                        {% endfor %}

            {% endif %}

        {% block related_articles %}
            {% with article_count=6 %}
                {% include 'articles/includes/related_articles.html'  with heading='h3' image=True%}
            {% endwith %}
        {% endblock %}

{% endblock %}


text:
namespace blink {

class ComputedStyle;
class DisplayLockContext;
class Document;
class LayoutObject;
class LayoutBox;
class NGConstraintSpace;
class NGPaintFragment;
struct MinMaxSizes;
struct PhysicalSize;

// The input to the min/max inline size calculation algorithm for child nodes.
// Child nodes within the same formatting context need to know which floats are
// beside them.
struct MinMaxSizesInput {
  // The min-max size calculation (un-intuitively) requires a percentage
  // resolution size!
  // This occurs when a replaced element has an intrinsic size. E.g.
  //

  //
  //

  // In the above example float ends up with a width of 50px.
  //
  // As we don't perform any tree walking, we need to pass the percentage
  // resolution block-size for min/max down the min/max size calculation.
  explicit MinMaxSizesInput(LayoutUnit percentage_resolution_block_size)
      : percentage_resolution_block_size(percentage_resolution_block_size) {}
  LayoutUnit float_left_inline_size;
  LayoutUnit float_right_inline_size;
  LayoutUnit percentage_resolution_block_size;
};

// The output of the min/max inline size calculation algorithm. Contains the
// min/max sizes, and if this calculation will change if the
// |MinMaxSizesInput::percentage_resolution_block_size| value changes.
struct MinMaxSizesResult {
  MinMaxSizes sizes;
  bool depends_on_percentage_block_size = false;
};

// Represents the input to a layout algorithm for a given node. The layout
// engine should use the style, node type to determine which type of layout
// algorithm to use to produce fragments for this node.
class CORE_EXPORT NGLayoutInputNode {
  DISALLOW_NEW();

 public:
  enum NGLayoutInputNodeType {
    kBlock,
    kInline
    // When adding new values, ensure type_ below has enough bits.
  };

  static NGLayoutInputNode Create(LayoutBox* box, NGLayoutInputNodeType type) {
    // This function should create an instance of the subclass. This works
    // because subclasses are not virtual and do not add fields.
    return NGLayoutInputNode(box, type);
  }

  NGLayoutInputNode(std::nullptr_t) : box_(nullptr), type_(kBlock) {}

  NGLayoutInputNodeType Type() const {
    return static_cast<NGLayoutInputNodeType>(type_);
  }
  bool IsInline() const { return type_ == kInline; }
  bool IsBlock() const { return type_ == kBlock; }

  bool IsBlockFlow() const { return IsBlock() && box_->IsLayoutBlockFlow(); }
  bool IsLayoutNGCustom() const {
    return IsBlock() && box_->IsLayoutNGCustom();
  }
  bool IsColumnSpanAll() const { return IsBlock() && box_->IsColumnSpanAll(); }
  bool IsFloating() const { return IsBlock() && box_->IsFloating(); }
  bool IsOutOfFlowPositioned() const {
    return IsBlock() && box_->IsOutOfFlowPositioned();
  }
  bool IsReplaced() const { return box_->IsLayoutReplaced(); }
  bool IsAbsoluteContainer() const {
    return box_->CanContainAbsolutePositionObjects();
  }
  bool IsFixedContainer() const {
    return box_->CanContainFixedPositionObjects();
  }
  bool IsBody() const { return IsBlock() && box_->IsBody(); }
  bool IsDocumentElement() const { return box_->IsDocumentElement(); }
  bool IsFlexItem() const { return IsBlock() && box_->IsFlexItemIncludingNG(); }
  bool IsFlexibleBox() const {
    return IsBlock() && box_->IsFlexibleBoxIncludingNG();
  }
  bool ShouldBeConsideredAsReplaced() const {
    return box_->ShouldBeConsideredAsReplaced();
  }
  bool IsListItem() const { return IsBlock() && box_->IsLayoutNGListItem(); }
  bool IsListMarker() const {
    return IsBlock() && box_->IsLayoutNGOutsideListMarker();
  }
  bool ListMarkerOccupiesWholeLine() const {
    DCHECK(IsListMarker());
    return ToLayoutNGOutsideListMarker(box_)->NeedsOccupyWholeLine();
  }
  bool IsFieldsetContainer() const {
    return IsBlock() && box_->IsLayoutNGFieldset();
  }
  bool IsRubyRun() const { return IsBlock() && box_->IsRubyRun(); }
  bool IsRubyText() const { return IsBlock() && box_->IsRubyText(); }

  // Return true if this is the legend child of a fieldset that gets special
  // treatment (i.e. placed over the block-start border).
  bool IsRenderedLegend() const {
    return IsBlock() && box_->IsRenderedLegend();
  }
  bool IsTable() const { return IsBlock() && box_->IsTable(); }

  bool IsMathRoot() const { return box_->IsMathMLRoot(); }

  bool IsAnonymousBlock() const { return box_->IsAnonymousBlock(); }

  // If the node is a quirky container for margin collapsing, see:
  // https://html.spec.whatwg.org/C/#margin-collapsing-quirks
  // NOTE: The spec appears to only somewhat match reality.
  bool IsQuirkyContainer() const {
    return box_->GetDocument().InQuirksMode() &&
           (box_->IsBody() || box_->IsTableCell());
  }

  // Return true if this node is monolithic for block fragmentation.
  bool IsMonolithic() const {
    // Lines are always monolithic. We cannot block-fragment inside them.
    if (IsInline())
      return true;
    return box_->GetPaginationBreakability() == LayoutBox::kForbidBreaks;
  }

  bool CreatesNewFormattingContext() const {
    return IsBlock() && box_->CreatesNewFormattingContext();
  }

  // Returns true if this node should pass its percentage resolution block-size
  // to its children. Typically only quirks-mode, auto block-size, block nodes.
  bool UseParentPercentageResolutionBlockSizeForChildren() const {
    auto* layout_block = DynamicTo<LayoutBlock>(box_);
    if (IsBlock() && layout_block) {
      return LayoutBoxUtils::SkipContainingBlockForPercentHeightCalculation(
          layout_block);
    }

    return false;
  }

  // Returns the border-box min/max content sizes for the node.
  MinMaxSizesResult ComputeMinMaxSizes(WritingMode,
                                       const MinMaxSizesInput&,
                                       const NGConstraintSpace* = nullptr);

  // Returns intrinsic sizing information for replaced elements.
  // ComputeReplacedSize can use it to compute actual replaced size.
  // Corresponds to Legacy's LayoutReplaced::IntrinsicSizingInfo.
  // Use NGBlockNode::GetAspectRatio to get the aspect ratio.
  void IntrinsicSize(base::Optional<LayoutUnit>* computed_inline_size,
                     base::Optional<LayoutUnit>* computed_block_size) const;

  // Returns the next sibling.
  NGLayoutInputNode NextSibling();

  Document& GetDocument() const { return box_->GetDocument(); }

  PhysicalSize InitialContainingBlockSize() const;

  // Returns the LayoutObject which is associated with this node.
  LayoutBox* GetLayoutBox() const { return box_; }

  const ComputedStyle& Style() const { return box_->StyleRef(); }

  bool ShouldApplySizeContainment() const {
    return box_->ShouldApplySizeContainment();
  }

  // CSS defines certain cases to synthesize inline block baselines from box.
  // See comments in UseLogicalBottomMarginEdgeForInlineBlockBaseline().
  bool UseBlockEndMarginEdgeForInlineBlockBaseline() const {
    if (auto* layout_box = DynamicTo<LayoutBlock>(GetLayoutBox()))
      return layout_box->UseLogicalBottomMarginEdgeForInlineBlockBaseline();
    return false;
  }

  // CSS intrinsic sizing getters.
  // https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override
  // Note that this returns kIndefiniteSize if the override was not specified.
  LayoutUnit OverrideIntrinsicContentInlineSize() const {
    if (box_->HasOverrideIntrinsicContentLogicalWidth())
      return box_->OverrideIntrinsicContentLogicalWidth();
    return kIndefiniteSize;
  }
  // Note that this returns kIndefiniteSize if the override was not specified.
  LayoutUnit OverrideIntrinsicContentBlockSize() const {
    if (box_->HasOverrideIntrinsicContentLogicalHeight())
      return box_->OverrideIntrinsicContentLogicalHeight();
    return kIndefiniteSize;
  }

  LayoutUnit DefaultIntrinsicContentInlineSize() const {
    return box_->DefaultIntrinsicContentInlineSize();
  }
  LayoutUnit DefaultIntrinsicContentBlockSize() const {
    return box_->DefaultIntrinsicContentBlockSize();
  }

  // Display locking functionality.
  const DisplayLockContext& GetDisplayLockContext() const {
    DCHECK(box_->GetDisplayLockContext());
    return *box_->GetDisplayLockContext();
  }
  bool LayoutBlockedByDisplayLock(DisplayLockLifecycleTarget target) const {
    return box_->LayoutBlockedByDisplayLock(target);
  }

  // Returns the first NGPaintFragment for this node. When block fragmentation
  // occurs, there will be multiple NGPaintFragment for a node.
  const NGPaintFragment* PaintFragment() const;

  CustomLayoutChild* GetCustomLayoutChild() const {
    // TODO(ikilpatrick): Support NGInlineNode.
    DCHECK(IsBlock());
    return box_->GetCustomLayoutChild();
  }

  String ToString() const;

  explicit operator bool() const { return box_ != nullptr; }

  bool operator==(const NGLayoutInputNode& other) const {
    return box_ == other.box_;
  }

  bool operator!=(const NGLayoutInputNode& other) const {
    return !(*this == other);
  }

#if DCHECK_IS_ON()
  void ShowNodeTree() const;
#endif

 protected:
  NGLayoutInputNode(LayoutBox* box, NGLayoutInputNodeType type)
      : box_(box), type_(type) {}

  void GetOverrideIntrinsicSize(
      base::Optional<LayoutUnit>* computed_inline_size,
      base::Optional<LayoutUnit>* computed_block_size) const;

  LayoutBox* box_;

  unsigned type_ : 1;  // NGLayoutInputNodeType
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_NG_LAYOUT_INPUT_NODE_H_


text:
require "rss"

def error(exception)
  mark = "=" * 20
  mark = "#{mark} error #{mark}"
  puts mark
  puts exception.class
  puts exception.message
  puts exception.backtrace
  puts mark
end

verbose = false
before_time = Time.now

ARGV.each do |fname|
  if fname == '-v'
    verbose = true
    next
  end
  source = nil
  File.open(fname) do |f|
    source = f.read
  end

  rss = nil
  read = false
  begin
    rss = RSS::Parser.parse(source)
    puts "Re-read valid RSS: #{fname}"
    RSS::Parser.parse(rss.to_s)
    read = true
  rescue RSS::InvalidRSSError
    error($!) if verbose
    ## do non validate parse for invalid RSS 1.0
    begin
      rss = RSS::Parser.parse(source, false)
    rescue RSS::Error
      ## invalid RSS.
      error($!) if verbose
    end
  rescue RSS::Error
    error($!) if verbose
  end

  if rss.nil?
    puts "Invalid RSS: #{fname}"
  elsif !read
    puts "Re-read invalid RSS: #{fname}"
    begin
      RSS::Parser.parse(rss.to_s)
    rescue RSS::Error
      puts "  Error occurred: #{fname}"
      error($!) if verbose
    end
  end
end

processing_time = Time.now - before_time

puts "Used XML parser: #{RSS::Parser.default_parser}"
puts "Processing time: #{processing_time}s"


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LionFire.Trading
{
    public static class MarketSeriesUtilities
    {
        public const char Delimiter = ';';

        public static string GetSeriesKey(this string symbol, TimeFrame timeFrame)
        {
            return symbol + Delimiter.ToString() + timeFrame.Name;
        }

        internal static void DecodeKey(string key, out string symbol, out TimeFrame timeFrame)
        {
            var chunks = key.Split(Delimiter);
            symbol = chunks[0];
            timeFrame = TimeFrame.TryParse(chunks[1]);
        }

    }
}


text:
package kafka.api;

import kafka.common.TopicAndPartition;
import kafka.utils.Function0;
import kafka.utils.Tuple2;
import kafka.utils.Utils;

import java.nio.ByteBuffer;
import java.util.Map;

import static kafka.api.ApiUtils.readShortString;

public class OffsetRequestReader implements RequestReader {
    public static final RequestReader instance = new OffsetRequestReader();

    public static final short CurrentVersion = 0;
    public static final String DefaultClientId = "";

    public static final String SmallestTimeString = "smallest";
    public static final String LargestTimeString = "largest";
    public static final long LatestTime = -1L;
    public static final long EarliestTime = -2L;

    @Override
    public RequestOrResponse readFrom(final ByteBuffer buffer) {
        short versionId = buffer.getShort();
        int correlationId = buffer.getInt();
        String clientId = readShortString(buffer);
        int replicaId = buffer.getInt();
        int topicCount = buffer.getInt();
        Map<TopicAndPartition, PartitionOffsetRequestInfo> pairs = Utils.flatMaps(1, topicCount, new Function0<Map<TopicAndPartition, PartitionOffsetRequestInfo>>() {
            @Override
            public Map<TopicAndPartition, PartitionOffsetRequestInfo> apply() {
                final String topic = readShortString(buffer);
                int partitionCount = buffer.getInt();

                return Utils.flatMap(1, partitionCount, new Function0<Tuple2<TopicAndPartition, PartitionOffsetRequestInfo>>() {
                    @Override
                    public Tuple2<TopicAndPartition, PartitionOffsetRequestInfo> apply() {
                        int partitionId = buffer.getInt();
                        long time = buffer.getLong();
                        int maxNumOffsets = buffer.getInt();

                        return Tuple2.make(new TopicAndPartition(topic, partitionId), new PartitionOffsetRequestInfo(time, maxNumOffsets));
                    }
                });
            }
        });

        return new OffsetRequest(pairs, versionId, correlationId, clientId, replicaId);

    }
}


text:
CoDeX contains learned data compression tools for JAX.

You can use this library to build your own ML models with end-to-end optimized
data compression built in. It's useful to find storage-efficient representations
of your data (images, features, examples, etc.) while only sacrificing a small
fraction of model performance.

For a more in-depth introduction from a classical data compression perspective,
consider our [paper on nonlinear transform
coding](https://arxiv.org/abs/2007.03034), or watch @jonycgn's [talk on learned
image compression](https://www.youtube.com/watch?v=x_q7cZviXkY). For an
introduction to lossy data compression from a machine learning perspective, take
a look at @yiboyang's [review paper](https://arxiv.org/abs/2202.06533).

## Documentation & getting help

Please post all questions or comments on
[Discussions](https://github.com/google/codex/discussions). Only file
[Issues](https://github.com/google/codex/issues) for actual bugs or feature
requests. On Discussions, you may get a faster answer, and you help other people
find the question or answer more easily later.

## Installation

To install CoDeX via `pip`, run the following command:

```bash
pip install jax-codex
```

To test that the installation works correctly, you can run the unit tests with:

```bash
python -m codex.all_tests
```

Once the command finishes, you should see a message ```13 passed in 2.76s``` or
similar in the last line.

## Usage

We recommend importing the library from your Python code as follows:

```python
import codex as cdx
```

## Citation

If you use this library for research purposes, please cite:
```
@software{codex_github,
  author = "Ballé, Johannes and Hwang, Sung Jin and Agustsson, Eirikur",
  title = "{CoDeX}: Learned Data Compression in {JAX}",
  url = "http://github.com/google/codex",
  version = "0.0.1",
  year = "2022",
}
```
In the above BibTeX entry, names are top contributors sorted by number of
commits. Please adjust version number and year according to the version that was
actually used.

Note that this is not an officially supported Google product.


text:
package expert

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"

	"github.com/go-swagger/go-swagger/client"
	"github.com/go-swagger/go-swagger/strfmt"
)

// New creates a new expert API client.
func New(transport client.Transport, formats strfmt.Registry) *Client {
	return &Client{transport: transport, formats: formats}
}

/*
Client for expert API
*/
type Client struct {
	transport client.Transport
	formats   strfmt.Registry
}

/*删除专家

删除指定专家

*/
func (a *Client) DeleteExpertsID(params *DeleteExpertsIDParams, authInfo client.AuthInfoWriter) (*DeleteExpertsIDOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteExpertsIDParams()
	}

	result, err := a.transport.Submit(&client.Operation{
		ID:       "DeleteExpertsID",
		Params:   params,
		Reader:   &DeleteExpertsIDReader{formats: a.formats},
		AuthInfo: authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteExpertsIDOK), nil
}

/*查看专家列表

查看所有专家,支持分页和过滤器

*/
func (a *Client) GetExperts(params *GetExpertsParams, authInfo client.AuthInfoWriter) (*GetExpertsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetExpertsParams()
	}

	result, err := a.transport.Submit(&client.Operation{
		ID:       "GetExperts",
		Params:   params,
		Reader:   &GetExpertsReader{formats: a.formats},
		AuthInfo: authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetExpertsOK), nil
}

/*查询专家

得到指定专家的具体信息

*/
func (a *Client) GetExpertsID(params *GetExpertsIDParams, authInfo client.AuthInfoWriter) (*GetExpertsIDOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetExpertsIDParams()
	}

	result, err := a.transport.Submit(&client.Operation{
		ID:       "GetExpertsID",
		Params:   params,
		Reader:   &GetExpertsIDReader{formats: a.formats},
		AuthInfo: authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetExpertsIDOK), nil
}

/*创建专家

根据请求创建专家

*/
func (a *Client) PostExperts(params *PostExpertsParams, authInfo client.AuthInfoWriter) (*PostExpertsCreated, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPostExpertsParams()
	}

	result, err := a.transport.Submit(&client.Operation{
		ID:       "PostExperts",
		Params:   params,
		Reader:   &PostExpertsReader{formats: a.formats},
		AuthInfo: authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*PostExpertsCreated), nil
}

/*更新专家

根据请求中指定要更新的属性对专家进行更新

Example:
1. 更新专家姓名和邮件
    ```json
    {
      "name":"newName",
      "email": "new@email.com"
    }
    ```

*/
func (a *Client) PutExpertsID(params *PutExpertsIDParams, authInfo client.AuthInfoWriter) (*PutExpertsIDOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPutExpertsIDParams()
	}

	result, err := a.transport.Submit(&client.Operation{
		ID:       "PutExpertsID",
		Params:   params,
		Reader:   &PutExpertsIDReader{formats: a.formats},
		AuthInfo: authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*PutExpertsIDOK), nil
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport client.Transport) {
	a.transport = transport
}

// NewAPIError creates a new API error
func NewAPIError(opName string, response interface{}, code int) APIError {
	return APIError{
		OperationName: opName,
		Response:      response,
		Code:          code,
	}
}

// APIError wraps an error model and captures the status code
type APIError struct {
	OperationName string
	Response      interface{}
	Code          int
}

func (a APIError) Error() string {
	return fmt.Sprintf("%s (status %d): %+v ", a.OperationName, a.Code, a.Response)
}


text:
case node[:platform]
when 'redhat', 'centos', 'scientific', 'fedora', 'suse', 'amazon'
  default[:aws][:cli] = '/usr/bin/aws'
when 'debian', 'ubuntu'
  default[:aws][:cli] = '/usr/local/bin/aws'
else
  fail 'OS Not Supported'
end
Chef::Log.info "Platform: #{node[:platform]}, CLI: #{node[:aws][:cli]}"
default['build-essential']['compile_time'] = true


text:
const mainWindow = new BrowserWindow({
  webPreferences: {
    allowRunningInsecureContent: true
  }
})


text:
<?php

namespace App\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Table(name="event__ticketsCost",
 *     indexes={
 *         @ORM\Index(columns={"type"}),
 *         @ORM\Index(columns={"tickets_run_out"}),
 *         @ORM\Index(columns={"end_date"}),
 *         @ORM\Index(columns={"enabled"}),
 *         @ORM\Index(columns={"visible"}),
 *     })
 * @ORM\Entity(repositoryClass="App\Repository\TicketCostRepository")
 */
class TicketCost
{
    public const TYPE_FREE = 'free';
    public const TYPE_STANDARD = 'standard';
    public const TYPE_PREMIUM = 'premium';

    public const TYPES = self::TYPE_FREE.'|'.self::TYPE_PREMIUM.'|'.self::TYPE_STANDARD;
    public const CERTIFICATED_TYPES = self::TYPE_PREMIUM;

    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;
    /**
     * @var Event
     *
     * @ORM\ManyToOne(targetEntity="App\Entity\Event", inversedBy="ticketsCost")
     * @ORM\JoinColumn(name="event_id", referencedColumnName="id")
     */
    private $event;

    /**
     * @var ArrayCollection
     *
     * @ORM\OneToMany(targetEntity="App\Entity\Ticket",
     *      mappedBy="ticketCost",
     *      cascade={"persist"})
     */
    private $tickets;

    /**
     * @var int
     *
     * @ORM\Column(name="count", type="integer", nullable=true)
     *
     * @Assert\GreaterThanOrEqual(0)
     */
    private $count;

    /**
     * Сумма для оплаты.
     *
     * @var float
     *
     * @ORM\Column(name="amount", type="decimal", precision=10, scale=2)
     *
     * @Assert\GreaterThanOrEqual(0)
     */
    private $amount;

    /**
     * Альтернативна сума оплати.
     *
     * @var float
     *
     * @ORM\Column(name="alt_amount", type="decimal", precision=10, scale=2)
     *
     * @Assert\GreaterThanOrEqual(0)
     */
    private $altAmount;

    /**
     * @var int
     *
     * @ORM\Column(name="sold_count", type="integer", nullable=true)
     */
    private $soldCount = 0;

    /**
     * @var bool
     *
     * @ORM\Column(name="enabled", type="boolean", nullable=false, options={"default":"1"})
     */
    private $enabled = true;

    /**
     * @var bool
     *
     * @ORM\Column(name="unlimited", type="boolean", nullable=false, options={"default":"0"})
     */
    private $unlimited = false;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", nullable=false)
     *
     * @Assert\NotBlank()
     */
    private $name;

    /**
     * @var int
     */
    private $temporaryCount = 0;

    /**
     * @var bool
     *
     * @ORM\Column(name="tickets_run_out", type="boolean", options={"default":false})
     */
    private $ticketsRunOut = false;

    /**
     * @var bool
     *
     * @ORM\Column(name="coming_soon", type="boolean", options={"default":false})
     */
    private $comingSoon = false;

    /**
     * @var bool
     *
     * @ORM\Column(name="visible", type="boolean", options={"default":true})
     */
    private $visible = true;

    /**
     * @var \DateTime|null
     *
     * @ORM\Column(name="end_date", type="datetime", nullable=true, options={"default":null})
     */
    private $endDate = null;

    /**
     * @var int|null
     *
     * @ORM\Column(name="sort_order", type="integer", nullable=true)
     */
    private $sortOrder;

    /**
     * @var string|null
     *
     * @ORM\Column(type="string", nullable=true, length=20)
     */
    private $type;

    /**
     * TicketCost constructor.
     */
    public function __construct()
    {
        $this->tickets = new ArrayCollection();
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @return float
     */
    public function getAmountByTemporaryCount(): float
    {
        ++$this->temporaryCount;

        return $this->getAmount();
    }

    /**
     * @return bool
     */
    public function isHaveTemporaryCount(): bool
    {
        return ($this->isUnlimitedOrDateEnd() || ($this->soldCount + $this->temporaryCount) < $this->count) && $this->enabled;
    }

    /**
     * @return mixed
     */
    public function getTickets()
    {
        return $this->tickets;
    }

    /**
     * @param ArrayCollection $tickets
     *
     * @return $this
     */
    public function setTickets($tickets)
    {
        $this->tickets = $tickets;

        return $this;
    }

    /**
     * @param Ticket $ticket
     *
     * @return $this
     */
    public function addTicket($ticket)
    {
        if (!$this->tickets->contains($ticket)) {
            $this->tickets->add($ticket);
        }

        return $this;
    }

    /**
     * @param Ticket $ticket
     *
     * @return $this
     */
    public function removeTicket($ticket)
    {
        if ($this->tickets->contains($ticket)) {
            $this->tickets->removeElement($ticket);
        }

        return $this;
    }

    /**
     * @return float|null
     */
    public function getAltAmount(): ?float
    {
        return $this->altAmount;
    }

    /**
     * @param float $altAmount
     *
     * @return $this
     */
    public function setAltAmount($altAmount)
    {
        $this->altAmount = $altAmount;

        return $this;
    }

    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param string $name
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * @return Event
     */
    public function getEvent()
    {
        return $this->event;
    }

    /**
     * @param Event $event
     *
     * @return $this
     */
    public function setEvent($event)
    {
        $this->event = $event;

        return $this;
    }

    /**
     * @return int
     */
    public function getCount()
    {
        return $this->count;
    }

    /**
     * @param int $count
     *
     * @return $this
     */
    public function setCount($count)
    {
        $this->count = $count;

        return $this;
    }

    /**
     * @return float|null
     */
    public function getAmount(): ?float
    {
        return $this->amount;
    }

    /**
     * @param float $amount
     *
     * @return $this
     */
    public function setAmount($amount)
    {
        $this->amount = $amount;

        return $this;
    }

    /**
     * @return int
     */
    public function getSoldCount()
    {
        return $this->soldCount;
    }

    /**
     * @param int $soldCount
     *
     * @return $this
     */
    public function setSoldCount($soldCount)
    {
        $this->soldCount = $soldCount;

        return $this;
    }

    /**
     * @return int
     */
    public function recalculateSoldCount()
    {
        $soldCount = 0;
        /** @var Ticket $ticket */
        foreach ($this->getTickets() as $ticket) {
            if ($ticket->isPaid()) {
                ++$soldCount;
            }
        }
        $this->soldCount = $soldCount;

        if (!$this->isUnlimitedOrDateEnd() && $this->isEnabled()) {
            $this->setEnabled($this->count > $this->soldCount);
        }

        return $this->soldCount;
    }

    /**
     * @return $this
     */
    public function decSoldCount()
    {
        --$this->soldCount;

        return $this;
    }

    /**
     * @return bool
     */
    public function isEnabled()
    {
        return $this->enabled;
    }

    /**
     * @param bool $enabled
     *
     * @return $this
     */
    public function setEnabled($enabled)
    {
        $this->enabled = $enabled;

        return $this;
    }

    /**
     * @return bool
     */
    public function isUnlimited()
    {
        return $this->unlimited;
    }

    /**
     * @return bool
     */
    public function isUnlimitedOrDateEnd()
    {
        return $this->unlimited || $this->endDateIsMoreThanNow();
    }

    /**
     * @param bool $unlimited
     *
     * @return $this
     */
    public function setUnlimited($unlimited)
    {
        $this->unlimited = $unlimited;

        return $this;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return $this->event->getName().'-'.$this->getName();
    }

    /**
     * @return bool
     */
    public function isTicketsRunOut(): bool
    {
        return $this->ticketsRunOut;
    }

    /**
     * @param bool $ticketsRunOut
     *
     * @return $this
     */
    public function setTicketsRunOut(bool $ticketsRunOut): self
    {
        $this->ticketsRunOut = $ticketsRunOut;

        return $this;
    }

    /**
     * @return bool
     */
    public function isComingSoon(): bool
    {
        return $this->comingSoon;
    }

    /**
     * @param bool $comingSoon
     *
     * @return $this
     */
    public function setComingSoon(bool $comingSoon): self
    {
        $this->comingSoon = $comingSoon;

        return $this;
    }

    /**
     * @return bool
     */
    public function isVisible(): bool
    {
        return $this->visible;
    }

    /**
     * @param bool $visible
     *
     * @return $this
     */
    public function setVisible(bool $visible): self
    {
        $this->visible = $visible;

        return $this;
    }

    /**
     * @return \DateTime|null
     */
    public function getEndDate(): ?\DateTime
    {
        return $this->endDate;
    }

    /**
     * @param \DateTime|null $endDate
     *
     * @return $this
     */
    public function setEndDate(?\DateTime $endDate): self
    {
        $this->endDate = $endDate;

        return $this;
    }

    /**
     * @return bool
     */
    public function endDateIsMoreThanNow(): bool
    {
        return ($this->endDate instanceof \DateTime) && ((new \DateTime()) <= $this->endDate);
    }

    /**
     * @return int|null
     */
    public function getSortOrder(): ?int
    {
        return $this->sortOrder;
    }

    /**
     * @param int|null $sortOrder
     */
    public function setSortOrder(?int $sortOrder): void
    {
        $this->sortOrder = $sortOrder;
    }

    /**
     * @return array|string[]
     */
    public static function getTypes(): array
    {
        return [
            self::TYPE_FREE => self::TYPE_FREE,
            self::TYPE_STANDARD => self::TYPE_STANDARD,
            self::TYPE_PREMIUM => self::TYPE_PREMIUM,
        ];
    }

    /**
     * @return array|string[]
     */
    public static function getTypesWithOutFree(): array
    {
        return [
            self::TYPE_STANDARD => self::TYPE_STANDARD,
            self::TYPE_PREMIUM => self::TYPE_PREMIUM,
        ];
    }

    /**
     * @return string|null
     */
    public function getType(): ?string
    {
        return $this->type;
    }

    /**
     * @param string $type
     *
     * @return $this
     */
    public function setType(string $type)
    {
        $this->type = $type;

        return $this;
    }
}


text:
Slim adapter to wrap mouse, touch, and kinect into one interface.

This library wraps up input from several different devices into a single interface.

https://github.com/dmanning23/MouseBuddy

https://github.com/dmanning23/TouchScreenBuddy

TODO: kinect


text:
package com.github.wuic.engine.core;

import com.github.wuic.ApplicationConfig;
import com.github.wuic.engine.AbstractEngineBuilder;
import com.github.wuic.engine.Engine;
import com.github.wuic.engine.SpriteProvider;
import com.github.wuic.engine.impl.embedded.SpriteInspectorEngine;
import com.github.wuic.engine.setter.*;
import com.github.wuic.exception.BuilderPropertyNotSupportedException;

/**
 *

 * This builder creates engine that compresses images.
 *

 *
 * @author Guillaume DROUET
 * @version 1.0
 * @since 0.4.4
 */
public class SpriteInspectorEngineBuilder extends AbstractEngineBuilder {

    /**
     *

     * Builds a new instance.
     *

     */
    public SpriteInspectorEngineBuilder() {
        super();
        addPropertySetter(new SpriteProviderPropertySetter(this), new InspectPropertySetter(this));
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Engine internalBuild() throws BuilderPropertyNotSupportedException {
        return new SpriteInspectorEngine((Boolean) property(ApplicationConfig.INSPECT),
                (SpriteProvider[]) property(ApplicationConfig.SPRITE_PROVIDER_CLASS_NAME));
    }
}


text:
<?php
namespace CajaBanco\BackendBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class BancoType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('nombre')
                ->add('ruc')
                ->add('direccion')
                ->add('ciudad')
                ->add('telefono')
                ->add('email')
        ;
    }
    public function getName()
    {
        return 'banco_form';
    }
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'CajaBanco\BackendBundle\Entity\Banco',
        ));
    }

}