Skip to content

Commit

Permalink
aiohttp 3.10.2 (#2158)
Browse files Browse the repository at this point in the history
* aiohttp 3.10.2

* Fixing pylint errors

---------

Co-authored-by: tracyboehrer <[email protected]>
  • Loading branch information
gandiddi and tracyboehrer authored Sep 3, 2024
1 parent 86673e2 commit b802535
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 11 deletions.
11 changes: 10 additions & 1 deletion libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import asyncio
import json
from typing import Dict, List, NamedTuple, Union
from aiohttp import ClientSession, ClientTimeout
Expand Down Expand Up @@ -52,8 +53,16 @@ def __init__(
opt = options or QnAMakerOptions()
self._validate_options(opt)

try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

instance_timeout = ClientTimeout(total=opt.timeout / 1000)
self._http_client = http_client or ClientSession(timeout=instance_timeout)
self._http_client = http_client or ClientSession(
timeout=instance_timeout, loop=loop
)

self.telemetry_client: Union[BotTelemetryClient, NullTelemetryClient] = (
telemetry_client or NullTelemetryClient()
Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder-ai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"azure-cognitiveservices-language-luis==0.2.0",
"botbuilder-schema==4.17.0",
"botbuilder-core==4.17.0",
"aiohttp==3.9.5",
"aiohttp==3.10.2",
]

TESTS_REQUIRES = ["aiounittest>=1.1.0"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def __call__(self, environ, start_response):

def process_request(self, environ) -> bool:
"""Process the incoming Flask request."""
body_unicode = None

# Bot Service doesn't handle anything over 256k
length = int(environ.get("CONTENT_LENGTH", "0"))
if length > 256 * 1024:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def for_channel(
else:
size = len(choice.value)

if size > max_title_length:
max_title_length = size
max_title_length = max(max_title_length, size)

# Determine list style
supports_suggested_actions = Channel.supports_suggested_actions(
Expand Down
3 changes: 1 addition & 2 deletions libraries/botbuilder-dialogs/botbuilder/dialogs/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def _register_source_location(
Registers a SourceRange in the provided location.
:param path: The path to the source file.
:param line_number: The line number where the source will be located on the file.
:return:
"""
if path:
# This will be added when debbuging support is ported.
Expand All @@ -185,4 +184,4 @@ def _register_source_location(
# start_point = SourcePoint(line_index = line_number, char_index = 0 ),
# end_point = SourcePoint(line_index = line_number + 1, char_index = 0 ),
# )
return
pass
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ async def receive(self) -> WebSocketMessage:
try:
message = await self._aiohttp_ws.receive()

message_data = None

if message.type == WSMsgType.TEXT:
message_data = list(str(message.data).encode("ascii"))
elif message.type == WSMsgType.BINARY:
Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder-integration-aiohttp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"botframework-connector==4.17.0",
"botbuilder-core==4.17.0",
"yarl>=1.8.1",
"aiohttp==3.9.5",
"aiohttp==3.10.2",
]

root = os.path.abspath(os.path.dirname(__file__))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

REQUIRES = [
"applicationinsights>=0.11.9",
"aiohttp==3.9.5",
"aiohttp==3.10.2",
"botbuilder-schema==4.17.0",
"botframework-connector==4.17.0",
"botbuilder-core==4.17.0",
Expand Down
6 changes: 3 additions & 3 deletions libraries/botbuilder-schema/botbuilder/schema/_models_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def create_reply(self, text: str = None, locale: str = None):
),
reply_to_id=(
self.id
if not type == ActivityTypes.conversation_update
if type != ActivityTypes.conversation_update
or self.channel_id not in ["directline", "webchat"]
else None
),
Expand Down Expand Up @@ -688,7 +688,7 @@ def create_trace(
),
reply_to_id=(
self.id
if not type == ActivityTypes.conversation_update
if type != ActivityTypes.conversation_update
or self.channel_id not in ["directline", "webchat"]
else None
),
Expand Down Expand Up @@ -749,7 +749,7 @@ def get_conversation_reference(self):
return ConversationReference(
activity_id=(
self.id
if not type == ActivityTypes.conversation_update
if type != ActivityTypes.conversation_update
or self.channel_id not in ["directline", "webchat"]
else None
),
Expand Down

0 comments on commit b802535

Please sign in to comment.