From d47564096b343da2a59239e5cc9c4a334e28f9ce Mon Sep 17 00:00:00 2001 From: Alex Acebo Date: Wed, 11 Oct 2023 09:18:19 -0700 Subject: [PATCH] Python 3.11 Compatibility (#2022) * make updates to run tests with 3.11 * run black * Update botbuilder-python-ci.yml * update azure devtools * remove `azure-devtools` due to it being archived * remove deprecation warning * lint ignore test files * ignore tests folder entirely * Update .pylintrc * Update .pylintrc * Update .pylintrc * only fail on errors * Update botbuilder-python-ci.yml * fixes for lint * test update pylint version * remove python 3.11 matrix (to be added in separate PR) --- .pylintrc | 5 +++-- .../botbuilder/ai/luis/luis_recognizer.py | 2 -- .../botbuilder/ai/luis/luis_recognizer_v2.py | 2 -- .../botbuilder/ai/luis/luis_recognizer_v3.py | 2 -- .../botbuilder-ai/botbuilder/ai/qna/qnamaker.py | 1 - .../tests/test_telemetry_waterfall.py | 2 -- .../botbuilder/azure/blob_storage.py | 2 +- .../azure/cosmosdb_partitioned_storage.py | 2 +- .../botbuilder/azure/cosmosdb_storage.py | 2 +- .../botbuilder/core/bot_framework_adapter.py | 1 - .../botbuilder-core/botbuilder/core/bot_state.py | 1 - .../botbuilder/core/bot_state_set.py | 14 ++++---------- .../core/inspection/inspection_middleware.py | 3 --- .../botbuilder/core/memory_storage.py | 2 +- .../botbuilder/core/middleware_set.py | 2 +- .../botbuilder/core/skills/skill_handler.py | 1 - .../streaming/bot_framework_http_adapter_base.py | 2 +- .../botbuilder/core/teams/teams_info.py | 1 - .../botbuilder/core/turn_context.py | 1 - .../tests/test_bot_framework_adapter.py | 1 - .../tests/test_inspection_middleware.py | 2 -- .../tests/test_memory_transcript_store.py | 1 + .../botbuilder-core/tests/test_message_factory.py | 1 - .../botbuilder-core/tests/test_middleware_set.py | 1 - .../botbuilder-core/tests/test_turn_context.py | 2 +- .../botbuilder/dialogs/choices/find.py | 1 - .../botbuilder/dialogs/dialog_container.py | 1 - .../botbuilder/dialogs/dialog_events.py | 1 - .../dialogs/memory/dialog_state_manager.py | 1 - .../memory/path_resolvers/at_path_resolver.py | 1 - .../dialogs/memory/scopes/class_memory_scope.py | 2 +- .../botbuilder/dialogs/waterfall_dialog.py | 2 -- .../tests/test_confirm_prompt.py | 1 - .../tests/test_date_time_prompt.py | 1 - .../botbuilder-dialogs/tests/test_number_prompt.py | 1 - .../botbuilder-dialogs/tests/test_oauth_prompt.py | 2 -- .../botbuilder-dialogs/tests/test_waterfall.py | 1 - .../aiohttp/skills/skill_http_client.py | 1 - libraries/botbuilder-integration-aiohttp/setup.py | 2 +- .../botbuilder/schema/__init__.py | 4 ---- .../botbuilder/schema/_connector_client_enums.py | 13 ------------- .../botbuilder/schema/_models_py3.py | 1 - .../botbuilder/schema/_sign_in_enums.py | 1 - libraries/botbuilder-schema/setup.py | 3 +-- .../botframework-connector/azure_bdist_wheel.py | 3 +-- .../botframework/connector/_configuration.py | 1 - .../_attachments_operations_async.py | 1 - .../_conversations_operations_async.py | 1 - .../connector/async_mixin/async_mixin.py | 1 - .../connector/auth/authentication_constants.py | 1 - .../auth/enterprise_channel_validation.py | 1 - .../auth/government_channel_validation.py | 1 - .../connector/auth/jwt_token_validation.py | 1 - .../botframework/connector/connector_client.py | 1 - .../operations/_attachments_operations.py | 1 - .../operations/_conversations_operations.py | 1 - .../connector/teams/operations/teams_operations.py | 1 - .../connector/teams/teams_connector_client.py | 2 -- .../connector/token_api/_configuration.py | 1 - .../connector/token_api/_token_api_client.py | 1 - .../token_api/aio/_token_api_client_async.py | 1 - .../_bot_sign_in_operations_async.py | 1 - .../_user_token_operations_async.py | 1 - .../connector/token_api/models/_models.py | 1 - .../connector/token_api/models/_models_py3.py | 1 - .../operations/_bot_sign_in_operations.py | 1 - .../token_api/operations/_user_token_operations.py | 1 - .../botframework-connector/tests/requirements.txt | 3 +-- .../tests/test_attachments.py | 7 +++---- .../tests/test_attachments_async.py | 7 +++---- .../tests/test_conversations.py | 7 +++---- .../tests/test_conversations_async.py | 7 +++---- .../streaming/payload_transport/send_queue.py | 1 + .../streaming/payloads/header_serializer.py | 1 - .../functionaltestbot/functionaltestbot/app.py | 2 ++ pipelines/botbuilder-python-ci.yml | 3 +++ 76 files changed, 38 insertions(+), 122 deletions(-) diff --git a/.pylintrc b/.pylintrc index d0ec3b74a..955005f07 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,7 +7,7 @@ extension-pkg-whitelist= # Add files or directories to the blacklist. They should be base names, not # paths. -ignore=CVS,build,botbuilder-schema,samples,django_tests,Generator,operations,operations_async,schema +ignore=CVS,build,botbuilder-schema,samples,django_tests,Generator,operations,operations_async,schema,tests # Add files or directories matching the regex patterns to the blacklist. The # regex matches against base names, not paths. @@ -160,7 +160,8 @@ disable=print-statement, no-name-in-module, too-many-branches, too-many-ancestors, - too-many-nested-blocks + too-many-nested-blocks, + attribute-defined-outside-init # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py index 9c09af773..a95ebae96 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py @@ -256,7 +256,6 @@ async def _recognize_internal( LuisPredictionOptions, LuisRecognizerOptionsV2, LuisRecognizerOptionsV3 ] = None, ) -> RecognizerResult: - BotAssert.context_not_none(turn_context) if turn_context.activity.type != ActivityTypes.message: @@ -277,7 +276,6 @@ async def _recognize_internal( text=utterance, intents={"": IntentScore(score=1.0)}, entities={} ) else: - luis_recognizer = self._build_recognizer(options) recognizer_result = await luis_recognizer.recognizer_internal(turn_context) diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v2.py b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v2.py index 34d246d99..b58c9b40c 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v2.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v2.py @@ -18,7 +18,6 @@ class LuisRecognizerV2(LuisRecognizerInternal): - # The value type for a LUIS trace activity. luis_trace_type: str = "https://www.luis.ai/schemas/trace" @@ -43,7 +42,6 @@ def __init__( self._application = luis_application async def recognizer_internal(self, turn_context: TurnContext): - utterance: str = ( turn_context.activity.text if turn_context.activity is not None else None ) diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v3.py b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v3.py index 09cb8594e..b487abfb5 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v3.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v3.py @@ -102,7 +102,6 @@ async def recognizer_internal(self, turn_context: TurnContext): return recognizer_result def _build_url(self): - base_uri = ( self._application.endpoint or "https://westus.api.cognitive.microsoft.com" ) @@ -172,7 +171,6 @@ def _extract_entities_and_metadata(self, luis_result): return self._map_properties(entities, False) def _map_properties(self, source, in_instance): - if isinstance(source, (int, float, bool, str)): return source diff --git a/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py b/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py index 18a77521a..e0bf9bae1 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py +++ b/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py @@ -254,7 +254,6 @@ def _validate_options(self, options: QnAMakerOptions): def _has_matched_answer_in_kb(self, query_results: [QueryResult]) -> bool: if query_results: if query_results[0].id != -1: - return True return False diff --git a/libraries/botbuilder-applicationinsights/tests/test_telemetry_waterfall.py b/libraries/botbuilder-applicationinsights/tests/test_telemetry_waterfall.py index 31f10527c..a0952907a 100644 --- a/libraries/botbuilder-applicationinsights/tests/test_telemetry_waterfall.py +++ b/libraries/botbuilder-applicationinsights/tests/test_telemetry_waterfall.py @@ -65,7 +65,6 @@ async def step2(step) -> DialogTurnResult: # Initialize TestAdapter async def exec_test(turn_context: TurnContext) -> None: - dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: @@ -119,7 +118,6 @@ async def step2(step) -> DialogTurnResult: # Initialize TestAdapter async def exec_test(turn_context: TurnContext) -> None: - dialog_context = await dialogs.create_context(turn_context) await dialog_context.continue_dialog() if not turn_context.responded: diff --git a/libraries/botbuilder-azure/botbuilder/azure/blob_storage.py b/libraries/botbuilder-azure/botbuilder/azure/blob_storage.py index 02576a04f..4ed6793e4 100644 --- a/libraries/botbuilder-azure/botbuilder/azure/blob_storage.py +++ b/libraries/botbuilder-azure/botbuilder/azure/blob_storage.py @@ -143,7 +143,7 @@ async def write(self, changes: Dict[str, object]): await self._initialize() - for (name, item) in changes.items(): + for name, item in changes.items(): blob_reference = self.__container_client.get_blob_client(name) e_tag = None diff --git a/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py b/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py index db5ae1685..982ac5974 100644 --- a/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py +++ b/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py @@ -146,7 +146,7 @@ async def write(self, changes: Dict[str, object]): await self.initialize() - for (key, change) in changes.items(): + for key, change in changes.items(): e_tag = None if isinstance(change, dict): e_tag = change.get("e_tag", None) diff --git a/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py b/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py index 9a1c89d2e..b5e29e650 100644 --- a/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py +++ b/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py @@ -178,7 +178,7 @@ async def write(self, changes: Dict[str, object]): if not self.__container_exists: self.__create_db_and_container() # iterate over the changes - for (key, change) in changes.items(): + for key, change in changes.items(): # store the e_tag e_tag = None if isinstance(change, dict): diff --git a/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py b/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py index 1e1b7bddb..15e23e8f0 100644 --- a/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py +++ b/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py @@ -910,7 +910,6 @@ async def get_user_token( magic_code: str = None, oauth_app_credentials: AppCredentials = None, # pylint: disable=unused-argument ) -> TokenResponse: - """ Attempts to retrieve the token for a user that's in a login flow. diff --git a/libraries/botbuilder-core/botbuilder/core/bot_state.py b/libraries/botbuilder-core/botbuilder/core/bot_state.py index 867fb07e0..72a2c2cfb 100644 --- a/libraries/botbuilder-core/botbuilder/core/bot_state.py +++ b/libraries/botbuilder-core/botbuilder/core/bot_state.py @@ -18,7 +18,6 @@ class CachedBotState: """ def __init__(self, state: Dict[str, object] = None): - self.state = state if state is not None else {} self.hash = self.compute_hash(state) diff --git a/libraries/botbuilder-core/botbuilder/core/bot_state_set.py b/libraries/botbuilder-core/botbuilder/core/bot_state_set.py index 99016af48..67d337088 100644 --- a/libraries/botbuilder-core/botbuilder/core/bot_state_set.py +++ b/libraries/botbuilder-core/botbuilder/core/bot_state_set.py @@ -1,7 +1,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from asyncio import wait from typing import List from .bot_state import BotState from .turn_context import TurnContext @@ -19,14 +18,9 @@ def add(self, bot_state: BotState) -> "BotStateSet": return self async def load_all(self, turn_context: TurnContext, force: bool = False): - await wait( - [bot_state.load(turn_context, force) for bot_state in self.bot_states] - ) + for bot_state in self.bot_states: + await bot_state.load(turn_context, force) async def save_all_changes(self, turn_context: TurnContext, force: bool = False): - await wait( - [ - bot_state.save_changes(turn_context, force) - for bot_state in self.bot_states - ] - ) + for bot_state in self.bot_states: + await bot_state.save_changes(turn_context, force) diff --git a/libraries/botbuilder-core/botbuilder/core/inspection/inspection_middleware.py b/libraries/botbuilder-core/botbuilder/core/inspection/inspection_middleware.py index 02335092a..2f84b0efd 100644 --- a/libraries/botbuilder-core/botbuilder/core/inspection/inspection_middleware.py +++ b/libraries/botbuilder-core/botbuilder/core/inspection/inspection_middleware.py @@ -29,7 +29,6 @@ def __init__( # pylint: disable=super-init-not-called conversation_state: ConversationState = None, credentials: MicrosoftAppCredentials = None, ): - self.inspection_state = inspection_state self.inspection_state_accessor = inspection_state.create_property( "InspectionSessionByStatus" @@ -43,13 +42,11 @@ def __init__( # pylint: disable=super-init-not-called async def process_command(self, context: TurnContext) -> Any: if context.activity.type == ActivityTypes.message and context.activity.text: - original_text = context.activity.text TurnContext.remove_recipient_mention(context.activity) command = context.activity.text.strip().split(" ") if len(command) > 1 and command[0] == InspectionMiddleware._COMMAND: - if len(command) == 2 and command[1] == "open": await self._process_open_command(context) return True diff --git a/libraries/botbuilder-core/botbuilder/core/memory_storage.py b/libraries/botbuilder-core/botbuilder/core/memory_storage.py index b1ec20f75..cc4a04aed 100644 --- a/libraries/botbuilder-core/botbuilder/core/memory_storage.py +++ b/libraries/botbuilder-core/botbuilder/core/memory_storage.py @@ -40,7 +40,7 @@ async def write(self, changes: Dict[str, StoreItem]): return try: # iterate over the changes - for (key, change) in changes.items(): + for key, change in changes.items(): new_value = deepcopy(change) old_state_etag = None diff --git a/libraries/botbuilder-core/botbuilder/core/middleware_set.py b/libraries/botbuilder-core/botbuilder/core/middleware_set.py index aaa7f03cc..c62873b23 100644 --- a/libraries/botbuilder-core/botbuilder/core/middleware_set.py +++ b/libraries/botbuilder-core/botbuilder/core/middleware_set.py @@ -45,7 +45,7 @@ def use(self, *middleware: Middleware): :param middleware : :return: """ - for (idx, mid) in enumerate(middleware): + for idx, mid in enumerate(middleware): if hasattr(mid, "on_turn") and callable(mid.on_turn): self._middleware.append(mid) return self diff --git a/libraries/botbuilder-core/botbuilder/core/skills/skill_handler.py b/libraries/botbuilder-core/botbuilder/core/skills/skill_handler.py index 476ce2849..8ea67e186 100644 --- a/libraries/botbuilder-core/botbuilder/core/skills/skill_handler.py +++ b/libraries/botbuilder-core/botbuilder/core/skills/skill_handler.py @@ -20,7 +20,6 @@ class SkillHandler(ChannelServiceHandler): - SKILL_CONVERSATION_REFERENCE_KEY = ( "botbuilder.core.skills.SkillConversationReference" ) diff --git a/libraries/botbuilder-core/botbuilder/core/streaming/bot_framework_http_adapter_base.py b/libraries/botbuilder-core/botbuilder/core/streaming/bot_framework_http_adapter_base.py index 86bd9246a..73b8331b7 100644 --- a/libraries/botbuilder-core/botbuilder/core/streaming/bot_framework_http_adapter_base.py +++ b/libraries/botbuilder-core/botbuilder/core/streaming/bot_framework_http_adapter_base.py @@ -89,7 +89,7 @@ def can_process_outgoing_activity(self, activity: Activity) -> bool: return not activity.service_url.startswith("https") async def process_outgoing_activity( - self, turn_context: TurnContext, activity: Activity + self, _turn_context: TurnContext, activity: Activity ) -> ResourceResponse: if not activity: raise TypeError( diff --git a/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py b/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py index c2a84a43a..2cd9ee0c7 100644 --- a/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py +++ b/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py @@ -141,7 +141,6 @@ async def get_paged_team_members( async def get_paged_members( turn_context: TurnContext, continuation_token: str = None, page_size: int = None ) -> List[TeamsPagedMembersResult]: - team_id = TeamsInfo.get_team_id(turn_context) if not team_id: conversation_id = turn_context.activity.conversation.id diff --git a/libraries/botbuilder-core/botbuilder/core/turn_context.py b/libraries/botbuilder-core/botbuilder/core/turn_context.py index b8799a02b..2b4d688af 100644 --- a/libraries/botbuilder-core/botbuilder/core/turn_context.py +++ b/libraries/botbuilder-core/botbuilder/core/turn_context.py @@ -18,7 +18,6 @@ class TurnContext: - # Same constant as in the BF Adapter, duplicating here to avoid circular dependency _INVOKE_RESPONSE_KEY = "BotFrameworkAdapter.InvokeResponse" diff --git a/libraries/botbuilder-core/tests/test_bot_framework_adapter.py b/libraries/botbuilder-core/tests/test_bot_framework_adapter.py index 616971f64..8e987665a 100644 --- a/libraries/botbuilder-core/tests/test_bot_framework_adapter.py +++ b/libraries/botbuilder-core/tests/test_bot_framework_adapter.py @@ -319,7 +319,6 @@ async def aux_func_assert_tenant_id_copied(context): await adapter.process_activity(incoming, "", aux_func_assert_tenant_id_copied) async def test_should_create_valid_conversation_for_msteams(self): - tenant_id = "testTenant" reference = deepcopy(REFERENCE) diff --git a/libraries/botbuilder-core/tests/test_inspection_middleware.py b/libraries/botbuilder-core/tests/test_inspection_middleware.py index 68259a1b4..dbd2c7409 100644 --- a/libraries/botbuilder-core/tests/test_inspection_middleware.py +++ b/libraries/botbuilder-core/tests/test_inspection_middleware.py @@ -113,7 +113,6 @@ async def exec_test(turn_context): y_prop = conversation_state.create_property("y") async def exec_test2(turn_context): - await turn_context.send_activity( MessageFactory.text(f"echo: { turn_context.activity.text }") ) @@ -227,7 +226,6 @@ async def exec_test(turn_context): y_prop = conversation_state.create_property("y") async def exec_test2(turn_context): - await turn_context.send_activity( MessageFactory.text(f"echo: {turn_context.activity.text}") ) diff --git a/libraries/botbuilder-core/tests/test_memory_transcript_store.py b/libraries/botbuilder-core/tests/test_memory_transcript_store.py index 12cb0e8a7..14b313c92 100644 --- a/libraries/botbuilder-core/tests/test_memory_transcript_store.py +++ b/libraries/botbuilder-core/tests/test_memory_transcript_store.py @@ -26,6 +26,7 @@ ConversationReference, ) + # pylint: disable=line-too-long,missing-docstring class TestMemoryTranscriptStore(aiounittest.AsyncTestCase): # pylint: disable=unused-argument diff --git a/libraries/botbuilder-core/tests/test_message_factory.py b/libraries/botbuilder-core/tests/test_message_factory.py index 265ef379a..3012dc498 100644 --- a/libraries/botbuilder-core/tests/test_message_factory.py +++ b/libraries/botbuilder-core/tests/test_message_factory.py @@ -49,7 +49,6 @@ def assert_attachments(activity: Activity, count: int, types: List[str] = None): class TestMessageFactory(aiounittest.AsyncTestCase): - suggested_actions = [ CardAction(title="a", type=ActionTypes.im_back, value="a"), CardAction(title="b", type=ActionTypes.im_back, value="b"), diff --git a/libraries/botbuilder-core/tests/test_middleware_set.py b/libraries/botbuilder-core/tests/test_middleware_set.py index a6785c508..55f6c471f 100644 --- a/libraries/botbuilder-core/tests/test_middleware_set.py +++ b/libraries/botbuilder-core/tests/test_middleware_set.py @@ -56,7 +56,6 @@ async def request_handler(context_or_string): await middleware_set.receive_activity_internal("Bye", request_handler) async def test_middleware_run_in_order(self): - called_first = False called_second = False diff --git a/libraries/botbuilder-core/tests/test_turn_context.py b/libraries/botbuilder-core/tests/test_turn_context.py index 8f4d3b6b6..473580ef0 100644 --- a/libraries/botbuilder-core/tests/test_turn_context.py +++ b/libraries/botbuilder-core/tests/test_turn_context.py @@ -35,7 +35,7 @@ async def send_activities(self, context, activities) -> List[ResourceResponse]: assert activities is not None assert isinstance(activities, list) assert activities - for (idx, activity) in enumerate(activities): # pylint: disable=unused-variable + for idx, activity in enumerate(activities): # pylint: disable=unused-variable assert isinstance(activity, Activity) assert activity.type == "message" or activity.type == ActivityTypes.trace responses.append(ResourceResponse(id="5678")) diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find.py index 4f37ce451..b3b3c6b99 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find.py @@ -101,7 +101,6 @@ def find_values( ) for entry in sorted_values: - # Find all matches for a value # - To match "last one" in "the last time I chose the last one" we need # to re-search the string starting from the end of the previous match. diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py index a0e2f04e8..1e0a6267c 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py @@ -65,7 +65,6 @@ async def on_dialog_event( # Trace unhandled "versionChanged" events. if not handled and dialog_event.name == DialogEvents.version_changed: - trace_message = ( f"Unhandled dialog event: {dialog_event.name}. Active Dialog: " f"{dialog_context.active_dialog.id}" diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_events.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_events.py index d3d0cb4a1..4de7ed990 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_events.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_events.py @@ -5,7 +5,6 @@ class DialogEvents(str, Enum): - begin_dialog = "beginDialog" reprompt_dialog = "repromptDialog" cancel_dialog = "cancelDialog" diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/dialog_state_manager.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/dialog_state_manager.py index c123f2cce..c1bf6c106 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/dialog_state_manager.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/dialog_state_manager.py @@ -36,7 +36,6 @@ # PathResolvers allow for shortcut behavior for mapping things like $foo -> dialog.foo. # class DialogStateManager: - SEPARATORS = [",", "["] def __init__( diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/at_path_resolver.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/at_path_resolver.py index 91bbb6564..0cc1ccc73 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/at_path_resolver.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/at_path_resolver.py @@ -5,7 +5,6 @@ class AtPathResolver(AliasPathResolver): - _DELIMITERS = [".", "["] def __init__(self): diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/class_memory_scope.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/class_memory_scope.py index 1589ac152..d5592e238 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/class_memory_scope.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/class_memory_scope.py @@ -41,7 +41,7 @@ def _bind_to_dialog_context(obj, dialog_context: "DialogContext") -> object: if hasattr(prop_value, "try_get_value"): clone[prop] = prop_value.try_get_value(dialog_context.state) elif hasattr(prop_value, "__dict__") and not isinstance( - prop_value, type + prop_value, type(prop_value) ): clone[prop] = ClassMemoryScope._bind_to_dialog_context( prop_value, dialog_context diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/waterfall_dialog.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/waterfall_dialog.py index 570b5b340..02dfbbbe3 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/waterfall_dialog.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/waterfall_dialog.py @@ -44,7 +44,6 @@ def add_step(self, step): async def begin_dialog( self, dialog_context: DialogContext, options: object = None ) -> DialogTurnResult: - if not dialog_context: raise TypeError("WaterfallDialog.begin_dialog(): dc cannot be None.") @@ -113,7 +112,6 @@ async def end_dialog( # pylint: disable=unused-argument self.telemetry_client.track_event("WaterfallCancel", properties) else: if reason is DialogReason.EndCalled: - instance_id = str(instance.state[self.PersistedInstanceId]) properties = {"DialogId": self.id, "InstanceId": instance_id} self.telemetry_client.track_event("WaterfallComplete", properties) diff --git a/libraries/botbuilder-dialogs/tests/test_confirm_prompt.py b/libraries/botbuilder-dialogs/tests/test_confirm_prompt.py index 132fef923..cedf5f03a 100644 --- a/libraries/botbuilder-dialogs/tests/test_confirm_prompt.py +++ b/libraries/botbuilder-dialogs/tests/test_confirm_prompt.py @@ -282,7 +282,6 @@ async def exec_test(turn_context: TurnContext): async def test_confirm_prompt_should_default_to_english_locale(self): async def exec_test(turn_context: TurnContext): - dialog_context = await dialogs.create_context(turn_context) results: DialogTurnResult = await dialog_context.continue_dialog() diff --git a/libraries/botbuilder-dialogs/tests/test_date_time_prompt.py b/libraries/botbuilder-dialogs/tests/test_date_time_prompt.py index f3ea4d950..765ef4c3c 100644 --- a/libraries/botbuilder-dialogs/tests/test_date_time_prompt.py +++ b/libraries/botbuilder-dialogs/tests/test_date_time_prompt.py @@ -32,7 +32,6 @@ async def exec_test(turn_context: TurnContext) -> None: results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: - options = PromptOptions(prompt=MessageFactory.text(prompt_msg)) await dialog_context.begin_dialog("DateTimePrompt", options) else: diff --git a/libraries/botbuilder-dialogs/tests/test_number_prompt.py b/libraries/botbuilder-dialogs/tests/test_number_prompt.py index 1b9510017..52fda0eac 100644 --- a/libraries/botbuilder-dialogs/tests/test_number_prompt.py +++ b/libraries/botbuilder-dialogs/tests/test_number_prompt.py @@ -180,7 +180,6 @@ async def test_number_uses_locale_specified_in_constructor(self): dialogs.add(number_prompt) async def exec_test(turn_context: TurnContext) -> None: - dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() diff --git a/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py b/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py index 7a1eaeba6..0c5fac1e7 100644 --- a/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py +++ b/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py @@ -76,7 +76,6 @@ async def callback_handler(turn_context: TurnContext): async def inspector( activity: Activity, description: str = None ): # pylint: disable=unused-argument - self.assertTrue(len(activity.attachments) == 1) self.assertTrue( activity.attachments[0].content_type @@ -184,7 +183,6 @@ async def exec_test(turn_context: TurnContext): results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: - # If magicCode is detected when prompting, this will end the dialog and return the token in tokenResult token_result = await dialog_context.prompt("prompt", PromptOptions()) if isinstance(token_result.result, TokenResponse): diff --git a/libraries/botbuilder-dialogs/tests/test_waterfall.py b/libraries/botbuilder-dialogs/tests/test_waterfall.py index c26f6ee01..1290cedc4 100644 --- a/libraries/botbuilder-dialogs/tests/test_waterfall.py +++ b/libraries/botbuilder-dialogs/tests/test_waterfall.py @@ -80,7 +80,6 @@ async def step2(step) -> DialogTurnResult: # Initialize TestAdapter async def exec_test(turn_context: TurnContext) -> None: - dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: diff --git a/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/skills/skill_http_client.py b/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/skills/skill_http_client.py index 6f3e2a215..542287af2 100644 --- a/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/skills/skill_http_client.py +++ b/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/skills/skill_http_client.py @@ -45,7 +45,6 @@ async def post_activity_to_skill( activity: Activity, originating_audience: str = None, ) -> InvokeResponse: - if originating_audience is None: originating_audience = ( GovernmentConstants.TO_CHANNEL_FROM_BOT_OAUTH_SCOPE diff --git a/libraries/botbuilder-integration-aiohttp/setup.py b/libraries/botbuilder-integration-aiohttp/setup.py index ddedc2e4e..7889c475f 100644 --- a/libraries/botbuilder-integration-aiohttp/setup.py +++ b/libraries/botbuilder-integration-aiohttp/setup.py @@ -9,7 +9,7 @@ "botbuilder-schema==4.15.0", "botframework-connector==4.15.0", "botbuilder-core==4.15.0", - "yarl<=1.4.2", + "yarl>=1.8.1", "aiohttp==3.8.4", ] diff --git a/libraries/botbuilder-schema/botbuilder/schema/__init__.py b/libraries/botbuilder-schema/botbuilder/schema/__init__.py index 082eb28e6..24d431b76 100644 --- a/libraries/botbuilder-schema/botbuilder/schema/__init__.py +++ b/libraries/botbuilder-schema/botbuilder/schema/__init__.py @@ -77,10 +77,6 @@ from .callerid_constants import CallerIdConstants from .speech_constants import SpeechConstants -warn( - "The Bot Framework Python SDK is being retired with final long-term support ending in November 2023, after which this repository will be archived. There will be no further feature development, with only critical security and bug fixes within this repository being undertaken. Existing bots built with this SDK will continue to function. For all new bot development we recommend that you adopt Power Virtual Agents." -) - __all__ = [ "Activity", "ActivityEventNames", diff --git a/libraries/botbuilder-schema/botbuilder/schema/_connector_client_enums.py b/libraries/botbuilder-schema/botbuilder/schema/_connector_client_enums.py index 2c1fbebcc..c32031efa 100644 --- a/libraries/botbuilder-schema/botbuilder/schema/_connector_client_enums.py +++ b/libraries/botbuilder-schema/botbuilder/schema/_connector_client_enums.py @@ -5,14 +5,12 @@ class RoleTypes(str, Enum): - user = "user" bot = "bot" skill = "skill" class ActivityTypes(str, Enum): - message = "message" contact_relation_update = "contactRelationUpdate" conversation_update = "conversationUpdate" @@ -34,33 +32,28 @@ class ActivityTypes(str, Enum): class TextFormatTypes(str, Enum): - markdown = "markdown" plain = "plain" xml = "xml" class AttachmentLayoutTypes(str, Enum): - list = "list" carousel = "carousel" class MessageReactionTypes(str, Enum): - like = "like" plus_one = "plusOne" class InputHints(str, Enum): - accepting_input = "acceptingInput" ignoring_input = "ignoringInput" expecting_input = "expectingInput" class ActionTypes(str, Enum): - open_url = "openUrl" im_back = "imBack" post_back = "postBack" @@ -74,7 +67,6 @@ class ActionTypes(str, Enum): class EndOfConversationCodes(str, Enum): - unknown = "unknown" completed_successfully = "completedSuccessfully" user_cancelled = "userCancelled" @@ -84,14 +76,12 @@ class EndOfConversationCodes(str, Enum): class ActivityImportance(str, Enum): - low = "low" normal = "normal" high = "high" class DeliveryModes(str, Enum): - normal = "normal" notification = "notification" expect_replies = "expectReplies" @@ -99,19 +89,16 @@ class DeliveryModes(str, Enum): class ContactRelationUpdateActionTypes(str, Enum): - add = "add" remove = "remove" class InstallationUpdateActionTypes(str, Enum): - add = "add" remove = "remove" class SemanticActionStates(str, Enum): - start_action = "start" continue_action = "continue" done_action = "done" diff --git a/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py b/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py index 43fc72e59..523204c0e 100644 --- a/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py +++ b/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py @@ -1565,7 +1565,6 @@ class ErrorResponseException(HttpOperationError): """ def __init__(self, deserialize, response, *args): - super(ErrorResponseException, self).__init__( deserialize, response, "ErrorResponse", *args ) diff --git a/libraries/botbuilder-schema/botbuilder/schema/_sign_in_enums.py b/libraries/botbuilder-schema/botbuilder/schema/_sign_in_enums.py index 015e5a733..3bc6f6b61 100644 --- a/libraries/botbuilder-schema/botbuilder/schema/_sign_in_enums.py +++ b/libraries/botbuilder-schema/botbuilder/schema/_sign_in_enums.py @@ -5,7 +5,6 @@ class SignInConstants(str, Enum): - # Name for the signin invoke to verify the 6-digit authentication code as part of sign-in. verify_state_operation_name = "signin/verifyState" # Name for signin invoke to perform a token exchange. diff --git a/libraries/botbuilder-schema/setup.py b/libraries/botbuilder-schema/setup.py index d977fd739..3f056bc72 100644 --- a/libraries/botbuilder-schema/setup.py +++ b/libraries/botbuilder-schema/setup.py @@ -6,8 +6,7 @@ NAME = "botbuilder-schema" VERSION = os.environ["packageVersion"] if "packageVersion" in os.environ else "4.15.0" -REQUIRES = ["msrest==0.6.*", - "urllib3<2.0.0"] +REQUIRES = ["msrest==0.6.*", "urllib3<2.0.0"] root = os.path.abspath(os.path.dirname(__file__)) diff --git a/libraries/botframework-connector/azure_bdist_wheel.py b/libraries/botframework-connector/azure_bdist_wheel.py index a0e0049b5..d33af36bd 100644 --- a/libraries/botframework-connector/azure_bdist_wheel.py +++ b/libraries/botframework-connector/azure_bdist_wheel.py @@ -75,7 +75,6 @@ def safer_version(version): class bdist_wheel(Command): - description = "create a wheel distribution" user_options = [ @@ -518,9 +517,9 @@ def skip(path): from distutils import log as logger import os.path + # from wheel.bdist_wheel import bdist_wheel class azure_bdist_wheel(bdist_wheel): - description = "Create an Azure wheel distribution" user_options = bdist_wheel.user_options + [ diff --git a/libraries/botframework-connector/botframework/connector/_configuration.py b/libraries/botframework-connector/botframework/connector/_configuration.py index ce9a8c1d7..5dde8f9f8 100644 --- a/libraries/botframework-connector/botframework/connector/_configuration.py +++ b/libraries/botframework-connector/botframework/connector/_configuration.py @@ -22,7 +22,6 @@ class ConnectorClientConfiguration(Configuration): """ def __init__(self, credentials, base_url=None): - if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") if not base_url: diff --git a/libraries/botframework-connector/botframework/connector/aio/operations_async/_attachments_operations_async.py b/libraries/botframework-connector/botframework/connector/aio/operations_async/_attachments_operations_async.py index 1bb926cfa..7694e1e6a 100644 --- a/libraries/botframework-connector/botframework/connector/aio/operations_async/_attachments_operations_async.py +++ b/libraries/botframework-connector/botframework/connector/aio/operations_async/_attachments_operations_async.py @@ -26,7 +26,6 @@ class AttachmentsOperations: models = models def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/aio/operations_async/_conversations_operations_async.py b/libraries/botframework-connector/botframework/connector/aio/operations_async/_conversations_operations_async.py index a982ec673..e6416e42d 100644 --- a/libraries/botframework-connector/botframework/connector/aio/operations_async/_conversations_operations_async.py +++ b/libraries/botframework-connector/botframework/connector/aio/operations_async/_conversations_operations_async.py @@ -27,7 +27,6 @@ class ConversationsOperations: models = models def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/async_mixin/async_mixin.py b/libraries/botframework-connector/botframework/connector/async_mixin/async_mixin.py index c8a913df0..314642542 100644 --- a/libraries/botframework-connector/botframework/connector/async_mixin/async_mixin.py +++ b/libraries/botframework-connector/botframework/connector/async_mixin/async_mixin.py @@ -85,7 +85,6 @@ async def async_send(self, request, headers=None, content=None, **config): response = None try: - try: future = loop.run_in_executor( None, diff --git a/libraries/botframework-connector/botframework/connector/auth/authentication_constants.py b/libraries/botframework-connector/botframework/connector/auth/authentication_constants.py index 8a10a2bcd..6cda3226f 100644 --- a/libraries/botframework-connector/botframework/connector/auth/authentication_constants.py +++ b/libraries/botframework-connector/botframework/connector/auth/authentication_constants.py @@ -5,7 +5,6 @@ class AuthenticationConstants(ABC): - # TO CHANNEL FROM BOT: Login URL # # DEPRECATED: DO NOT USE diff --git a/libraries/botframework-connector/botframework/connector/auth/enterprise_channel_validation.py b/libraries/botframework-connector/botframework/connector/auth/enterprise_channel_validation.py index 7abd054a5..0e6354e7c 100644 --- a/libraries/botframework-connector/botframework/connector/auth/enterprise_channel_validation.py +++ b/libraries/botframework-connector/botframework/connector/auth/enterprise_channel_validation.py @@ -15,7 +15,6 @@ class EnterpriseChannelValidation(ABC): - TO_BOT_FROM_ENTERPRISE_CHANNEL_TOKEN_VALIDATION_PARAMETERS = VerifyOptions( issuer=[AuthenticationConstants.TO_BOT_FROM_CHANNEL_TOKEN_ISSUER], audience=None, diff --git a/libraries/botframework-connector/botframework/connector/auth/government_channel_validation.py b/libraries/botframework-connector/botframework/connector/auth/government_channel_validation.py index 5d7868b71..c7438865e 100644 --- a/libraries/botframework-connector/botframework/connector/auth/government_channel_validation.py +++ b/libraries/botframework-connector/botframework/connector/auth/government_channel_validation.py @@ -13,7 +13,6 @@ class GovernmentChannelValidation(ABC): - OPEN_ID_METADATA_ENDPOINT = "" TO_BOT_FROM_GOVERNMENT_CHANNEL_TOKEN_VALIDATION_PARAMETERS = VerifyOptions( diff --git a/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py b/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py index e83d6ccf6..e4cbddd39 100644 --- a/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py +++ b/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py @@ -21,7 +21,6 @@ class JwtTokenValidation: - # TODO remove the default value on channel_service @staticmethod async def authenticate_request( diff --git a/libraries/botframework-connector/botframework/connector/connector_client.py b/libraries/botframework-connector/botframework/connector/connector_client.py index db503016d..1a0c2947c 100644 --- a/libraries/botframework-connector/botframework/connector/connector_client.py +++ b/libraries/botframework-connector/botframework/connector/connector_client.py @@ -46,7 +46,6 @@ class ConnectorClient(SDKClient): """ def __init__(self, credentials, base_url=None): - self.config = ConnectorClientConfiguration(credentials, base_url) super(ConnectorClient, self).__init__(self.config.credentials, self.config) diff --git a/libraries/botframework-connector/botframework/connector/operations/_attachments_operations.py b/libraries/botframework-connector/botframework/connector/operations/_attachments_operations.py index d7d6287eb..1f3b2f7c3 100644 --- a/libraries/botframework-connector/botframework/connector/operations/_attachments_operations.py +++ b/libraries/botframework-connector/botframework/connector/operations/_attachments_operations.py @@ -26,7 +26,6 @@ class AttachmentsOperations: models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/operations/_conversations_operations.py b/libraries/botframework-connector/botframework/connector/operations/_conversations_operations.py index a4c37f6f4..6834f7a28 100644 --- a/libraries/botframework-connector/botframework/connector/operations/_conversations_operations.py +++ b/libraries/botframework-connector/botframework/connector/operations/_conversations_operations.py @@ -27,7 +27,6 @@ class ConversationsOperations: models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/teams/operations/teams_operations.py b/libraries/botframework-connector/botframework/connector/teams/operations/teams_operations.py index 994a5c705..ff1bdb18c 100644 --- a/libraries/botframework-connector/botframework/connector/teams/operations/teams_operations.py +++ b/libraries/botframework-connector/botframework/connector/teams/operations/teams_operations.py @@ -23,7 +23,6 @@ class TeamsOperations(object): models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/teams/teams_connector_client.py b/libraries/botframework-connector/botframework/connector/teams/teams_connector_client.py index 73c3fec66..5e071b091 100644 --- a/libraries/botframework-connector/botframework/connector/teams/teams_connector_client.py +++ b/libraries/botframework-connector/botframework/connector/teams/teams_connector_client.py @@ -24,7 +24,6 @@ class TeamsConnectorClientConfiguration(Configuration): """ def __init__(self, credentials, base_url=None): - if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") if not base_url: @@ -63,7 +62,6 @@ class TeamsConnectorClient(SDKClient): """ def __init__(self, credentials, base_url=None): - self.config = TeamsConnectorClientConfiguration(credentials, base_url) super(TeamsConnectorClient, self).__init__(self.config.credentials, self.config) diff --git a/libraries/botframework-connector/botframework/connector/token_api/_configuration.py b/libraries/botframework-connector/botframework/connector/token_api/_configuration.py index dd94bf968..28550431e 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/_configuration.py +++ b/libraries/botframework-connector/botframework/connector/token_api/_configuration.py @@ -22,7 +22,6 @@ class TokenApiClientConfiguration(Configuration): """ def __init__(self, credentials, base_url=None): - if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") if not base_url: diff --git a/libraries/botframework-connector/botframework/connector/token_api/_token_api_client.py b/libraries/botframework-connector/botframework/connector/token_api/_token_api_client.py index dbb6a52fe..3aafe6800 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/_token_api_client.py +++ b/libraries/botframework-connector/botframework/connector/token_api/_token_api_client.py @@ -32,7 +32,6 @@ class TokenApiClient(SDKClient): """ def __init__(self, credentials, base_url=None): - self.config = TokenApiClientConfiguration(credentials, base_url) super(TokenApiClient, self).__init__(self.config.credentials, self.config) diff --git a/libraries/botframework-connector/botframework/connector/token_api/aio/_token_api_client_async.py b/libraries/botframework-connector/botframework/connector/token_api/aio/_token_api_client_async.py index 513cb62be..bd6e70305 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/aio/_token_api_client_async.py +++ b/libraries/botframework-connector/botframework/connector/token_api/aio/_token_api_client_async.py @@ -32,7 +32,6 @@ class TokenApiClient(SDKClientAsync): """ def __init__(self, credentials, base_url=None): - self.config = TokenApiClientConfiguration(credentials, base_url) super(TokenApiClient, self).__init__(self.config) diff --git a/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_bot_sign_in_operations_async.py b/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_bot_sign_in_operations_async.py index 385f14466..bd5eb294b 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_bot_sign_in_operations_async.py +++ b/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_bot_sign_in_operations_async.py @@ -27,7 +27,6 @@ class BotSignInOperations: models = models def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_user_token_operations_async.py b/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_user_token_operations_async.py index 5ac397d66..f18b84d7f 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_user_token_operations_async.py +++ b/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_user_token_operations_async.py @@ -26,7 +26,6 @@ class UserTokenOperations: models = models def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/token_api/models/_models.py b/libraries/botframework-connector/botframework/connector/token_api/models/_models.py index 63c1eedae..5f69104cd 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/models/_models.py +++ b/libraries/botframework-connector/botframework/connector/token_api/models/_models.py @@ -71,7 +71,6 @@ class ErrorResponseException(HttpOperationError): """ def __init__(self, deserialize, response, *args): - super(ErrorResponseException, self).__init__( deserialize, response, "ErrorResponse", *args ) diff --git a/libraries/botframework-connector/botframework/connector/token_api/models/_models_py3.py b/libraries/botframework-connector/botframework/connector/token_api/models/_models_py3.py index 271c532dc..60ab62c92 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/models/_models_py3.py +++ b/libraries/botframework-connector/botframework/connector/token_api/models/_models_py3.py @@ -73,7 +73,6 @@ class ErrorResponseException(HttpOperationError): """ def __init__(self, deserialize, response, *args): - super(ErrorResponseException, self).__init__( deserialize, response, "ErrorResponse", *args ) diff --git a/libraries/botframework-connector/botframework/connector/token_api/operations/_bot_sign_in_operations.py b/libraries/botframework-connector/botframework/connector/token_api/operations/_bot_sign_in_operations.py index 83f128b15..7758e4067 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/operations/_bot_sign_in_operations.py +++ b/libraries/botframework-connector/botframework/connector/token_api/operations/_bot_sign_in_operations.py @@ -27,7 +27,6 @@ class BotSignInOperations: models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/botframework/connector/token_api/operations/_user_token_operations.py b/libraries/botframework-connector/botframework/connector/token_api/operations/_user_token_operations.py index f63952571..f8b43edb6 100644 --- a/libraries/botframework-connector/botframework/connector/token_api/operations/_user_token_operations.py +++ b/libraries/botframework-connector/botframework/connector/token_api/operations/_user_token_operations.py @@ -26,7 +26,6 @@ class UserTokenOperations: models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer diff --git a/libraries/botframework-connector/tests/requirements.txt b/libraries/botframework-connector/tests/requirements.txt index a376f63cf..62eb5aba5 100644 --- a/libraries/botframework-connector/tests/requirements.txt +++ b/libraries/botframework-connector/tests/requirements.txt @@ -1,6 +1,5 @@ pytest-cov>=2.6.0 pytest~=6.2.3 -pyyaml==5.4 -azure-devtools>=0.4.1 +pyyaml==6.0 pytest-asyncio==0.15.1 ddt==1.2.1 \ No newline at end of file diff --git a/libraries/botframework-connector/tests/test_attachments.py b/libraries/botframework-connector/tests/test_attachments.py index d1706d2b3..bd280c840 100644 --- a/libraries/botframework-connector/tests/test_attachments.py +++ b/libraries/botframework-connector/tests/test_attachments.py @@ -5,7 +5,6 @@ import base64 import asyncio import pytest -from azure_devtools.scenario_tests import ReplayableTest import msrest from botbuilder.schema import AttachmentData, ErrorResponseException @@ -51,9 +50,9 @@ def read_base64(path_to_file): AUTH_TOKEN = LOOP.run_until_complete(get_auth_token()) -class AttachmentsTest(ReplayableTest): - def __init__(self, method_name): # pylint: disable=useless-super-delegation - super(AttachmentsTest, self).__init__(method_name) +class AttachmentsTest: + def __init__(self): # pylint: disable=useless-super-delegation + super(AttachmentsTest, self).__init__() @property def credentials(self): diff --git a/libraries/botframework-connector/tests/test_attachments_async.py b/libraries/botframework-connector/tests/test_attachments_async.py index b60494146..c0f7c9458 100644 --- a/libraries/botframework-connector/tests/test_attachments_async.py +++ b/libraries/botframework-connector/tests/test_attachments_async.py @@ -5,7 +5,6 @@ import base64 import asyncio import pytest -from azure_devtools.scenario_tests import ReplayableTest import msrest from botbuilder.schema import AttachmentData, ErrorResponseException @@ -58,9 +57,9 @@ async def return_sum(attachment_stream): AUTH_TOKEN = LOOP.run_until_complete(get_auth_token()) -class AttachmentsTest(ReplayableTest): - def __init__(self, method_name): - super(AttachmentsTest, self).__init__(method_name) +class AttachmentsTest: + def __init__(self): + super(AttachmentsTest, self).__init__() self.loop = asyncio.get_event_loop() @property diff --git a/libraries/botframework-connector/tests/test_conversations.py b/libraries/botframework-connector/tests/test_conversations.py index badd636d7..c64926643 100644 --- a/libraries/botframework-connector/tests/test_conversations.py +++ b/libraries/botframework-connector/tests/test_conversations.py @@ -3,7 +3,6 @@ import asyncio import pytest -from azure_devtools.scenario_tests import ReplayableTest from botbuilder.schema import ( Activity, @@ -48,9 +47,9 @@ async def get_auth_token(): AUTH_TOKEN = LOOP.run_until_complete(get_auth_token()) -class ConversationTest(ReplayableTest): - def __init__(self, method_name): # pylint: disable=useless-super-delegation - super(ConversationTest, self).__init__(method_name) +class ConversationTest: + def __init__(self): # pylint: disable=useless-super-delegation + super(ConversationTest, self).__init__() @property def credentials(self): diff --git a/libraries/botframework-connector/tests/test_conversations_async.py b/libraries/botframework-connector/tests/test_conversations_async.py index a6ad2242b..074247c82 100644 --- a/libraries/botframework-connector/tests/test_conversations_async.py +++ b/libraries/botframework-connector/tests/test_conversations_async.py @@ -3,7 +3,6 @@ import asyncio import pytest -from azure_devtools.scenario_tests import ReplayableTest from botbuilder.schema import ( Activity, @@ -48,9 +47,9 @@ async def get_auth_token(): AUTH_TOKEN = LOOP.run_until_complete(get_auth_token()) -class TestAsyncConversation(ReplayableTest): - def __init__(self, method_name): - super(TestAsyncConversation, self).__init__(method_name) +class TestAsyncConversation: + def __init__(self): + super(TestAsyncConversation, self).__init__() self.loop = asyncio.get_event_loop() self.credentials = MicrosoftTokenAuthenticationStub(AUTH_TOKEN) diff --git a/libraries/botframework-streaming/botframework/streaming/payload_transport/send_queue.py b/libraries/botframework-streaming/botframework/streaming/payload_transport/send_queue.py index d337d911a..1f52bee44 100644 --- a/libraries/botframework-streaming/botframework/streaming/payload_transport/send_queue.py +++ b/libraries/botframework-streaming/botframework/streaming/payload_transport/send_queue.py @@ -37,3 +37,4 @@ async def _process(self): except Exception: # AppInsights.TrackException(e) traceback.print_exc() + return diff --git a/libraries/botframework-streaming/botframework/streaming/payloads/header_serializer.py b/libraries/botframework-streaming/botframework/streaming/payloads/header_serializer.py index b0b507ab2..53a1d8fc3 100644 --- a/libraries/botframework-streaming/botframework/streaming/payloads/header_serializer.py +++ b/libraries/botframework-streaming/botframework/streaming/payloads/header_serializer.py @@ -34,7 +34,6 @@ def serialize( buffer: List[int], offset: int, # pylint: disable=unused-argument ) -> int: - # write type buffer[HeaderSerializer.TYPE_OFFSET] = HeaderSerializer._char_to_binary_int( header.type diff --git a/libraries/functional-tests/functionaltestbot/functionaltestbot/app.py b/libraries/functional-tests/functionaltestbot/functionaltestbot/app.py index 071a17d2b..fc975093a 100644 --- a/libraries/functional-tests/functionaltestbot/functionaltestbot/app.py +++ b/libraries/functional-tests/functionaltestbot/functionaltestbot/app.py @@ -25,6 +25,7 @@ SETTINGS = BotFrameworkAdapterSettings(APP.config["APP_ID"], APP.config["APP_PASSWORD"]) ADAPTER = BotFrameworkAdapter(SETTINGS) + # Catch-all for errors. # pylint: disable=unused-argument async def on_error(self, context: TurnContext, error: Exception): @@ -46,6 +47,7 @@ async def on_error(self, context: TurnContext, error: Exception): # Create the main dialog BOT = MyBot() + # Listen for incoming requests on GET / for Azure monitoring @APP.route("/", methods=["GET"]) def ping(): diff --git a/pipelines/botbuilder-python-ci.yml b/pipelines/botbuilder-python-ci.yml index 61de37a83..04a848e1f 100644 --- a/pipelines/botbuilder-python-ci.yml +++ b/pipelines/botbuilder-python-ci.yml @@ -8,6 +8,7 @@ variables: COVERALLS_SERVICE_NAME: python-ci python.37: 3.7.x python.38: 3.8.x + # python.311: 3.11.x # PythonCoverallsToken: get this from Azure jobs: @@ -23,6 +24,8 @@ jobs: PYTHON_VERSION: '$(python.37)' Python38: PYTHON_VERSION: '$(python.38)' + # Python311: + # PYTHON_VERSION: '$(python.311)' maxParallel: 3 steps: