async def get_activity_members(<EOL>self, conversation_id, activity_id, *, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_activity_members.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", activity_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = await self._client.async_send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

GetActivityMembers.

        Enumerate the members of an activity.
        This REST API takes a ConversationId and a ActivityId, returning an
        array of ChannelAccount objects representing the members of the
        particular activity in the conversation.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param activity_id: Activity ID
        :type activity_id: str
        :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>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~botframework.connector.models.ChannelAccount] or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


async def upload_attachment(<EOL>self, conversation_id, attachment_upload, *, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.upload_attachment.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(attachment_upload, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = await self._client.async_send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

UploadAttachment.

        Upload an attachment directly into a channel's blob storage.
        This is useful because it allows you to store data in a compliant store
        when dealing with enterprises.
        The response is a ResourceResponse which contains an AttachmentId which
        is suitable for using with the attachments API.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param attachment_upload: Attachment data
        :type attachment_upload: ~botframework.connector.models.AttachmentData
        :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>`.
        :return: ResourceResponse or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ResourceResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


try:<EOL><INDENT>return next(iterator)<EOL><DEDENT>except StopIteration:<EOL><INDENT>raise _MsrestStopIteration()<EOL><DEDENT>

To avoid:
    TypeError: StopIteration interacts badly with generators and cannot be raised into a Future


async def async_send_formdata(self, request, headers=None, content=None, **config):

files = self._prepare_send_formdata(request, headers, content)<EOL>return await self.async_send(request, headers, files=files, **config)<EOL>

Send data as a multipart form-data request.
        We only deal with file-like objects or strings at this point.
        The requests is not yet streamed.
        :param ClientRequest request: The request object to be sent.
        :param dict headers: Any headers to add to the request.
        :param dict content: Dictionary of the fields of the formdata.
        :param config: Any specific config overrides.


async def async_send(self, request, headers=None, content=None, **config):

loop = asyncio.get_event_loop()<EOL>if self.config.keep_alive and self._session is None:<EOL><INDENT>self._session = requests.Session()<EOL><DEDENT>try:<EOL><INDENT>session = self.creds.signed_session(self._session)<EOL><DEDENT>except TypeError:  <EOL><INDENT>session = self.creds.signed_session()<EOL>if self._session is not None:<EOL><INDENT>_LOGGER.warning(<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>kwargs = self._configure_session(session, **config)<EOL>if headers:<EOL><INDENT>request.headers.update(headers)<EOL><DEDENT>if not kwargs.get('<STR_LIT>'):<EOL><INDENT>request.add_content(content)<EOL><DEDENT>if request.data:<EOL><INDENT>kwargs['<STR_LIT:data>'] = request.data<EOL><DEDENT>kwargs['<STR_LIT>'].update(request.headers)<EOL>response = None<EOL>try:<EOL><INDENT>try:<EOL><INDENT>future = loop.run_in_executor(<EOL>None,<EOL>functools.partial(<EOL>session.request,<EOL>request.method,<EOL>request.url,<EOL>**kwargs<EOL>)<EOL>)<EOL>return await future<EOL><DEDENT>except (oauth2.rfc6749.errors.InvalidGrantError,<EOL>oauth2.rfc6749.errors.TokenExpiredError) as err:<EOL><INDENT>error = "<STR_LIT>"<EOL>_LOGGER.warning(error)<EOL><DEDENT>try:<EOL><INDENT>session = self.creds.refresh_session()<EOL>kwargs = self._configure_session(session)<EOL>if request.data:<EOL><INDENT>kwargs['<STR_LIT:data>'] = request.data<EOL><DEDENT>kwargs['<STR_LIT>'].update(request.headers)<EOL>future = loop.run_in_executor(<EOL>None,<EOL>functools.partial(<EOL>session.request,<EOL>request.method,<EOL>request.url,<EOL>**kwargs<EOL>)<EOL>)<EOL>return await future<EOL><DEDENT>except (oauth2.rfc6749.errors.InvalidGrantError,<EOL>oauth2.rfc6749.errors.TokenExpiredError) as err:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise_with_traceback(TokenExpiredError, msg, err)<EOL><DEDENT><DEDENT>except (requests.RequestException,<EOL>oauth2.rfc6749.errors.OAuth2Error) as err:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise_with_traceback(ClientRequestError, msg, err)<EOL><DEDENT>finally:<EOL><INDENT>self._close_local_session_if_necessary(response, session, kwargs['<STR_LIT>'])<EOL><DEDENT>

Prepare and send request object according to configuration.
        :param ClientRequest request: The request object to be sent.
        :param dict headers: Any headers to add to the request.
        :param content: Any body data to add to the request.
        :param config: Any specific config overrides


def stream_download_async(self, response, user_callback):

block = self.config.connection.data_block_size<EOL>return StreamDownloadGenerator(response, user_callback, block)<EOL>

Async Generator for streaming request body data.
        :param response: The initial response
        :param user_callback: Custom callback for monitoring progress.


def get_attachment_info(<EOL>self, attachment_id, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_attachment_info.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", attachment_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

GetAttachmentInfo.

        Get AttachmentInfo structure describing the attachment views.

        :param attachment_id: attachment id
        :type attachment_id: str
        :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>`.
        :return: AttachmentInfo or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.AttachmentInfo or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def get_attachment(<EOL>self, attachment_id, view_id, custom_headers=None, raw=False, callback=None, **operation_config):

<EOL>url = self.get_attachment.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", attachment_id, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", view_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=True, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = self._client.stream_download(response, callback)<EOL>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

GetAttachment.

        Get the named view as binary content.

        :param attachment_id: attachment id
        :type attachment_id: str
        :param view_id: View id from attachmentInfo
        :type view_id: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param callback: When specified, will be called with each chunk of
         data that is streamed. The callback should take two arguments, the
         bytes of the current chunk of data and the response object. If the
         data is uploading, response will be None.
        :type callback: Callable[Bytes, response=None]
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: object or ClientRawResponse if raw=true
        :rtype: Generator or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def get_conversations(<EOL>self, continuation_token=None, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_conversations.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>if continuation_token is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", continuation_token, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

GetConversations.

        List the Conversations in which this bot has participated.
        GET from this method with a skip token
        The return value is a ConversationsResult, which contains an array of
        ConversationMembers and a skip token.  If the skip token is not empty,
        then
        there are further values to be returned. Call this method again with
        the returned token to get more values.
        Each ConversationMembers object contains the ID of the conversation and
        an array of ChannelAccounts that describe the members of the
        conversation.

        :param continuation_token: skip or continuation token
        :type continuation_token: str
        :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>`.
        :return: ConversationsResult or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ConversationsResult or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def create_conversation(<EOL>self, parameters, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.create_conversation.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(parameters, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

CreateConversation.

        Create a new Conversation.
        POST to this method with a
        * Bot being the bot creating the conversation
        * IsGroup set to true if this is not a direct message (default is
        false)
        * Array containing the members to include in the conversation
        The return value is a ResourceResponse which contains a conversation id
        which is suitable for use
        in the message payload and REST API uris.
        Most channels only support the semantics of bots initiating a direct
        message conversation.  An example of how to do that would be:
        ```
        var resource = await connector.conversations.CreateConversation(new
        ConversationParameters(){ Bot = bot, members = new ChannelAccount[] {
        new ChannelAccount("user1") } );
        await connect.Conversations.SendToConversationAsync(resource.Id, new
        Activity() ... ) ;
        ```.

        :param parameters: Parameters to create the conversation from
        :type parameters:
         ~botframework.connector.models.ConversationParameters
        :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>`.
        :return: ConversationResourceResponse or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ConversationResourceResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def send_to_conversation(<EOL>self, conversation_id, activity, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.send_to_conversation.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(activity, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

SendToConversation.

        This method allows you to send an activity to the end of a
        conversation.
        This is slightly different from ReplyToActivity().
        * SendToConversation(conversationId) - will append the activity to the
        end of the conversation according to the timestamp or semantics of the
        channel.
        * ReplyToActivity(conversationId,ActivityId) - adds the activity as a
        reply to another activity, if the channel supports it. If the channel
        does not support nested replies, ReplyToActivity falls back to
        SendToConversation.
        Use ReplyToActivity when replying to a specific activity in the
        conversation.
        Use SendToConversation in all other cases.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param activity: Activity to send
        :type activity: ~botframework.connector.models.Activity
        :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>`.
        :return: ResourceResponse or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ResourceResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def send_conversation_history(<EOL>self, conversation_id, activities=None, custom_headers=None, raw=False, **operation_config):

history = models.Transcript(activities=activities)<EOL>url = self.send_conversation_history.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(history, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

SendConversationHistory.

        This method allows you to upload the historic activities to the
        conversation.
        Sender must ensure that the historic activities have unique ids and
        appropriate timestamps. The ids are used by the client to deal with
        duplicate activities and the timestamps are used by the client to
        render the activities in the right order.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param activities: A collection of Activities that conforms to the
         Transcript schema.
        :type activities: list[~botframework.connector.models.Activity]
        :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>`.
        :return: ResourceResponse or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ResourceResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def update_activity(<EOL>self, conversation_id, activity_id, activity, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.update_activity.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", activity_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(activity, '<STR_LIT>')<EOL>request = self._client.put(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

UpdateActivity.

        Edit an existing activity.
        Some channels allow you to edit an existing activity to reflect the new
        state of a bot conversation.
        For example, you can remove buttons after someone has clicked "Approve"
        button.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param activity_id: activityId to update
        :type activity_id: str
        :param activity: replacement Activity
        :type activity: ~botframework.connector.models.Activity
        :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>`.
        :return: ResourceResponse or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ResourceResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def reply_to_activity(<EOL>self, conversation_id, activity_id, activity, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.reply_to_activity.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", activity_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(activity, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

ReplyToActivity.

        This method allows you to reply to an activity.
        This is slightly different from SendToConversation().
        * SendToConversation(conversationId) - will append the activity to the
        end of the conversation according to the timestamp or semantics of the
        channel.
        * ReplyToActivity(conversationId,ActivityId) - adds the activity as a
        reply to another activity, if the channel supports it. If the channel
        does not support nested replies, ReplyToActivity falls back to
        SendToConversation.
        Use ReplyToActivity when replying to a specific activity in the
        conversation.
        Use SendToConversation in all other cases.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param activity_id: activityId the reply is to (OPTIONAL)
        :type activity_id: str
        :param activity: Activity to send
        :type activity: ~botframework.connector.models.Activity
        :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>`.
        :return: ResourceResponse or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ResourceResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def delete_activity(<EOL>self, conversation_id, activity_id, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.delete_activity.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", activity_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.delete(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(None, response)<EOL>return client_raw_response<EOL><DEDENT>

DeleteActivity.

        Delete an existing activity.
        Some channels allow you to delete an existing activity, and if
        successful this method will remove the specified activity.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param activity_id: activityId to delete
        :type activity_id: str
        :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>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def get_conversation_members(<EOL>self, conversation_id, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_conversation_members.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

GetConversationMembers.

        Enumerate the members of a conversation.
        This REST API takes a ConversationId and returns an array of
        ChannelAccount objects representing the members of the conversation.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :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>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~botframework.connector.models.ChannelAccount] or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def get_conversation_paged_members(<EOL>self, conversation_id, page_size=None, continuation_token=None, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_conversation_paged_members.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>if page_size is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", page_size, '<STR_LIT:int>')<EOL><DEDENT>if continuation_token is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", continuation_token, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise HttpOperationError(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

GetConversationPagedMembers.

        Enumerate the members of a conversation one page at a time.
        This REST API takes a ConversationId. Optionally a pageSize and/or
        continuationToken can be provided. It returns a PagedMembersResult,
        which contains an array
        of ChannelAccounts representing the members of the conversation and a
        continuation token that can be used to get more values.
        One page of ChannelAccounts records are returned with each call. The
        number of records in a page may vary between channels and calls. The
        pageSize parameter can be used as
        a suggestion. If there are no additional results the response will not
        contain a continuation token. If there are no members in the
        conversation the Members will be empty or not present in the response.
        A response to a request that has a continuation token from a prior
        request may rarely return members from a previous request.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param page_size: Suggested page size
        :type page_size: int
        :param continuation_token: Continuation Token
        :type continuation_token: str
        :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>`.
        :return: PagedMembersResult or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.PagedMembersResult or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`


def delete_conversation_member(<EOL>self, conversation_id, member_id, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.delete_conversation_member.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", member_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.delete(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(None, response)<EOL>return client_raw_response<EOL><DEDENT>

DeleteConversationMember.

        Deletes a member from a conversation.
        This REST API takes a ConversationId and a memberId (of type string)
        and removes that member from the conversation. If that member was the
        last member
        of the conversation, the conversation will also be deleted.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param member_id: ID of the member to delete from this conversation
        :type member_id: str
        :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>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def get_activity_members(<EOL>self, conversation_id, activity_id, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_activity_members.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", activity_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

GetActivityMembers.

        Enumerate the members of an activity.
        This REST API takes a ConversationId and a ActivityId, returning an
        array of ChannelAccount objects representing the members of the
        particular activity in the conversation.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param activity_id: Activity ID
        :type activity_id: str
        :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>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~botframework.connector.models.ChannelAccount] or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


def upload_attachment(<EOL>self, conversation_id, attachment_upload, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.upload_attachment.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", conversation_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(attachment_upload, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

UploadAttachment.

        Upload an attachment directly into a channel's blob storage.
        This is useful because it allows you to store data in a compliant store
        when dealing with enterprises.
        The response is a ResourceResponse which contains an AttachmentId which
        is suitable for using with the attachments API.

        :param conversation_id: Conversation ID
        :type conversation_id: str
        :param attachment_upload: Attachment data
        :type attachment_upload: ~botframework.connector.models.AttachmentData
        :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>`.
        :return: ResourceResponse or ClientRawResponse if raw=true
        :rtype: ~botframework.connector.models.ResourceResponse or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`


@staticmethod<EOL><INDENT>async def authenticate_token_service_url(auth_header: str, credentials: CredentialProvider, service_url: str, channel_id: str) -> ClaimsIdentity:<DEDENT>

identity = await asyncio.ensure_future(<EOL>ChannelValidation.authenticate_token(auth_header, credentials, channel_id))<EOL>service_url_claim = identity.get_claim_value(ChannelValidation.SERVICE_URL_CLAIM)<EOL>if service_url_claim != service_url:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return identity<EOL>

Validate the incoming Auth Header

        Validate the incoming Auth Header as a token sent from the Bot Framework Service.
        A token issued by the Bot Framework emulator will FAIL this check.

        :param auth_header: The raw HTTP header in the format: 'Bearer [longString]'
        :type auth_header: str
        :param credentials: The user defined set of valid credentials, such as the AppId.
        :type credentials: CredentialProvider
        :param service_url: Claim value that must match in the identity.
        :type service_url: str

        :return: A valid ClaimsIdentity.
        :raises Exception:


@staticmethod<EOL><INDENT>async def authenticate_token(auth_header: str, credentials: CredentialProvider, channel_id: str) -> ClaimsIdentity:<DEDENT>

token_extractor = JwtTokenExtractor(<EOL>ChannelValidation.TO_BOT_FROM_CHANNEL_TOKEN_VALIDATION_PARAMETERS,<EOL>Constants.TO_BOT_FROM_CHANNEL_OPEN_ID_METADATA_URL,<EOL>Constants.ALLOWED_SIGNING_ALGORITHMS)<EOL>identity = await asyncio.ensure_future(<EOL>token_extractor.get_identity_from_auth_header(auth_header, channel_id))<EOL>if not identity:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if not identity.isAuthenticated:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if identity.get_claim_value(Constants.ISSUER_CLAIM) != Constants.TO_BOT_FROM_CHANNEL_TOKEN_ISSUER:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>aud_claim = identity.get_claim_value(Constants.AUDIENCE_CLAIM)<EOL>is_valid_app_id = await asyncio.ensure_future(credentials.is_valid_appid(aud_claim or "<STR_LIT>"))<EOL>if not is_valid_app_id:<EOL><INDENT>raise Exception('<STR_LIT>', aud_claim)<EOL><DEDENT>return identity<EOL>

Validate the incoming Auth Header

        Validate the incoming Auth Header as a token sent from the Bot Framework Service.
        A token issued by the Bot Framework emulator will FAIL this check.

        :param auth_header: The raw HTTP header in the format: 'Bearer [longString]'
        :type auth_header: str
        :param credentials: The user defined set of valid credentials, such as the AppId.
        :type credentials: CredentialProvider

        :return: A valid ClaimsIdentity.
        :raises Exception:


@staticmethod<EOL><INDENT>async def authenticate_request(activity: Activity, auth_header: str, credentials: CredentialProvider) -> ClaimsIdentity:<DEDENT>

if not auth_header:<EOL><INDENT>is_auth_disabled = await credentials.is_authentication_disabled()<EOL>if is_auth_disabled:<EOL><INDENT>return<EOL><DEDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>claims_identity = await JwtTokenValidation.validate_auth_header(auth_header, credentials, activity.channel_id, activity.service_url)<EOL>MicrosoftAppCredentials.trust_service_url(activity.service_url)<EOL>return claims_identity<EOL>

Authenticates the request and sets the service url in the set of trusted urls.

        :param activity: The incoming Activity from the Bot Framework or the Emulator
        :type activity: ~botframework.connector.models.Activity
        :param auth_header: The Bearer token included as part of the request
        :type auth_header: str
        :param credentials: The set of valid credentials, such as the Bot Application ID
        :type credentials: CredentialProvider

        :raises Exception:


async def is_valid_appid(self, app_id: str) -> bool:

raise NotImplementedError<EOL>

Validate AppId.

        This method is async to enable custom implementations
        that may need to call out to serviced to validate the appId / password pair.

        :param app_id: bot appid
        :return: true if it is a valid AppId


async def get_app_password(self, app_id: str) -> str:

raise NotImplementedError<EOL>

Get the app password for a given bot appId, if it is not a valid appId, return Null

        This method is async to enable custom implementations
        that may need to call out to serviced to validate the appId / password pair.

        :param app_id: bot appid
        :return: password or null for invalid appid


async def is_authentication_disabled(self) -> bool:

raise NotImplementedError<EOL>

Checks if bot authentication is disabled.

        Return true if bot authentication is disabled.
        This method is async to enable custom implementations
        that may need to call out to serviced to validate the appId / password pair.

        :return: true if bot authentication is disabled.


@staticmethod<EOL><INDENT>def is_token_from_emulator(auth_header: str) -> bool:<DEDENT>

<EOL>if not auth_header:<EOL><INDENT>return False<EOL><DEDENT>parts = auth_header.split('<STR_LIT:U+0020>')<EOL>if len(parts) != <NUM_LIT:2>:<EOL><INDENT>return False<EOL><DEDENT>auth_scheme = parts[<NUM_LIT:0>]<EOL>bearer_token = parts[<NUM_LIT:1>]<EOL>if auth_scheme != '<STR_LIT>':<EOL><INDENT>return False<EOL><DEDENT>token = jwt.decode(bearer_token, verify=False)<EOL>if not token:<EOL><INDENT>return False<EOL><DEDENT>issuer = token['<STR_LIT>']<EOL>if not issuer:<EOL><INDENT>return False<EOL><DEDENT>issuer_list = EmulatorValidation.TO_BOT_FROM_EMULATOR_TOKEN_VALIDATION_PARAMETERS.issuer<EOL>if issuer_list and not issuer in issuer_list:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>

Determines if a given Auth header is from the Bot Framework Emulator

        :param auth_header: Bearer Token, in the 'Bearer [Long String]' Format.
        :type auth_header: str

        :return: True, if the token was issued by the Emulator. Otherwise, false.


@staticmethod<EOL><INDENT>async def authenticate_emulator_token(auth_header: str, credentials: CredentialProvider, channel_id: str) -> ClaimsIdentity:<DEDENT>

token_extractor = JwtTokenExtractor(<EOL>EmulatorValidation.TO_BOT_FROM_EMULATOR_TOKEN_VALIDATION_PARAMETERS,<EOL>Constants.TO_BOT_FROM_EMULATOR_OPEN_ID_METADATA_URL,<EOL>Constants.ALLOWED_SIGNING_ALGORITHMS)<EOL>identity = await asyncio.ensure_future(<EOL>token_extractor.get_identity_from_auth_header(auth_header, channel_id))<EOL>if not identity:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if not identity.isAuthenticated:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>version_claim = identity.get_claim_value(EmulatorValidation.VERSION_CLAIM)<EOL>if version_claim is None:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>app_id = '<STR_LIT>'<EOL>if not version_claim or version_claim == '<STR_LIT:1.0>':<EOL><INDENT>app_id_claim = identity.get_claim_value(EmulatorValidation.APP_ID_CLAIM)<EOL>if not app_id_claim:<EOL><INDENT>raise Exception('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>app_id = app_id_claim<EOL><DEDENT>elif version_claim == '<STR_LIT>':<EOL><INDENT>app_authz_claim = identity.get_claim_value(Constants.AUTHORIZED_PARTY)<EOL>if not app_authz_claim:<EOL><INDENT>raise Exception('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>app_id = app_authz_claim<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>', version_claim, '<STR_LIT:.>')<EOL><DEDENT>is_valid_app_id = await asyncio.ensure_future(credentials.is_valid_appid(app_id))<EOL>if not is_valid_app_id:<EOL><INDENT>raise Exception('<STR_LIT>', app_id)<EOL><DEDENT>return identity<EOL>


async def get_sign_in_url(<EOL>self, state, code_challenge=None, emulator_url=None, final_redirect=None, *, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_sign_in_url.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT:state>'] = self._serialize.query("<STR_LIT:state>", state, '<STR_LIT:str>')<EOL>if code_challenge is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", code_challenge, '<STR_LIT:str>')<EOL><DEDENT>if emulator_url is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", emulator_url, '<STR_LIT:str>')<EOL><DEDENT>if final_redirect is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", final_redirect, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = await self._client.async_send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise HttpOperationError(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT:str>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

:param state:
:type state: str
:param code_challenge:
:type code_challenge: str
:param emulator_url:
:type emulator_url: str
:param final_redirect:
:type final_redirect: str
: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>`.
:return: str or ClientRawResponse if raw=true
:rtype: str or ~msrest.pipeline.ClientRawResponse
:raises:
 :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`


async def get_token(<EOL>self, user_id, connection_name, channel_id=None, code=None, *, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_token.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", connection_name, '<STR_LIT:str>')<EOL>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>if code is not None:<EOL><INDENT>query_parameters['<STR_LIT:code>'] = self._serialize.query("<STR_LIT:code>", code, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = await self._client.async_send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

:param user_id:
:type user_id: str
:param connection_name:
:type connection_name: str
:param channel_id:
:type channel_id: str
:param code:
:type code: str
: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>`.
:return: TokenResponse or ClientRawResponse if raw=true
:rtype: ~botframework.tokenapi.models.TokenResponse or
 ~msrest.pipeline.ClientRawResponse
:raises:
 :class:`ErrorResponseException<botframework.tokenapi.models.ErrorResponseException>`


async def get_aad_tokens(<EOL>self, user_id, connection_name, channel_id=None, resource_urls=None, *, custom_headers=None, raw=False, **operation_config):

aad_resource_urls = models.AadResourceUrls(resource_urls=resource_urls)<EOL>url = self.get_aad_tokens.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", connection_name, '<STR_LIT:str>')<EOL>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(aad_resource_urls, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = await self._client.async_send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

:param user_id:
:type user_id: str
:param connection_name:
:type connection_name: str
:param channel_id:
:type channel_id: str
:param resource_urls:
:type resource_urls: list[str]
: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>`.
:return: dict or ClientRawResponse if raw=true
:rtype: dict[str, ~botframework.tokenapi.models.TokenResponse] or
 ~msrest.pipeline.ClientRawResponse
:raises:
 :class:`ErrorResponseException<botframework.tokenapi.models.ErrorResponseException>`


async def sign_out(<EOL>self, user_id, connection_name=None, channel_id=None, *, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.sign_out.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>if connection_name is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", connection_name, '<STR_LIT:str>')<EOL><DEDENT>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.delete(url, query_parameters, header_parameters)<EOL>response = await self._client.async_send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT:object>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

:param user_id:
:type user_id: str
:param connection_name:
:type connection_name: str
:param channel_id:
:type channel_id: str
: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>`.
:return: object or ClientRawResponse if raw=true
:rtype: object or ~msrest.pipeline.ClientRawResponse
:raises:
 :class:`ErrorResponseException<botframework.tokenapi.models.ErrorResponseException>`


async def get_token_status(<EOL>self, user_id, channel_id=None, include=None, *, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_token_status.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>if include is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", include, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = await self._client.async_send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>

:param user_id:
:type user_id: str
:param channel_id:
:type channel_id: str
:param include:
:type include: str
: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>`.
:return: list or ClientRawResponse if raw=true
:rtype: list[~botframework.tokenapi.models.TokenStatus] or
 ~msrest.pipeline.ClientRawResponse
:raises:
 :class:`ErrorResponseException<botframework.tokenapi.models.ErrorResponseException>`


def get_token(<EOL>self, user_id, connection_name, channel_id=None, code=None, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_token.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", connection_name, '<STR_LIT:str>')<EOL>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>if code is not None:<EOL><INDENT>query_parameters['<STR_LIT:code>'] = self._serialize.query("<STR_LIT:code>", code, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>


def get_aad_tokens(<EOL>self, user_id, connection_name, channel_id=None, resource_urls=None, custom_headers=None, raw=False, **operation_config):

aad_resource_urls = models.AadResourceUrls(resource_urls=resource_urls)<EOL>url = self.get_aad_tokens.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", connection_name, '<STR_LIT:str>')<EOL>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>header_parameters['<STR_LIT:Content-Type>'] = '<STR_LIT>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>body_content = self._serialize.body(aad_resource_urls, '<STR_LIT>')<EOL>request = self._client.post(url, query_parameters, header_parameters, body_content)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>


def sign_out(<EOL>self, user_id, connection_name=None, channel_id=None, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.sign_out.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>if connection_name is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", connection_name, '<STR_LIT:str>')<EOL><DEDENT>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.delete(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>, <NUM_LIT>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT:object>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>


def get_token_status(<EOL>self, user_id, channel_id=None, include=None, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_token_status.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", user_id, '<STR_LIT:str>')<EOL>if channel_id is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", channel_id, '<STR_LIT:str>')<EOL><DEDENT>if include is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", include, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>


def get_sign_in_url(<EOL>self, state, code_challenge=None, emulator_url=None, final_redirect=None, custom_headers=None, raw=False, **operation_config):

<EOL>url = self.get_sign_in_url.metadata['<STR_LIT:url>']<EOL>query_parameters = {}<EOL>query_parameters['<STR_LIT:state>'] = self._serialize.query("<STR_LIT:state>", state, '<STR_LIT:str>')<EOL>if code_challenge is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", code_challenge, '<STR_LIT:str>')<EOL><DEDENT>if emulator_url is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", emulator_url, '<STR_LIT:str>')<EOL><DEDENT>if final_redirect is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", final_redirect, '<STR_LIT:str>')<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise HttpOperationError(self._deserialize, response)<EOL><DEDENT>deserialized = None<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>deserialized = self._deserialize('<STR_LIT:str>', response)<EOL><DEDENT>if raw:<EOL><INDENT>client_raw_response = ClientRawResponse(deserialized, response)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>


return '<STR_LIT:->'.join((safer_name(self.distribution.get_name()),<EOL>safer_version(self.distribution.get_version())))<EOL>

Return distribution full name with - replaced with _


impl_tag, abi_tag, plat_tag = self.get_tag()<EOL>archive_basename = "<STR_LIT>" % (<EOL>self.wheel_dist_name,<EOL>impl_tag,<EOL>abi_tag,<EOL>plat_tag)<EOL>return archive_basename<EOL>


metadata = self.distribution.get_option_dict('<STR_LIT>')<EOL>if not '<STR_LIT>' in metadata:<EOL><INDENT>return None<EOL><DEDENT>return metadata['<STR_LIT>'][<NUM_LIT:1>]<EOL>

Return license filename from a license-file key in setup.cfg, or None.


metadata = self.distribution.get_option_dict('<STR_LIT>')<EOL>for key, title in (('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>')):<EOL><INDENT>if not key in metadata:<EOL><INDENT>continue<EOL><DEDENT>field = metadata[key]<EOL>for line in field[<NUM_LIT:1>].splitlines():<EOL><INDENT>line = line.strip()<EOL>if not line:<EOL><INDENT>continue<EOL><DEDENT>yield (title, line)<EOL><DEDENT><DEDENT>

Generate requirements from setup.cfg as
        ('Requires-Dist', 'requirement; qualifier') tuples. From a metadata
        section in setup.cfg:

        [metadata]
        provides-extra = extra1
            extra2
        requires-dist = requirement; qualifier
            another; qualifier2
            unqualified

        Yields

        ('Provides-Extra', 'extra1'),
        ('Provides-Extra', 'extra2'),
        ('Requires-Dist', 'requirement; qualifier'),
        ('Requires-Dist', 'another; qualifier2'),
        ('Requires-Dist', 'unqualified')


additional = list(self.setupcfg_requirements())<EOL>if not additional: return<EOL>pkg_info = read_pkg_info(metadata_path)<EOL>if '<STR_LIT>' in pkg_info or '<STR_LIT>' in pkg_info:<EOL><INDENT>warnings.warn('<STR_LIT>')<EOL>del pkg_info['<STR_LIT>']<EOL>del pkg_info['<STR_LIT>']<EOL><DEDENT>for k, v in additional:<EOL><INDENT>pkg_info[k] = v<EOL><DEDENT>write_pkg_info(metadata_path, pkg_info)<EOL>

Add additional requirements from setup.cfg to file metadata_path


def egg2dist(self, egginfo_path, distinfo_path):

def adios(p):<EOL><INDENT>"""<STR_LIT>"""<EOL>if os.path.exists(p) and not os.path.islink(p) and os.path.isdir(p):<EOL><INDENT>shutil.rmtree(p)<EOL><DEDENT>elif os.path.exists(p):<EOL><INDENT>os.unlink(p)<EOL><DEDENT><DEDENT>adios(distinfo_path)<EOL>if not os.path.exists(egginfo_path):<EOL><INDENT>import glob<EOL>pat = os.path.join(os.path.dirname(egginfo_path), '<STR_LIT>')<EOL>possible = glob.glob(pat)<EOL>err = "<STR_LIT>" % (egginfo_path,)<EOL>if possible:<EOL><INDENT>alt = os.path.basename(possible[<NUM_LIT:0>])<EOL>err += "<STR_LIT>" % (alt,)<EOL><DEDENT>raise ValueError(err)<EOL><DEDENT>if os.path.isfile(egginfo_path):<EOL><INDENT>pkginfo_path = egginfo_path<EOL>pkg_info = self._pkginfo_to_metadata(egginfo_path, egginfo_path)<EOL>os.mkdir(distinfo_path)<EOL><DEDENT>else:<EOL><INDENT>pkginfo_path = os.path.join(egginfo_path, '<STR_LIT>')<EOL>pkg_info = self._pkginfo_to_metadata(egginfo_path, pkginfo_path)<EOL>shutil.copytree(egginfo_path, distinfo_path,<EOL>ignore=lambda x, y: set(('<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',)))<EOL>dependency_links_path = os.path.join(distinfo_path, '<STR_LIT>')<EOL>with open(dependency_links_path, '<STR_LIT:r>') as dependency_links_file:<EOL><INDENT>dependency_links = dependency_links_file.read().strip()<EOL><DEDENT>if not dependency_links:<EOL><INDENT>adios(dependency_links_path)<EOL><DEDENT><DEDENT>write_pkg_info(os.path.join(distinfo_path, '<STR_LIT>'), pkg_info)<EOL>metadata_path = os.path.join(distinfo_path, '<STR_LIT>')<EOL>self.add_requirements(metadata_path)<EOL>metadata_json_path = os.path.join(distinfo_path, '<STR_LIT>')<EOL>pymeta = pkginfo_to_dict(metadata_path,<EOL>distribution=self.distribution)<EOL>if '<STR_LIT:description>' in pymeta:<EOL><INDENT>description_filename = '<STR_LIT>'<EOL>description_text = pymeta.pop('<STR_LIT:description>')<EOL>description_path = os.path.join(distinfo_path,<EOL>description_filename)<EOL>with open(description_path, "<STR_LIT:wb>") as description_file:<EOL><INDENT>description_file.write(description_text.encode('<STR_LIT:utf-8>'))<EOL><DEDENT>pymeta['<STR_LIT>']['<STR_LIT>']['<STR_LIT>']['<STR_LIT:description>'] = description_filename<EOL><DEDENT>license = self.license_file()<EOL>if license:<EOL><INDENT>license_filename = '<STR_LIT>'<EOL>shutil.copy(license, os.path.join(self.distinfo_dir, license_filename))<EOL>pymeta['<STR_LIT>']['<STR_LIT>']['<STR_LIT>']['<STR_LIT>'] = license_filename<EOL><DEDENT>with open(metadata_json_path, "<STR_LIT:w>") as metadata_json:<EOL><INDENT>json.dump(pymeta, metadata_json, sort_keys=True)<EOL><DEDENT>adios(egginfo_path)<EOL>

Convert an .egg-info directory into a .dist-info directory


@property<EOL><INDENT>def log_personal_information(self) -> bool:<DEDENT>

return self._log_personal_information<EOL>

Gets a value indicating whether to log personal information that came from the user to telemetry.

        :return: If True, personal information is logged to Telemetry; otherwise the properties will be filtered.
        :rtype: bool


@log_personal_information.setter<EOL><INDENT>def log_personal_information(self, value: bool) -> None:<DEDENT>

self._log_personal_information = value<EOL>

Sets a value indicating whether to log personal information that came from the user to telemetry.

        :param value: If True, personal information is logged to Telemetry; otherwise the properties will be filtered.
        :type value: bool
        :return:
        :rtype: None


@property<EOL><INDENT>def telemetry_client(self) -> BotTelemetryClient:<DEDENT>

return self._telemetry_client<EOL>

Gets the currently configured BotTelemetryClient that logs the event.

        :return: The BotTelemetryClient being used to log events.
        :rtype: BotTelemetryClient


@telemetry_client.setter<EOL><INDENT>def telemetry_client(self, value: BotTelemetryClient):<DEDENT>

self._telemetry_client = value<EOL>

Sets the currently configured BotTelemetryClient that logs the event.

        :param value: The BotTelemetryClient being used to log events.
        :type value: BotTelemetryClient


def fill_qna_event(<EOL>self,<EOL>query_results: [QueryResult],<EOL>turn_context: TurnContext,<EOL>telemetry_properties: Dict[str,str] = None,<EOL>telemetry_metrics: Dict[str,float] = None<EOL>) -> EventData:

properties: Dict[str,str] = dict()<EOL>metrics: Dict[str, float] = dict()<EOL>properties[QnATelemetryConstants.knowledge_base_id_property] = self._endpoint.knowledge_base_id<EOL>text: str = turn_context.activity.text<EOL>userName: str = turn_context.activity.from_property.name<EOL>if self.log_personal_information:<EOL><INDENT>if text:<EOL><INDENT>properties[QnATelemetryConstants.question_property] = text<EOL><DEDENT>if userName:<EOL><INDENT>properties[QnATelemetryConstants.username_property] = userName<EOL><DEDENT><DEDENT>if len(query_results) > <NUM_LIT:0>:<EOL><INDENT>query_result = query_results[<NUM_LIT:0>]<EOL>result_properties = {<EOL>QnATelemetryConstants.matched_question_property: json.dumps(query_result.questions),<EOL>QnATelemetryConstants.question_id_property: str(query_result.id),<EOL>QnATelemetryConstants.answer_property: query_result.answer,<EOL>QnATelemetryConstants.score_metric: query_result.score,<EOL>QnATelemetryConstants.article_found_property: '<STR_LIT:true>'<EOL>}<EOL>properties.update(result_properties)<EOL><DEDENT>else:<EOL><INDENT>no_match_properties = {<EOL>QnATelemetryConstants.matched_question_property : '<STR_LIT>',<EOL>QnATelemetryConstants.question_id_property : '<STR_LIT>',<EOL>QnATelemetryConstants.answer_property : '<STR_LIT>',<EOL>QnATelemetryConstants.article_found_property : '<STR_LIT:false>'<EOL>}<EOL>properties.update(no_match_properties)<EOL><DEDENT>if telemetry_properties:<EOL><INDENT>properties.update(telemetry_properties)<EOL><DEDENT>if telemetry_metrics:<EOL><INDENT>metrics.update(telemetry_metrics)<EOL><DEDENT>return EventData(properties=properties, metrics=metrics)<EOL>

Fills the event properties and metrics for the QnaMessage event for telemetry.

:return: A tuple of event data properties and metrics that will be sent to the BotTelemetryClient.track_event() method for the QnAMessage event. The properties and metrics returned the standard properties logged with any properties passed from the get_answers() method.

:rtype: EventData


async def get_answers(<EOL>self, <EOL>context: TurnContext, <EOL>options: QnAMakerOptions = None, <EOL>telemetry_properties: Dict[str,str] = None,<EOL>telemetry_metrics: Dict[str,int] = None<EOL>) -> [QueryResult]:

hydrated_options = self._hydrate_options(options)<EOL>self._validate_options(hydrated_options)<EOL>result = self._query_qna_service(context.activity, hydrated_options)<EOL>await self._emit_trace_info(context, result, hydrated_options)<EOL>return result<EOL>

Generates answers from the knowledge base.

:return: A list of answers for the user's query, sorted in decreasing order of ranking score.

:rtype: [QueryResult]


def _hydrate_options(self, query_options: QnAMakerOptions) -> QnAMakerOptions:

hydrated_options = copy(self._options)<EOL>if query_options:<EOL><INDENT>if (<EOL>query_options.score_threshold != hydrated_options.score_threshold <EOL>and query_options.score_threshold<EOL>):<EOL><INDENT>hydrated_options.score_threshold = query_options.score_threshold<EOL><DEDENT>if (query_options.top != hydrated_options.top and query_options.top != <NUM_LIT:0>):<EOL><INDENT>hydrated_options.top = query_options.top<EOL><DEDENT>if (len(query_options.strict_filters) > <NUM_LIT:0>):<EOL><INDENT>hydrated_options.strict_filters = query_options.strict_filters<EOL><DEDENT><DEDENT>return hydrated_options<EOL>

Combines QnAMakerOptions passed into the QnAMaker constructor with the options passed as arguments into get_answers().

:return: QnAMakerOptions with options passed into constructor overwritten by new options passed into get_answers()

:rtype: QnAMakerOptions


@property<EOL><INDENT>def score(self) -> float:<DEDENT>

return self._score<EOL>

Gets confidence in an intent.

        :return: Confidence in an intent.
        :rtype: float


@score.setter<EOL><INDENT>def score(self, value: float) -> None:<DEDENT>

self._score = value<EOL>

Sets confidence in an intent.

        :param value: Confidence in an intent.
        :type value: float
        :return:
        :rtype: None


@property<EOL><INDENT>def properties(self) -> Dict[str, object]:<DEDENT>

return self._properties<EOL>

Gets any extra properties to include in the results.

        :return: Any extra properties to include in the results.
        :rtype: Dict[str, object]


@properties.setter<EOL><INDENT>def properties(self, value: Dict[str, object]) -> None:<DEDENT>

self._properties = value<EOL>

Sets any extra properties to include in the results.

        :param value: Any extra properties to include in the results.
        :type value: Dict[str, object]
        :return:
        :rtype: None


def __init__(self, application_id: str, endpoint_key: str, endpoint: str):

_, valid = LuisApplication._try_parse_uuid4(application_id)<EOL>if not valid:<EOL><INDENT>raise ValueError(f'<STR_LIT>')<EOL><DEDENT>_, valid = LuisApplication._try_parse_uuid4(endpoint_key)<EOL>if not valid:<EOL><INDENT>raise ValueError(f'<STR_LIT>')<EOL><DEDENT>if not endpoint or endpoint.isspace():<EOL><INDENT>endpoint = "<STR_LIT>"<EOL><DEDENT>_, valid = LuisApplication._try_parse_url(endpoint)<EOL>if not valid:<EOL><INDENT>raise ValueError(f'<STR_LIT>')<EOL><DEDENT>self._application_id = application_id<EOL>self._endpoint_key = endpoint_key<EOL>self._endpoint = endpoint<EOL>

Initializes a new instance of the <see cref="LuisApplication"/> class.

        :param application_id: LUIS application ID.
        :type application_id: str
        :param endpoint_key: LUIS subscription or endpoint key.
        :type endpoint_key: str
        :param endpoint: LUIS endpoint to use like https://westus.api.cognitive.microsoft.com.
        :type endpoint: str
        :raises ValueError:
        :raises ValueError:
        :raises ValueError:


@classmethod<EOL><INDENT>def from_application_endpoint(cls, application_endpoint: str):<DEDENT>

(application_id, endpoint_key, endpoint) = LuisApplication._parse(<EOL>application_endpoint<EOL>)<EOL>return cls(application_id, endpoint_key, endpoint)<EOL>

Initializes a new instance of the <see cref="LuisApplication"/> class.

        :param application_endpoint: LUIS application endpoint.
        :type application_endpoint: str
        :return:
        :rtype: LuisApplication


@property<EOL><INDENT>def application_id(self) -> str:<DEDENT>

return self._application_id<EOL>

Gets LUIS application ID.

        :return: LUIS application ID.
        :rtype: str


@application_id.setter<EOL><INDENT>def application_id(self, value: str) -> None:<DEDENT>

self._application_id = value<EOL>

Sets LUIS application ID.

        :param value: LUIS application ID.
        :type value: str
        :return:
        :rtype: None


@property<EOL><INDENT>def endpoint_key(self) -> str:<DEDENT>

return self._endpoint_key<EOL>

Gets LUIS subscription or endpoint key.

        :return: LUIS subscription or endpoint key.
        :rtype: str


@endpoint_key.setter<EOL><INDENT>def endpoint_key(self, value: str) -> None:<DEDENT>

self._endpoint_key = value<EOL>

Sets LUIS subscription or endpoint key.

        :param value: LUIS subscription or endpoint key.
        :type value: str
        :return:
        :rtype: None


@property<EOL><INDENT>def endpoint(self) -> str:<DEDENT>

return self._endpoint<EOL>

Gets LUIS endpoint like https://westus.api.cognitive.microsoft.com.

        :return: LUIS endpoint where application is hosted.
        :rtype: str


@endpoint.setter<EOL><INDENT>def endpoint(self, value: str) -> None:<DEDENT>

self._endpoint = value<EOL>

Sets LUIS endpoint like https://westus.api.cognitive.microsoft.com.

        :param value: LUIS endpoint where application is hosted.
        :type value: str
        :return:
        :rtype: None


@property<EOL><INDENT>def bing_spell_check_subscription_key(self) -> str:<DEDENT>

return self._bing_spell_check_subscription_key<EOL>

Gets the Bing Spell Check subscription key.

        :return: The Bing Spell Check subscription key.
        :rtype: str


@bing_spell_check_subscription_key.setter<EOL><INDENT>def bing_spell_check_subscription_key(self, value: str) -> None:<DEDENT>

self._bing_spell_check_subscription_key = value<EOL>

Sets the Bing Spell Check subscription key.

        :param value: The Bing Spell Check subscription key.
        :type value: str
        :return:
        :rtype: None


@property<EOL><INDENT>def include_all_intents(self) -> bool:<DEDENT>

return self._include_all_intents<EOL>

Gets whether all intents come back or only the top one.

        :return: True for returning all intents.
        :rtype: bool


@include_all_intents.setter<EOL><INDENT>def include_all_intents(self, value: bool) -> None:<DEDENT>

self._include_all_intents = value<EOL>

Sets whether all intents come back or only the top one.

        :param value: True for returning all intents.
        :type value: bool
        :return:
        :rtype: None


@property<EOL><INDENT>def include_instance_data(self) -> bool:<DEDENT>

return self._include_instance_data<EOL>

Gets a value indicating whether or not instance data should be included in response.

        :return: A value indicating whether or not instance data should be included in response.
        :rtype: bool


@include_instance_data.setter<EOL><INDENT>def include_instance_data(self, value: bool) -> None:<DEDENT>

self._include_instance_data = value<EOL>

Sets a value indicating whether or not instance data should be included in response.

        :param value: A value indicating whether or not instance data should be included in response.
        :type value: bool
        :return:
        :rtype: None


@property<EOL><INDENT>def log(self) -> bool:<DEDENT>

return self._log<EOL>

Gets if queries should be logged in LUIS.

        :return: If queries should be logged in LUIS.
        :rtype: bool


@log.setter<EOL><INDENT>def log(self, value: bool) -> None:<DEDENT>

self._log = value<EOL>

Sets if queries should be logged in LUIS.

        :param value: If queries should be logged in LUIS.
        :type value: bool
        :return:
        :rtype: None


@property<EOL><INDENT>def spell_check(self) -> bool:<DEDENT>

return self._spell_check<EOL>

Gets whether to spell check queries.

        :return: Whether to spell check queries.
        :rtype: bool


@spell_check.setter<EOL><INDENT>def spell_check(self, value: bool) -> None:<DEDENT>

self._spell_check = value<EOL>

Sets whether to spell check queries.

        :param value: Whether to spell check queries.
        :type value: bool
        :return:
        :rtype: None


@property<EOL><INDENT>def staging(self) -> bool:<DEDENT>

return self._staging<EOL>

Gets whether to use the staging endpoint.

        :return: Whether to use the staging endpoint.
        :rtype: bool


@staging.setter<EOL><INDENT>def staging(self, value: bool) -> None:<DEDENT>

self._staging = value<EOL>

Sets whether to use the staging endpoint.

        :param value: Whether to use the staging endpoint.
        :type value: bool
        :return:
        :rtype: None


@property<EOL><INDENT>def timeout(self) -> float:<DEDENT>

return self._timeout<EOL>

Gets the time in milliseconds to wait before the request times out.

        :return: The time in milliseconds to wait before the request times out. Default is 100000 milliseconds.
        :rtype: float


@timeout.setter<EOL><INDENT>def timeout(self, value: float) -> None:<DEDENT>

self._timeout = value<EOL>

Sets the time in milliseconds to wait before the request times out.

        :param value: The time in milliseconds to wait before the request times out. Default is 100000 milliseconds.
        :type value: float
        :return:
        :rtype: None


@property<EOL><INDENT>def timezone_offset(self) -> float:<DEDENT>

return self._timezone_offset<EOL>

Gets the time zone offset.

        :return: The time zone offset.
        :rtype: float


@timezone_offset.setter<EOL><INDENT>def timezone_offset(self, value: float) -> None:<DEDENT>

self._timezone_offset = value<EOL>

Sets the time zone offset.

        :param value: The time zone offset.
        :type value: float
        :return:
        :rtype: None


@property<EOL><INDENT>def telemetry_client(self) -> BotTelemetryClient:<DEDENT>

return self._telemetry_client<EOL>

Gets the BotTelemetryClient used to log the LuisResult event.

        :return: The client used to log telemetry events.
        :rtype: BotTelemetryClient


@telemetry_client.setter<EOL><INDENT>def telemetry_client(self, value: BotTelemetryClient) -> None:<DEDENT>

self._telemetry_client = value<EOL>

Sets the BotTelemetryClient used to log the LuisResult event.

        :param value: The client used to log telemetry events.
        :type value: BotTelemetryClient
        :return:
        :rtype: None


@property<EOL><INDENT>def log_personal_information(self) -> bool:<DEDENT>

Gets a value indicating whether to log personal information that came from the user to telemetry.

        :return: If true, personal information is logged to Telemetry; otherwise the properties will be filtered.
        :rtype: bool


@log_personal_information.setter<EOL><INDENT>def log_personal_information(self, value: bool) -> None:<DEDENT>

self.log_personal_information = value<EOL>

Sets a value indicating whether to log personal information that came from the user to telemetry.

        :param value: If true, personal information is logged to Telemetry; otherwise the properties will be filtered.
        :type value: bool
        :return:
        :rtype: None


def __init__(<EOL>self,<EOL>application: Union[LuisApplication, str],<EOL>prediction_options: LuisPredictionOptions = None,<EOL>include_api_results: bool = False,<EOL>):

if isinstance(application, LuisApplication):<EOL><INDENT>self._application = application<EOL><DEDENT>elif isinstance(application, str):<EOL><INDENT>self._application = LuisApplication.from_application_endpoint(application)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>self._options = prediction_options or LuisPredictionOptions()<EOL>self._include_api_results = include_api_results<EOL>self._telemetry_client = self._options.telemetry_client<EOL>self._log_personal_information = self._options.log_personal_information<EOL>credentials = CognitiveServicesCredentials(self._application.endpoint_key)<EOL>self._runtime = LUISRuntimeClient(self._application.endpoint, credentials)<EOL>self._runtime.config.add_user_agent(LuisUtil.get_user_agent())<EOL>self._runtime.config.connection.timeout = self._options.timeout // <NUM_LIT:1000><EOL>

Initializes a new instance of the <see cref="LuisRecognizer"/> class.

        :param application: The LUIS application to use to recognize text.
        :type application: LuisApplication
        :param prediction_options: The LUIS prediction options to use, defaults to None
        :param prediction_options: LuisPredictionOptions, optional
        :param include_api_results: True to include raw LUIS API response, defaults to False
        :param include_api_results: bool, optional
        :raises TypeError:


Gets a value indicating whether to log personal information that came from the user to telemetry.

        :return: If True, personal information is logged to Telemetry; otherwise the properties will be filtered.
        :rtype: bool


Sets a value indicating whether to log personal information that came from the user to telemetry.

        :param value: If True, personal information is logged to Telemetry; otherwise the properties will be filtered.
        :type value: bool
        :return:
        :rtype: None


return self._telemetry_client<EOL>

Gets the currently configured <see cref="BotTelemetryClient"/> that logs the LuisResult event.

        :return: The <see cref="BotTelemetryClient"/> being used to log events.
        :rtype: BotTelemetryClient


@telemetry_client.setter<EOL><INDENT>def telemetry_client(self, value: BotTelemetryClient):<DEDENT>

self._telemetry_client = value<EOL>

Gets the currently configured <see cref="BotTelemetryClient"/> that logs the LuisResult event.

        :param value: The <see cref="BotTelemetryClient"/> being used to log events.
        :type value: BotTelemetryClient


@staticmethod<EOL><INDENT>def top_intent(<EOL>results: RecognizerResult, default_intent: str = "<STR_LIT:None>", min_score: float = <NUM_LIT:0.0><EOL>) -> str:<DEDENT>

if results is None:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>top_intent: str = None<EOL>top_score: float = -<NUM_LIT:1.0><EOL>if results.intents:<EOL><INDENT>for intent_name, intent_score in results.intents.items():<EOL><INDENT>score = intent_score.score<EOL>if score > top_score and score >= min_score:<EOL><INDENT>top_intent = intent_name<EOL>top_score = score<EOL><DEDENT><DEDENT><DEDENT>return top_intent or default_intent<EOL>

Returns the name of the top scoring intent from a set of LUIS results.

        :param results: Result set to be searched.
        :type results: RecognizerResult
        :param default_intent: Intent name to return should a top intent be found, defaults to "None"
        :param default_intent: str, optional
        :param min_score: Minimum score needed for an intent to be considered as a top intent. If all intents in the set are below this threshold then the `defaultIntent` will be returned, defaults to 0.0
        :param min_score: float, optional
        :raises TypeError:
        :return: The top scoring intent name.
        :rtype: str


async def recognize(<EOL>self,<EOL>turn_context: TurnContext,<EOL>telemetry_properties: Dict[str, str] = None,<EOL>telemetry_metrics: Dict[str, float] = None,<EOL>) -> RecognizerResult:

return await self._recognize_internal(<EOL>turn_context, telemetry_properties, telemetry_metrics<EOL>)<EOL>

Return results of the analysis (Suggested actions and intents).

        :param turn_context: Context object containing information for a single turn of conversation with a user.
        :type turn_context: TurnContext
        :param telemetry_properties: Additional properties to be logged to telemetry with the LuisResult event, defaults to None
        :param telemetry_properties: Dict[str, str], optional
        :param telemetry_metrics: Additional metrics to be logged to telemetry with the LuisResult event, defaults to None
        :param telemetry_metrics: Dict[str, float], optional
        :return: The LUIS results of the analysis of the current message text in the current turn's context activity.
        :rtype: RecognizerResult


def on_recognizer_result(<EOL>self,<EOL>recognizer_result: RecognizerResult,<EOL>turn_context: TurnContext,<EOL>telemetry_properties: Dict[str, str] = None,<EOL>telemetry_metrics: Dict[str, float] = None,<EOL>):

properties = self.fill_luis_event_properties(<EOL>recognizer_result, turn_context, telemetry_properties<EOL>)<EOL>self.telemetry_client.track_event(<EOL>LuisTelemetryConstants.luis_result, properties, telemetry_metrics<EOL>)<EOL>

Invoked prior to a LuisResult being logged.

        :param recognizer_result: The Luis Results for the call.
        :type recognizer_result: RecognizerResult
        :param turn_context: Context object containing information for a single turn of conversation with a user.
        :type turn_context: TurnContext
        :param telemetry_properties: Additional properties to be logged to telemetry with the LuisResult event, defaults to None
        :param telemetry_properties: Dict[str, str], optional
        :param telemetry_metrics: Additional metrics to be logged to telemetry with the LuisResult event, defaults to None
        :param telemetry_metrics: Dict[str, float], optional


def fill_luis_event_properties(<EOL>self,<EOL>recognizer_result: RecognizerResult,<EOL>turn_context: TurnContext,<EOL>telemetry_properties: Dict[str, str] = None,<EOL>) -> Dict[str, str]:

intents = recognizer_result.intents<EOL>top_two_intents = (<EOL>sorted(intents.keys(), key=lambda k: intents[k].score, reverse=True)[:<NUM_LIT:2>]<EOL>if intents<EOL>else []<EOL>)<EOL>intent_name, intent_score = LuisRecognizer._get_top_k_intent_score(<EOL>top_two_intents, intents, index=<NUM_LIT:0><EOL>)<EOL>intent2_name, intent2_score = LuisRecognizer._get_top_k_intent_score(<EOL>top_two_intents, intents, index=<NUM_LIT:1><EOL>)<EOL>properties: Dict[str, str] = {<EOL>LuisTelemetryConstants.application_id_property: self._application.application_id,<EOL>LuisTelemetryConstants.intent_property: intent_name,<EOL>LuisTelemetryConstants.intent_score_property: intent_score,<EOL>LuisTelemetryConstants.intent2_property: intent2_name,<EOL>LuisTelemetryConstants.intent_score2_property: intent2_score,<EOL>LuisTelemetryConstants.from_id_property: turn_context.activity.from_property.id,<EOL>}<EOL>sentiment = recognizer_result.properties.get("<STR_LIT>")<EOL>if sentiment is not None and isinstance(sentiment, Dict):<EOL><INDENT>label = sentiment.get("<STR_LIT:label>")<EOL>if label is not None:<EOL><INDENT>properties[LuisTelemetryConstants.sentiment_label_property] = str(label)<EOL><DEDENT>score = sentiment.get("<STR_LIT>")<EOL>if score is not None:<EOL><INDENT>properties[LuisTelemetryConstants.sentiment_score_property] = str(score)<EOL><DEDENT><DEDENT>entities = None<EOL>if recognizer_result.entities is not None:<EOL><INDENT>entities = json.dumps(recognizer_result.entities)<EOL><DEDENT>properties[LuisTelemetryConstants.entities_property] = entities<EOL>if self.log_personal_information and turn_context.activity.text:<EOL><INDENT>properties[<EOL>LuisTelemetryConstants.question_property<EOL>] = turn_context.activity.text<EOL><DEDENT>if telemetry_properties is not None:<EOL><INDENT>for key in telemetry_properties:<EOL><INDENT>properties[key] = telemetry_properties[key]<EOL><DEDENT><DEDENT>return properties<EOL>

Fills the event properties for LuisResult event for telemetry.
        These properties are logged when the recognizer is called.

        :param recognizer_result: Last activity sent from user.
        :type recognizer_result: RecognizerResult
        :param turn_context: Context object containing information for a single turn of conversation with a user.
        :type turn_context: TurnContext
        :param telemetry_properties: Additional properties to be logged to telemetry with the LuisResult event, defaults to None
        :param telemetry_properties: Dict[str, str], optional
        :return: A dictionary that is sent as "Properties" to IBotTelemetryClient.TrackEvent method for the BotMessageSend event.
        :rtype: Dict[str, str]