text:
from msrest.pipeline import ClientRawResponse
import uuid

from .. import models

class PoolOperations(object):
    """PoolOperations operations.

    :param client: Client for service requests.
    :param config: Configuration of service client.
    :param serializer: An object model serializer.
    :param deserializer: An objec model deserializer.
    """

    def __init__(self, client, config, serializer, deserializer):

        self._client = client
        self._serialize = serializer
        self._deserialize = deserializer

        self.config = config

    def list_usage_metrics(
            self, pool_list_usage_metrics_options=None, custom_headers=None, raw=False, **operation_config):
        """Lists the usage metrics, aggregated by pool across individual time
        intervals, for the specified account.

        If you do not specify a $filter clause including a poolId, the response
        includes all pools that existed in the account in the time range of the
        returned aggregation intervals.

        :param pool_list_usage_metrics_options: Additional parameters for the
         operation
        :type pool_list_usage_metrics_options:
         :class:`PoolListUsageMetricsOptions
         <azure.batch.models.PoolListUsageMetricsOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: :class:`PoolUsageMetricsPaged
         <azure.batch.models.PoolUsageMetricsPaged>`
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        start_time = None
        if pool_list_usage_metrics_options is not None:
            start_time = pool_list_usage_metrics_options.start_time
        end_time = None
        if pool_list_usage_metrics_options is not None:
            end_time = pool_list_usage_metrics_options.end_time
        filter = None
        if pool_list_usage_metrics_options is not None:
            filter = pool_list_usage_metrics_options.filter
        max_results = None
        if pool_list_usage_metrics_options is not None:
            max_results = pool_list_usage_metrics_options.max_results
        timeout = None
        if pool_list_usage_metrics_options is not None:
            timeout = pool_list_usage_metrics_options.timeout
        client_request_id = None
        if pool_list_usage_metrics_options is not None:
            client_request_id = pool_list_usage_metrics_options.client_request_id
        return_client_request_id = None
        if pool_list_usage_metrics_options is not None:
            return_client_request_id = pool_list_usage_metrics_options.return_client_request_id
        ocp_date = None
        if pool_list_usage_metrics_options is not None:
            ocp_date = pool_list_usage_metrics_options.ocp_date

        def internal_paging(next_link=None, raw=False):

            if not next_link:
                # Construct URL
                url = '/poolusagemetrics'

                # Construct parameters
                query_parameters = {}
                query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
                if start_time is not None:
                    query_parameters['starttime'] = self._serialize.query("start_time", start_time, 'iso-8601')
                if end_time is not None:
                    query_parameters['endtime'] = self._serialize.query("end_time", end_time, 'iso-8601')
                if filter is not None:
                    query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
                if max_results is not None:
                    query_parameters['maxresults'] = self._serialize.query("max_results", max_results, 'int', maximum=1000, minimum=1)
                if timeout is not None:
                    query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

            else:
                url = next_link
                query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
            if client_request_id is not None:
                header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
            if return_client_request_id is not None:
                header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
            if ocp_date is not None:
                header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')

            # Construct and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(
                request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.BatchErrorException(self._deserialize, response)

            return response

        # Deserialize response
        deserialized = models.PoolUsageMetricsPaged(internal_paging, self._deserialize.dependencies)

        if raw:
            header_dict = {}
            client_raw_response = models.PoolUsageMetricsPaged(internal_paging, self._deserialize.dependencies, header_dict)
            return client_raw_response

        return deserialized

    def get_all_lifetime_statistics(
            self, pool_get_all_lifetime_statistics_options=None, custom_headers=None, raw=False, **operation_config):
        """Gets lifetime summary statistics for all of the pools in the specified
        account.

        Statistics are aggregated across all pools that have ever existed in
        the account, from account creation to the last update time of the
        statistics.

        :param pool_get_all_lifetime_statistics_options: Additional parameters
         for the operation
        :type pool_get_all_lifetime_statistics_options:
         :class:`PoolGetAllLifetimeStatisticsOptions
         <azure.batch.models.PoolGetAllLifetimeStatisticsOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: :class:`PoolStatistics <azure.batch.models.PoolStatistics>`
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_get_all_lifetime_statistics_options is not None:
            timeout = pool_get_all_lifetime_statistics_options.timeout
        client_request_id = None
        if pool_get_all_lifetime_statistics_options is not None:
            client_request_id = pool_get_all_lifetime_statistics_options.client_request_id
        return_client_request_id = None
        if pool_get_all_lifetime_statistics_options is not None:
            return_client_request_id = pool_get_all_lifetime_statistics_options.return_client_request_id
        ocp_date = None
        if pool_get_all_lifetime_statistics_options is not None:
            ocp_date = pool_get_all_lifetime_statistics_options.ocp_date

        # Construct URL
        url = '/lifetimepoolstats'

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, **operation_config)

        if response.status_code not in [200]:
            raise models.BatchErrorException(self._deserialize, response)

        deserialized = None
        header_dict = {}

        if response.status_code == 200:
            deserialized = self._deserialize('PoolStatistics', response)
            header_dict = {
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
            }

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            client_raw_response.add_headers(header_dict)
            return client_raw_response

        return deserialized

    def add(
            self, pool, pool_add_options=None, custom_headers=None, raw=False, **operation_config):
        """Adds a pool to the specified account.

        When naming pools, avoid including sensitive information such as user
        names or secret project names. This information may appear in telemetry
        logs accessible to Microsoft Support engineers.

        :param pool: The pool to be added.
        :type pool: :class:`PoolAddParameter
         <azure.batch.models.PoolAddParameter>`
        :param pool_add_options: Additional parameters for the operation
        :type pool_add_options: :class:`PoolAddOptions
         <azure.batch.models.PoolAddOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_add_options is not None:
            timeout = pool_add_options.timeout
        client_request_id = None
        if pool_add_options is not None:
            client_request_id = pool_add_options.client_request_id
        return_client_request_id = None
        if pool_add_options is not None:
            return_client_request_id = pool_add_options.return_client_request_id
        ocp_date = None
        if pool_add_options is not None:
            ocp_date = pool_add_options.ocp_date

        # Construct URL
        url = '/pools'

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(pool, 'PoolAddParameter')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [201]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def list(
            self, pool_list_options=None, custom_headers=None, raw=False, **operation_config):
        """Lists all of the pools in the specified account.

        :param pool_list_options: Additional parameters for the operation
        :type pool_list_options: :class:`PoolListOptions
         <azure.batch.models.PoolListOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: :class:`CloudPoolPaged <azure.batch.models.CloudPoolPaged>`
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        filter = None
        if pool_list_options is not None:
            filter = pool_list_options.filter
        select = None
        if pool_list_options is not None:
            select = pool_list_options.select
        expand = None
        if pool_list_options is not None:
            expand = pool_list_options.expand
        max_results = None
        if pool_list_options is not None:
            max_results = pool_list_options.max_results
        timeout = None
        if pool_list_options is not None:
            timeout = pool_list_options.timeout
        client_request_id = None
        if pool_list_options is not None:
            client_request_id = pool_list_options.client_request_id
        return_client_request_id = None
        if pool_list_options is not None:
            return_client_request_id = pool_list_options.return_client_request_id
        ocp_date = None
        if pool_list_options is not None:
            ocp_date = pool_list_options.ocp_date

        def internal_paging(next_link=None, raw=False):

            if not next_link:
                # Construct URL
                url = '/pools'

                # Construct parameters
                query_parameters = {}
                query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
                if filter is not None:
                    query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
                if select is not None:
                    query_parameters['$select'] = self._serialize.query("select", select, 'str')
                if expand is not None:
                    query_parameters['$expand'] = self._serialize.query("expand", expand, 'str')
                if max_results is not None:
                    query_parameters['maxresults'] = self._serialize.query("max_results", max_results, 'int', maximum=1000, minimum=1)
                if timeout is not None:
                    query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

            else:
                url = next_link
                query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
            if client_request_id is not None:
                header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
            if return_client_request_id is not None:
                header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
            if ocp_date is not None:
                header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')

            # Construct and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(
                request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.BatchErrorException(self._deserialize, response)

            return response

        # Deserialize response
        deserialized = models.CloudPoolPaged(internal_paging, self._deserialize.dependencies)

        if raw:
            header_dict = {}
            client_raw_response = models.CloudPoolPaged(internal_paging, self._deserialize.dependencies, header_dict)
            return client_raw_response

        return deserialized

    def delete(
            self, pool_id, pool_delete_options=None, custom_headers=None, raw=False, **operation_config):
        """Deletes a pool from the specified account.

        When you request that a pool be deleted, the following actions occur:
        the pool state is set to deleting; any ongoing resize operation on the
        pool are stopped; the Batch service starts resizing the pool to zero
        nodes; any tasks running on existing nodes are terminated and requeued
        (as if a resize pool operation had been requested with the default
        requeue option); finally, the pool is removed from the system. Because
        running tasks are requeued, the user can rerun these tasks by updating
        their job to target a different pool. The tasks can then run on the new
        pool. If you want to override the requeue behavior, then you should
        call resize pool explicitly to shrink the pool to zero size before
        deleting the pool. If you call an Update, Patch or Delete API on a pool
        in the deleting state, it will fail with HTTP status code 409 with
        error code PoolBeingDeleted.

        :param pool_id: The ID of the pool to delete.
        :type pool_id: str
        :param pool_delete_options: Additional parameters for the operation
        :type pool_delete_options: :class:`PoolDeleteOptions
         <azure.batch.models.PoolDeleteOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_delete_options is not None:
            timeout = pool_delete_options.timeout
        client_request_id = None
        if pool_delete_options is not None:
            client_request_id = pool_delete_options.client_request_id
        return_client_request_id = None
        if pool_delete_options is not None:
            return_client_request_id = pool_delete_options.return_client_request_id
        ocp_date = None
        if pool_delete_options is not None:
            ocp_date = pool_delete_options.ocp_date
        if_match = None
        if pool_delete_options is not None:
            if_match = pool_delete_options.if_match
        if_none_match = None
        if pool_delete_options is not None:
            if_none_match = pool_delete_options.if_none_match
        if_modified_since = None
        if pool_delete_options is not None:
            if_modified_since = pool_delete_options.if_modified_since
        if_unmodified_since = None
        if pool_delete_options is not None:
            if_unmodified_since = pool_delete_options.if_unmodified_since

        # Construct URL
        url = '/pools/{poolId}'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct and send request
        request = self._client.delete(url, query_parameters)
        response = self._client.send(request, header_parameters, **operation_config)

        if response.status_code not in [202]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
            })
            return client_raw_response

    def exists(
            self, pool_id, pool_exists_options=None, custom_headers=None, raw=False, **operation_config):
        """Gets basic properties of a pool.

        :param pool_id: The ID of the pool to get.
        :type pool_id: str
        :param pool_exists_options: Additional parameters for the operation
        :type pool_exists_options: :class:`PoolExistsOptions
         <azure.batch.models.PoolExistsOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: bool
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_exists_options is not None:
            timeout = pool_exists_options.timeout
        client_request_id = None
        if pool_exists_options is not None:
            client_request_id = pool_exists_options.client_request_id
        return_client_request_id = None
        if pool_exists_options is not None:
            return_client_request_id = pool_exists_options.return_client_request_id
        ocp_date = None
        if pool_exists_options is not None:
            ocp_date = pool_exists_options.ocp_date
        if_match = None
        if pool_exists_options is not None:
            if_match = pool_exists_options.if_match
        if_none_match = None
        if pool_exists_options is not None:
            if_none_match = pool_exists_options.if_none_match
        if_modified_since = None
        if pool_exists_options is not None:
            if_modified_since = pool_exists_options.if_modified_since
        if_unmodified_since = None
        if pool_exists_options is not None:
            if_unmodified_since = pool_exists_options.if_unmodified_since

        # Construct URL
        url = '/pools/{poolId}'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct and send request
        request = self._client.head(url, query_parameters)
        response = self._client.send(request, header_parameters, **operation_config)

        if response.status_code not in [200, 404]:
            raise models.BatchErrorException(self._deserialize, response)

        deserialized = (response.status_code == 200)
        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                })
            return client_raw_response
        return deserialized

    def get(
            self, pool_id, pool_get_options=None, custom_headers=None, raw=False, **operation_config):
        """Gets information about the specified pool.

        :param pool_id: The ID of the pool to get.
        :type pool_id: str
        :param pool_get_options: Additional parameters for the operation
        :type pool_get_options: :class:`PoolGetOptions
         <azure.batch.models.PoolGetOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: :class:`CloudPool <azure.batch.models.CloudPool>`
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        select = None
        if pool_get_options is not None:
            select = pool_get_options.select
        expand = None
        if pool_get_options is not None:
            expand = pool_get_options.expand
        timeout = None
        if pool_get_options is not None:
            timeout = pool_get_options.timeout
        client_request_id = None
        if pool_get_options is not None:
            client_request_id = pool_get_options.client_request_id
        return_client_request_id = None
        if pool_get_options is not None:
            return_client_request_id = pool_get_options.return_client_request_id
        ocp_date = None
        if pool_get_options is not None:
            ocp_date = pool_get_options.ocp_date
        if_match = None
        if pool_get_options is not None:
            if_match = pool_get_options.if_match
        if_none_match = None
        if pool_get_options is not None:
            if_none_match = pool_get_options.if_none_match
        if_modified_since = None
        if pool_get_options is not None:
            if_modified_since = pool_get_options.if_modified_since
        if_unmodified_since = None
        if pool_get_options is not None:
            if_unmodified_since = pool_get_options.if_unmodified_since

        # Construct URL
        url = '/pools/{poolId}'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if select is not None:
            query_parameters['$select'] = self._serialize.query("select", select, 'str')
        if expand is not None:
            query_parameters['$expand'] = self._serialize.query("expand", expand, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct and send request
        request = self._client.get(url, query_parameters)
        response = self._client.send(request, header_parameters, **operation_config)

        if response.status_code not in [200]:
            raise models.BatchErrorException(self._deserialize, response)

        deserialized = None
        header_dict = {}

        if response.status_code == 200:
            deserialized = self._deserialize('CloudPool', response)
            header_dict = {
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
            }

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            client_raw_response.add_headers(header_dict)
            return client_raw_response

        return deserialized

    def patch(
            self, pool_id, pool_patch_parameter, pool_patch_options=None, custom_headers=None, raw=False, **operation_config):
        """Updates the properties of the specified pool.

        This only replaces the pool properties specified in the request. For
        example, if the pool has a start task associated with it, and a request
        does not specify a start task element, then the pool keeps the existing
        start task.

        :param pool_id: The ID of the pool to update.
        :type pool_id: str
        :param pool_patch_parameter: The parameters for the request.
        :type pool_patch_parameter: :class:`PoolPatchParameter
         <azure.batch.models.PoolPatchParameter>`
        :param pool_patch_options: Additional parameters for the operation
        :type pool_patch_options: :class:`PoolPatchOptions
         <azure.batch.models.PoolPatchOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_patch_options is not None:
            timeout = pool_patch_options.timeout
        client_request_id = None
        if pool_patch_options is not None:
            client_request_id = pool_patch_options.client_request_id
        return_client_request_id = None
        if pool_patch_options is not None:
            return_client_request_id = pool_patch_options.return_client_request_id
        ocp_date = None
        if pool_patch_options is not None:
            ocp_date = pool_patch_options.ocp_date
        if_match = None
        if pool_patch_options is not None:
            if_match = pool_patch_options.if_match
        if_none_match = None
        if pool_patch_options is not None:
            if_none_match = pool_patch_options.if_none_match
        if_modified_since = None
        if pool_patch_options is not None:
            if_modified_since = pool_patch_options.if_modified_since
        if_unmodified_since = None
        if pool_patch_options is not None:
            if_unmodified_since = pool_patch_options.if_unmodified_since

        # Construct URL
        url = '/pools/{poolId}'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(pool_patch_parameter, 'PoolPatchParameter')

        # Construct and send request
        request = self._client.patch(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [200]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def disable_auto_scale(
            self, pool_id, pool_disable_auto_scale_options=None, custom_headers=None, raw=False, **operation_config):
        """Disables automatic scaling for a pool.

        :param pool_id: The ID of the pool on which to disable automatic
         scaling.
        :type pool_id: str
        :param pool_disable_auto_scale_options: Additional parameters for the
         operation
        :type pool_disable_auto_scale_options:
         :class:`PoolDisableAutoScaleOptions
         <azure.batch.models.PoolDisableAutoScaleOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_disable_auto_scale_options is not None:
            timeout = pool_disable_auto_scale_options.timeout
        client_request_id = None
        if pool_disable_auto_scale_options is not None:
            client_request_id = pool_disable_auto_scale_options.client_request_id
        return_client_request_id = None
        if pool_disable_auto_scale_options is not None:
            return_client_request_id = pool_disable_auto_scale_options.return_client_request_id
        ocp_date = None
        if pool_disable_auto_scale_options is not None:
            ocp_date = pool_disable_auto_scale_options.ocp_date

        # Construct URL
        url = '/pools/{poolId}/disableautoscale'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(request, header_parameters, **operation_config)

        if response.status_code not in [200]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def enable_auto_scale(
            self, pool_id, pool_enable_auto_scale_options=None, auto_scale_formula=None, auto_scale_evaluation_interval=None, custom_headers=None, raw=False, **operation_config):
        """Enables automatic scaling for a pool.

        You cannot enable automatic scaling on a pool if a resize operation is
        in progress on the pool. If automatic scaling of the pool is currently
        disabled, you must specify a valid autoscale formula as part of the
        request. If automatic scaling of the pool is already enabled, you may
        specify a new autoscale formula and/or a new evaluation interval. You
        cannot call this API for the same pool more than once every 30 seconds.

        :param pool_id: The ID of the pool on which to enable automatic
         scaling.
        :type pool_id: str
        :param pool_enable_auto_scale_options: Additional parameters for the
         operation
        :type pool_enable_auto_scale_options:
         :class:`PoolEnableAutoScaleOptions
         <azure.batch.models.PoolEnableAutoScaleOptions>`
        :param auto_scale_formula: The formula for the desired number of
         compute nodes in the pool. The formula is checked for validity before
         it is applied to the pool. If the formula is not valid, the Batch
         service rejects the request with detailed error information. For more
         information about specifying this formula, see Automatically scale
         compute nodes in an Azure Batch pool
         (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling).
        :type auto_scale_formula: str
        :param auto_scale_evaluation_interval: The time interval at which to
         automatically adjust the pool size according to the autoscale formula.
         The default value is 15 minutes. The minimum and maximum value are 5
         minutes and 168 hours respectively. If you specify a value less than 5
         minutes or greater than 168 hours, the Batch service rejects the
         request with an invalid property value error; if you are calling the
         REST API directly, the HTTP status code is 400 (Bad Request). If you
         specify a new interval, then the existing autoscale evaluation
         schedule will be stopped and a new autoscale evaluation schedule will
         be started, with its starting time being the time when this request
         was issued.
        :type auto_scale_evaluation_interval: timedelta
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_enable_auto_scale_options is not None:
            timeout = pool_enable_auto_scale_options.timeout
        client_request_id = None
        if pool_enable_auto_scale_options is not None:
            client_request_id = pool_enable_auto_scale_options.client_request_id
        return_client_request_id = None
        if pool_enable_auto_scale_options is not None:
            return_client_request_id = pool_enable_auto_scale_options.return_client_request_id
        ocp_date = None
        if pool_enable_auto_scale_options is not None:
            ocp_date = pool_enable_auto_scale_options.ocp_date
        if_match = None
        if pool_enable_auto_scale_options is not None:
            if_match = pool_enable_auto_scale_options.if_match
        if_none_match = None
        if pool_enable_auto_scale_options is not None:
            if_none_match = pool_enable_auto_scale_options.if_none_match
        if_modified_since = None
        if pool_enable_auto_scale_options is not None:
            if_modified_since = pool_enable_auto_scale_options.if_modified_since
        if_unmodified_since = None
        if pool_enable_auto_scale_options is not None:
            if_unmodified_since = pool_enable_auto_scale_options.if_unmodified_since
        pool_enable_auto_scale_parameter = models.PoolEnableAutoScaleParameter(auto_scale_formula=auto_scale_formula, auto_scale_evaluation_interval=auto_scale_evaluation_interval)

        # Construct URL
        url = '/pools/{poolId}/enableautoscale'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(pool_enable_auto_scale_parameter, 'PoolEnableAutoScaleParameter')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [200]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def evaluate_auto_scale(
            self, pool_id, auto_scale_formula, pool_evaluate_auto_scale_options=None, custom_headers=None, raw=False, **operation_config):
        """Gets the result of evaluating an automatic scaling formula on the pool.

        This API is primarily for validating an autoscale formula, as it simply
        returns the result without applying the formula to the pool.

        :param pool_id: The ID of the pool on which to evaluate the automatic
         scaling formula.
        :type pool_id: str
        :param auto_scale_formula: The formula for the desired number of
         compute nodes in the pool. The formula is validated and its results
         calculated, but it is not applied to the pool. To apply the formula to
         the pool, 'Enable automatic scaling on a pool'. For more information
         about specifying this formula, see Automatically scale compute nodes
         in an Azure Batch pool
         (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling).
        :type auto_scale_formula: str
        :param pool_evaluate_auto_scale_options: Additional parameters for the
         operation
        :type pool_evaluate_auto_scale_options:
         :class:`PoolEvaluateAutoScaleOptions
         <azure.batch.models.PoolEvaluateAutoScaleOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: :class:`AutoScaleRun <azure.batch.models.AutoScaleRun>`
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_evaluate_auto_scale_options is not None:
            timeout = pool_evaluate_auto_scale_options.timeout
        client_request_id = None
        if pool_evaluate_auto_scale_options is not None:
            client_request_id = pool_evaluate_auto_scale_options.client_request_id
        return_client_request_id = None
        if pool_evaluate_auto_scale_options is not None:
            return_client_request_id = pool_evaluate_auto_scale_options.return_client_request_id
        ocp_date = None
        if pool_evaluate_auto_scale_options is not None:
            ocp_date = pool_evaluate_auto_scale_options.ocp_date
        pool_evaluate_auto_scale_parameter = models.PoolEvaluateAutoScaleParameter(auto_scale_formula=auto_scale_formula)

        # Construct URL
        url = '/pools/{poolId}/evaluateautoscale'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(pool_evaluate_auto_scale_parameter, 'PoolEvaluateAutoScaleParameter')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [200]:
            raise models.BatchErrorException(self._deserialize, response)

        deserialized = None
        header_dict = {}

        if response.status_code == 200:
            deserialized = self._deserialize('AutoScaleRun', response)
            header_dict = {
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            }

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            client_raw_response.add_headers(header_dict)
            return client_raw_response

        return deserialized

    def resize(
            self, pool_id, pool_resize_parameter, pool_resize_options=None, custom_headers=None, raw=False, **operation_config):
        """Changes the number of compute nodes that are assigned to a pool.

        You can only resize a pool when its allocation state is steady. If the
        pool is already resizing, the request fails with status code 409. When
        you resize a pool, the pool's allocation state changes from steady to
        resizing. You cannot resize pools which are configured for automatic
        scaling. If you try to do this, the Batch service returns an error 409.
        If you resize a pool downwards, the Batch service chooses which nodes
        to remove. To remove specific nodes, use the pool remove nodes API
        instead.

        :param pool_id: The ID of the pool to resize.
        :type pool_id: str
        :param pool_resize_parameter: The parameters for the request.
        :type pool_resize_parameter: :class:`PoolResizeParameter
         <azure.batch.models.PoolResizeParameter>`
        :param pool_resize_options: Additional parameters for the operation
        :type pool_resize_options: :class:`PoolResizeOptions
         <azure.batch.models.PoolResizeOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_resize_options is not None:
            timeout = pool_resize_options.timeout
        client_request_id = None
        if pool_resize_options is not None:
            client_request_id = pool_resize_options.client_request_id
        return_client_request_id = None
        if pool_resize_options is not None:
            return_client_request_id = pool_resize_options.return_client_request_id
        ocp_date = None
        if pool_resize_options is not None:
            ocp_date = pool_resize_options.ocp_date
        if_match = None
        if pool_resize_options is not None:
            if_match = pool_resize_options.if_match
        if_none_match = None
        if pool_resize_options is not None:
            if_none_match = pool_resize_options.if_none_match
        if_modified_since = None
        if pool_resize_options is not None:
            if_modified_since = pool_resize_options.if_modified_since
        if_unmodified_since = None
        if pool_resize_options is not None:
            if_unmodified_since = pool_resize_options.if_unmodified_since

        # Construct URL
        url = '/pools/{poolId}/resize'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(pool_resize_parameter, 'PoolResizeParameter')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [202]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def stop_resize(
            self, pool_id, pool_stop_resize_options=None, custom_headers=None, raw=False, **operation_config):
        """Stops an ongoing resize operation on the pool.

        This does not restore the pool to its previous state before the resize
        operation: it only stops any further changes being made, and the pool
        maintains its current state. A resize operation need not be an explicit
        resize pool request; this API can also be used to halt the initial
        sizing of the pool when it is created.

        :param pool_id: The ID of the pool whose resizing you want to stop.
        :type pool_id: str
        :param pool_stop_resize_options: Additional parameters for the
         operation
        :type pool_stop_resize_options: :class:`PoolStopResizeOptions
         <azure.batch.models.PoolStopResizeOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_stop_resize_options is not None:
            timeout = pool_stop_resize_options.timeout
        client_request_id = None
        if pool_stop_resize_options is not None:
            client_request_id = pool_stop_resize_options.client_request_id
        return_client_request_id = None
        if pool_stop_resize_options is not None:
            return_client_request_id = pool_stop_resize_options.return_client_request_id
        ocp_date = None
        if pool_stop_resize_options is not None:
            ocp_date = pool_stop_resize_options.ocp_date
        if_match = None
        if pool_stop_resize_options is not None:
            if_match = pool_stop_resize_options.if_match
        if_none_match = None
        if pool_stop_resize_options is not None:
            if_none_match = pool_stop_resize_options.if_none_match
        if_modified_since = None
        if pool_stop_resize_options is not None:
            if_modified_since = pool_stop_resize_options.if_modified_since
        if_unmodified_since = None
        if pool_stop_resize_options is not None:
            if_unmodified_since = pool_stop_resize_options.if_unmodified_since

        # Construct URL
        url = '/pools/{poolId}/stopresize'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(request, header_parameters, **operation_config)

        if response.status_code not in [202]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def update_properties(
            self, pool_id, pool_update_properties_parameter, pool_update_properties_options=None, custom_headers=None, raw=False, **operation_config):
        """Updates the properties of the specified pool.

        This fully replaces all the updateable properties of the pool. For
        example, if the pool has a start task associated with it and if start
        task is not specified with this request, then the Batch service will
        remove the existing start task.

        :param pool_id: The ID of the pool to update.
        :type pool_id: str
        :param pool_update_properties_parameter: The parameters for the
         request.
        :type pool_update_properties_parameter:
         :class:`PoolUpdatePropertiesParameter
         <azure.batch.models.PoolUpdatePropertiesParameter>`
        :param pool_update_properties_options: Additional parameters for the
         operation
        :type pool_update_properties_options:
         :class:`PoolUpdatePropertiesOptions
         <azure.batch.models.PoolUpdatePropertiesOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_update_properties_options is not None:
            timeout = pool_update_properties_options.timeout
        client_request_id = None
        if pool_update_properties_options is not None:
            client_request_id = pool_update_properties_options.client_request_id
        return_client_request_id = None
        if pool_update_properties_options is not None:
            return_client_request_id = pool_update_properties_options.return_client_request_id
        ocp_date = None
        if pool_update_properties_options is not None:
            ocp_date = pool_update_properties_options.ocp_date

        # Construct URL
        url = '/pools/{poolId}/updateproperties'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(pool_update_properties_parameter, 'PoolUpdatePropertiesParameter')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [204]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def upgrade_os(
            self, pool_id, target_os_version, pool_upgrade_os_options=None, custom_headers=None, raw=False, **operation_config):
        """Upgrades the operating system of the specified pool.

        During an upgrade, the Batch service upgrades each compute node in the
        pool. When a compute node is chosen for upgrade, any tasks running on
        that node are removed from the node and returned to the queue to be
        rerun later (or on a different compute node). The node will be
        unavailable until the upgrade is complete. This operation results in
        temporarily reduced pool capacity as nodes are taken out of service to
        be upgraded. Although the Batch service tries to avoid upgrading all
        compute nodes at the same time, it does not guarantee to do this
        (particularly on small pools); therefore, the pool may be temporarily
        unavailable to run tasks. When this operation runs, the pool state
        changes to upgrading. When all compute nodes have finished upgrading,
        the pool state returns to active.

        :param pool_id: The ID of the pool to upgrade.
        :type pool_id: str
        :param target_os_version: The Azure Guest OS version to be installed
         on the virtual machines in the pool.
        :type target_os_version: str
        :param pool_upgrade_os_options: Additional parameters for the
         operation
        :type pool_upgrade_os_options: :class:`PoolUpgradeOsOptions
         <azure.batch.models.PoolUpgradeOsOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_upgrade_os_options is not None:
            timeout = pool_upgrade_os_options.timeout
        client_request_id = None
        if pool_upgrade_os_options is not None:
            client_request_id = pool_upgrade_os_options.client_request_id
        return_client_request_id = None
        if pool_upgrade_os_options is not None:
            return_client_request_id = pool_upgrade_os_options.return_client_request_id
        ocp_date = None
        if pool_upgrade_os_options is not None:
            ocp_date = pool_upgrade_os_options.ocp_date
        if_match = None
        if pool_upgrade_os_options is not None:
            if_match = pool_upgrade_os_options.if_match
        if_none_match = None
        if pool_upgrade_os_options is not None:
            if_none_match = pool_upgrade_os_options.if_none_match
        if_modified_since = None
        if pool_upgrade_os_options is not None:
            if_modified_since = pool_upgrade_os_options.if_modified_since
        if_unmodified_since = None
        if pool_upgrade_os_options is not None:
            if_unmodified_since = pool_upgrade_os_options.if_unmodified_since
        pool_upgrade_os_parameter = models.PoolUpgradeOSParameter(target_os_version=target_os_version)

        # Construct URL
        url = '/pools/{poolId}/upgradeos'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(pool_upgrade_os_parameter, 'PoolUpgradeOSParameter')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [202]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response

    def remove_nodes(
            self, pool_id, node_remove_parameter, pool_remove_nodes_options=None, custom_headers=None, raw=False, **operation_config):
        """Removes compute nodes from the specified pool.

        This operation can only run when the allocation state of the pool is
        steady. When this operation runs, the allocation state changes from
        steady to resizing.

        :param pool_id: The ID of the pool from which you want to remove
         nodes.
        :type pool_id: str
        :param node_remove_parameter: The parameters for the request.
        :type node_remove_parameter: :class:`NodeRemoveParameter
         <azure.batch.models.NodeRemoveParameter>`
        :param pool_remove_nodes_options: Additional parameters for the
         operation
        :type pool_remove_nodes_options: :class:`PoolRemoveNodesOptions
         <azure.batch.models.PoolRemoveNodesOptions>`
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :rtype: None
        :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
         if raw=true
        :raises:
         :class:`BatchErrorException<azure.batch.models.BatchErrorException>`
        """
        timeout = None
        if pool_remove_nodes_options is not None:
            timeout = pool_remove_nodes_options.timeout
        client_request_id = None
        if pool_remove_nodes_options is not None:
            client_request_id = pool_remove_nodes_options.client_request_id
        return_client_request_id = None
        if pool_remove_nodes_options is not None:
            return_client_request_id = pool_remove_nodes_options.return_client_request_id
        ocp_date = None
        if pool_remove_nodes_options is not None:
            ocp_date = pool_remove_nodes_options.ocp_date
        if_match = None
        if pool_remove_nodes_options is not None:
            if_match = pool_remove_nodes_options.if_match
        if_none_match = None
        if pool_remove_nodes_options is not None:
            if_none_match = pool_remove_nodes_options.if_none_match
        if_modified_since = None
        if pool_remove_nodes_options is not None:
            if_modified_since = pool_remove_nodes_options.if_modified_since
        if_unmodified_since = None
        if pool_remove_nodes_options is not None:
            if_unmodified_since = pool_remove_nodes_options.if_unmodified_since

        # Construct URL
        url = '/pools/{poolId}/removenodes'
        path_format_arguments = {
            'poolId': self._serialize.url("pool_id", pool_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
        if timeout is not None:
            query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int')

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; odata=minimalmetadata; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
        if client_request_id is not None:
            header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str')
        if return_client_request_id is not None:
            header_parameters['return-client-request-id'] = self._serialize.header("return_client_request_id", return_client_request_id, 'bool')
        if ocp_date is not None:
            header_parameters['ocp-date'] = self._serialize.header("ocp_date", ocp_date, 'rfc-1123')
        if if_match is not None:
            header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str')
        if if_none_match is not None:
            header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str')
        if if_modified_since is not None:
            header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", if_modified_since, 'rfc-1123')
        if if_unmodified_since is not None:
            header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", if_unmodified_since, 'rfc-1123')

        # Construct body
        body_content = self._serialize.body(node_remove_parameter, 'NodeRemoveParameter')

        # Construct and send request
        request = self._client.post(url, query_parameters)
        response = self._client.send(
            request, header_parameters, body_content, **operation_config)

        if response.status_code not in [202]:
            raise models.BatchErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'client-request-id': 'str',
                'request-id': 'str',
                'ETag': 'str',
                'Last-Modified': 'rfc-1123',
                'DataServiceId': 'str',
            })
            return client_raw_response


text:
{% extends CMS_TEMPLATE %}
{% load i18n cms_tags menu_tags sekizai_tags static %}

{% block content %}

Publisher List App - list view

        {% for object in object_list %}
            {% include "list_app/includes/item_teaser.html" %}
        {% empty %}

{% trans "No Items." %}

        {% endfor %}

{% endblock %}

redpajama_set_name: RedPajamaGithub


text:
from distutils.core import setup
from setuptools import find_packages, setup

setup(
	name='django_navigation_manager',
	version='0.0.9dev',
	maintainer = "Zenobius Jiricek",
	maintainer_email = "airtonix@gmail.com",
	url="projects.airtonix.net/project/django-navigation-manager",
	description = "Django application that helps other applications declare navigation bar items.",
	license='LICENSE.md',
	packages=find_packages(exclude='tests'),
	include_package_data = True
)


text: Weather where I care


text:
@implementation ZLPhotoPickerBrowserPhoto

- (void)setPhotoObj:(id)photoObj{
    _photoObj = photoObj;

    if ([photoObj isKindOfClass:[ZLPhotoAssets class]]) {
        ZLPhotoAssets *asset = (ZLPhotoAssets *)photoObj;
        self.asset = asset;
    }else if ([photoObj isKindOfClass:[NSURL class]]){
        self.photoURL = photoObj;
    }else if ([photoObj isKindOfClass:[UIImage class]]){
        self.photoImage = photoObj;
    }else if ([photoObj isKindOfClass:[NSString class]]){
        self.photoURL = [NSURL URLWithString:photoObj];
    }else if ([photoObj isKindOfClass:[ZLCamera class]]){
        self.photoImage = (UIImage *)[photoObj fullScreenImage];
    }else{
        NSAssert(true == true, @"您传入的类型有问题");
    }

}

- (UIImage *)photoImage{
    if (!_photoImage && self.asset) {
        _photoImage = [self.asset originImage];
    }
    return _photoImage;
}

- (UIImage *)thumbImage{
    if (!_thumbImage) {
        if (self.asset) {
            _thumbImage = [self.asset thumbImage];
        }else if (_photoImage){
            _thumbImage = _photoImage;
        }
    }
    return _thumbImage;
}

#pragma mark - 传入一个图片对象,可以是URL/UIImage/NSString,返回一个实例
+ (instancetype)photoAnyImageObjWith:(id)imageObj{
    ZLPhotoPickerBrowserPhoto *photo = [[self alloc] init];
    [photo setPhotoObj:imageObj];
    return photo;
}

@end
// 版权属于原作者
// http://code4app.com (cn) http://code4app.net (en)
// 发布代码于最专业的源码分享网站: Code4App.com


text:
<?xml version="1.0" encoding="UTF-8"?>
<artifacts>
    <artifact name="CardService" groupId="org.wso2.carbon.RegResources.resource" version="1.0.0" type="registry/resource" serverRole="GovernanceRegistry">
        <item>
            <file>CardService.wsdl</file>
            <path>/_system/config</path>
        </item>
    </artifact>
    <artifact name="transform" groupId="org.wso2.carbon.RegResources.resource" version="1.0.0" type="registry/resource" serverRole="GovernanceRegistry">
        <item>
            <file>transform.xslt</file>
            <path>/_system/config</path>
        </item>
    </artifact>
</artifacts>


text:
module SA
using PyPlot
using ProgressMeter
import JSON
include("random_rewire.jl")
include("utilities.jl")
include("algConnectivity.jl")
include("arg_config.jl")
include("plotting.jl")

export optimize

function Paccept(c,c_prime,T,its,maxits)
    if c_prime >= c
        return 1
    else
        normalizedP = exp(-its/(maxits/8))
        return normalizedP/(c-c_prime)
    end
end

function optimize(ARGS="")
    args = parse_commandline(ARGS)
    n = args["vertices"]
    e = args["edges"]
    if args["out_folder"] == ""
        dt = replace(string(now()),"T","_")
        dt = replace(dt,":","_")
        dt = replace(dt,"-","_")
        out_fldr = string("res_",dt)
    else
        out_fldr = args["out_folder"]
    end

    if args["simple_graph"]
        g = simple_NE_sgraph(n,e)
    else
        g = simple_NE_graph(n,e)
    end

    if !args["no_graph_dot"]
        write_to_file(g,out_fldr,args["init_fname"])
    end
    if args["plot_graphs"]
        plot(g)
    end
    if args["save_graphs_plot"]
        plot_to_file(g,out_fldr,args["init_fname"])
    end
    save_json(args,out_fldr,"args.txt")
    current_state = deepcopy(g)
    tot_its = args["iterations"]
    edge_change_prob = args["edge_rewire"]
    T = args["temperature"]
    c = AlgConnectivity(current_state,args["sparse_rep"])
    if !args["no_console_output"]
        @printf("Original connectivity: %.3f\n",c)
    end
    if !args["no_figs"]
        plot_deg_hist(g,out_fldr,"d_hist_initial",c)
    end
    c_hist = zeros(tot_its,1)

    p = Progress(tot_its, 30, "Progress: ", 50)
    tic()
    for i = 1:tot_its
        update!(p,i)
        c_hist[i] = c
        candidate = rewire(deepcopy(current_state),edge_change_prob)
        c_prime = AlgConnectivity(candidate,args["sparse_rep"])
        accept_p = Paccept(c,c_prime,T,i,tot_its)

        if rand() < accept_p
            # Moving here
            c = c_prime
            current_state = deepcopy(candidate)
        else
            continue
        end
    end
    t = toq()
    if !args["no_console_output"]
        @printf("Final connectivity: %.3f\n",c)
    end
    if !args["no_graph_dot"]
        write_to_file(current_state,out_fldr,args["final_fname"])
    end
    if args["plot_graphs"]
        plot(current_state)
    end
    if args["save_graphs_plot"]
        plot_to_file(current_state,out_fldr,args["final_fname"])
    end

    if !args["no_figs"]
        plot_c_hist(c_hist,out_fldr,"c_hist")

        plot_deg_hist(current_state,out_fldr,"d_hist_final",c)
    end
    return t
end
end


text:
package org.openecard.addon;

/**
 *
 * @author Tobias Wich <tobias.wich@ecsec.de>
 */
public interface LifecycleTrait {

    void init(Context aCtx) throws ActionInitializationException;

    void destroy();

}


text:
package consulo.csharp.ide;

import javax.annotation.Nonnull;

import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.BitUtil;
import com.intellij.util.Function;
import consulo.annotation.access.RequiredReadAction;
import consulo.csharp.lang.psi.CSharpIndexMethodDeclaration;
import consulo.csharp.lang.psi.CSharpTypeRefPresentationUtil;
import consulo.dotnet.psi.DotNetConstructorDeclaration;
import consulo.dotnet.psi.DotNetFieldDeclaration;
import consulo.dotnet.psi.DotNetGenericParameter;
import consulo.dotnet.psi.DotNetGenericParameterListOwner;
import consulo.dotnet.psi.DotNetLikeMethodDeclaration;
import consulo.dotnet.psi.DotNetParameter;
import consulo.dotnet.psi.DotNetPropertyDeclaration;
import consulo.dotnet.psi.DotNetVirtualImplementOwner;
import consulo.dotnet.resolve.DotNetGenericExtractor;
import consulo.dotnet.resolve.DotNetTypeRef;

/**
 * @author VISTALL
 * @since 16.12.14
 */
public class CSharpElementPresentationUtil
{
	public static final int SCALA_FORMAT = 1 << 0;
	public static final int METHOD_WITH_RETURN_TYPE = 1 << 1;
	public static final int METHOD_PARAMETER_NAME = 1 << 2;
	public static final int WITH_VIRTUAL_IMPL_TYPE = 1 << 4;
	public static final int NON_QUALIFIED_TYPE = 1 << 5;

	public static final int PROPERTY_SCALA_LIKE_FULL = SCALA_FORMAT | WITH_VIRTUAL_IMPL_TYPE;
	public static final int METHOD_SCALA_LIKE_FULL = SCALA_FORMAT | METHOD_WITH_RETURN_TYPE | METHOD_PARAMETER_NAME | WITH_VIRTUAL_IMPL_TYPE;

	@Nonnull
	@RequiredReadAction
	public static String formatField(@Nonnull DotNetFieldDeclaration fieldDeclaration)
	{
		return formatField(fieldDeclaration, 0);
	}

	@Nonnull
	@RequiredReadAction
	public static String formatField(@Nonnull DotNetFieldDeclaration fieldDeclaration, int flags)
	{
		StringBuilder builder = new StringBuilder();
		builder.append(fieldDeclaration.getName());
		builder.append(":");
		CSharpTypeRefPresentationUtil.appendTypeRef(builder, fieldDeclaration.toTypeRef(true), typeRefMask(flags));
		return builder.toString();
	}

	@Nonnull
	@RequiredReadAction
	public static String formatProperty(@Nonnull DotNetPropertyDeclaration propertyDeclaration, int flags)
	{
		StringBuilder builder = new StringBuilder();

		if(BitUtil.isSet(flags, WITH_VIRTUAL_IMPL_TYPE))
		{
			DotNetTypeRef typeRefForImplement = propertyDeclaration.getTypeRefForImplement();
			if(typeRefForImplement != DotNetTypeRef.ERROR_TYPE)
			{
				CSharpTypeRefPresentationUtil.appendTypeRef(builder, typeRefForImplement, typeRefMask(flags));
				builder.append(".");
			}
		}

		if(BitUtil.isSet(flags, SCALA_FORMAT))
		{
			builder.append(propertyDeclaration.getName());
			builder.append(":");
			CSharpTypeRefPresentationUtil.appendTypeRef(builder, propertyDeclaration.toTypeRef(true), typeRefMask(flags));

		}
		else
		{
			CSharpTypeRefPresentationUtil.appendTypeRef(builder, propertyDeclaration.toTypeRef(true), typeRefMask(flags));

			builder.append(" ");
			builder.append(propertyDeclaration.getName());
		}
		return builder.toString();
	}

	@Nonnull
	@RequiredReadAction
	public static String formatMethod(@Nonnull DotNetLikeMethodDeclaration methodDeclaration, int flags)
	{
		StringBuilder builder = new StringBuilder();

		if(BitUtil.isSet(flags, METHOD_WITH_RETURN_TYPE) && !BitUtil.isSet(flags, SCALA_FORMAT))
		{
			if(!(methodDeclaration instanceof DotNetConstructorDeclaration))
			{
				CSharpTypeRefPresentationUtil.appendTypeRef(builder, methodDeclaration.getReturnTypeRef(), typeRefMask(flags));
				builder.append(" ");
			}
		}

		if(methodDeclaration instanceof DotNetConstructorDeclaration && ((DotNetConstructorDeclaration) methodDeclaration).isDeConstructor())
		{
			builder.append("~");
		}

		if(BitUtil.isSet(flags, WITH_VIRTUAL_IMPL_TYPE))
		{
			if(methodDeclaration instanceof DotNetVirtualImplementOwner)
			{
				DotNetTypeRef typeRefForImplement = ((DotNetVirtualImplementOwner) methodDeclaration).getTypeRefForImplement();
				if(typeRefForImplement != DotNetTypeRef.ERROR_TYPE)
				{
					CSharpTypeRefPresentationUtil.appendTypeRef(builder, typeRefForImplement, typeRefMask(flags));
					builder.append(".");
				}
			}
		}

		if(methodDeclaration instanceof CSharpIndexMethodDeclaration)
		{
			builder.append("this");
		}
		else
		{
			builder.append(methodDeclaration.getName());
		}
		formatTypeGenericParameters(methodDeclaration.getGenericParameters(), builder);
		formatParameters(methodDeclaration, builder, flags);
		return builder.toString();
	}

	@RequiredReadAction
	public static void formatParameters(@Nonnull DotNetLikeMethodDeclaration methodDeclaration, @Nonnull StringBuilder builder, final int flags)
	{
		boolean indexMethod = methodDeclaration instanceof CSharpIndexMethodDeclaration;

		DotNetParameter[] parameters = methodDeclaration.getParameters();
		if(parameters.length == 0)
		{
			builder.append(indexMethod ? "[]" : "()");
		}
		else
		{
			builder.append(indexMethod ? "[" : "(");
			builder.append(StringUtil.join(parameters, new Function<DotNetParameter, String>()
			{
				@Override
				@RequiredReadAction
				public String fun(DotNetParameter parameter)
				{
					String text = CSharpTypeRefPresentationUtil.buildTextWithKeyword(parameter.toTypeRef(true));

					if(!BitUtil.isSet(flags, METHOD_PARAMETER_NAME))
					{
						return text;
					}

					if(BitUtil.isSet(flags, SCALA_FORMAT))
					{
						return parameter.getName() + ":" + text;
					}
					else
					{
						return text + " " + parameter.getName();
					}
				}
			}, ", "));
			builder.append(indexMethod ? "]" : ")");
		}

		if(BitUtil.isSet(flags, METHOD_WITH_RETURN_TYPE) && BitUtil.isSet(flags, SCALA_FORMAT))
		{
			if(!(methodDeclaration instanceof DotNetConstructorDeclaration))
			{
				builder.append(":");
				CSharpTypeRefPresentationUtil.appendTypeRef(builder, methodDeclaration.getReturnTypeRef(), typeRefMask(flags));
			}
		}
	}

	private static int typeRefMask(int flags)
	{
		if(BitUtil.isSet(flags, NON_QUALIFIED_TYPE))
		{
			return CSharpTypeRefPresentationUtil.TYPE_KEYWORD;
		}
		return CSharpTypeRefPresentationUtil.QUALIFIED_NAME_WITH_KEYWORD;
	}

	public static void formatTypeGenericParameters(@Nonnull DotNetGenericParameter[] parameters, @Nonnull StringBuilder builder)
	{
		if(parameters.length > 0)
		{
			builder.append("<");
			builder.append(StringUtil.join(parameters, new Function<DotNetGenericParameter, String>()
			{
				@Override
				@RequiredReadAction
				public String fun(DotNetGenericParameter dotNetGenericParameter)
				{
					return dotNetGenericParameter.getName();
				}
			}, ", "));
			builder.append(">");
		}
	}

	@Nonnull
	@RequiredReadAction
	public static String formatGenericParameters(@Nonnull final DotNetGenericParameterListOwner owner, @Nonnull final DotNetGenericExtractor extractor)
	{
		DotNetGenericParameter[] genericParameters = owner.getGenericParameters();
		if(genericParameters.length == 0)
		{
			return "";
		}
		return "<" + StringUtil.join(genericParameters, new Function<DotNetGenericParameter, String>()
		{
			@Override
			@RequiredReadAction
			public String fun(DotNetGenericParameter genericParameter)
			{
				DotNetTypeRef extract = extractor.extract(genericParameter);
				if(extract != null)
				{
					return CSharpTypeRefPresentationUtil.buildShortText(extract);
				}
				return genericParameter.getName();
			}
		}, ", ") + ">";
	}
}