diff --git a/generators/app/templates/core/{{cookiecutter.bot_name}}/booking_details.py b/generators/app/templates/core/{{cookiecutter.bot_name}}/booking_details.py index 53364aabc..f3035f1f7 100644 --- a/generators/app/templates/core/{{cookiecutter.bot_name}}/booking_details.py +++ b/generators/app/templates/core/{{cookiecutter.bot_name}}/booking_details.py @@ -1,15 +1,15 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import List +from typing import List, Union class BookingDetails: def __init__( self, - destination: str = None, - origin: str = None, - travel_date: str = None, + destination: Union[str, None] = None, + origin: Union[str, None] = None, + travel_date: Union[str, None] = None, unsupported_airports: List[str] = None, ): self.destination = destination diff --git a/generators/app/templates/core/{{cookiecutter.bot_name}}/dialogs/date_resolver_dialog.py b/generators/app/templates/core/{{cookiecutter.bot_name}}/dialogs/date_resolver_dialog.py index c6b163f8c..2c27b9e71 100644 --- a/generators/app/templates/core/{{cookiecutter.bot_name}}/dialogs/date_resolver_dialog.py +++ b/generators/app/templates/core/{{cookiecutter.bot_name}}/dialogs/date_resolver_dialog.py @@ -1,6 +1,8 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union + from botbuilder.core import MessageFactory from botbuilder.dialogs import WaterfallDialog, DialogTurnResult, WaterfallStepContext from botbuilder.dialogs.prompts import ( @@ -16,7 +18,7 @@ class DateResolverDialog(CancelAndHelpDialog): - def __init__(self, dialog_id: str = None): + def __init__(self, dialog_id: Union[str, None] = None): super(DateResolverDialog, self).__init__( dialog_id or DateResolverDialog.__name__ ) diff --git a/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_adapter.py b/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_adapter.py index 26fc80b41..b1a795d82 100644 --- a/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_adapter.py +++ b/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_adapter.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from abc import ABC -from typing import List, Callable, Awaitable +from typing import List, Callable, Awaitable, Union from aiohttp.web_request import Request from aiohttp.web_response import Response @@ -143,9 +143,9 @@ async def continue_conversation( self, reference: ConversationReference, callback: Callable, - bot_id: str = None, # pylint: disable=unused-argument + bot_id: Union[str, None] = None, # pylint: disable=unused-argument claims_identity: ClaimsIdentity = None, - audience: str = None, # pylint: disable=unused-argument + audience: Union[str, None] = None, # pylint: disable=unused-argument ): """ Send a proactive message to a conversation. diff --git a/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_client.py b/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_client.py index dd19e9b2a..8324c5ed1 100644 --- a/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_client.py +++ b/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_client.py @@ -86,10 +86,10 @@ async def users_counts(self) -> SlackResponse: async def im_history_ex( self, channel: str, - latest_timestamp: str = None, - oldest_timestamp: str = None, - count: int = None, - unreads: bool = None, + latest_timestamp: Union[str, None] = None, + oldest_timestamp: Union[str, None] = None, + count: Union[int, None] = None, + unreads: Union[bool, None] = None, ) -> SlackResponse: args = {} if latest_timestamp: @@ -104,18 +104,18 @@ async def im_history_ex( return await self.im_history(channel=channel, **args) async def files_info_ex( - self, file_id: str, page: int = None, count: int = None + self, file_id: str, page: Union[int, None] = None, count: Union[int, None] = None ) -> SlackResponse: args = {"count": str(count), "page": str(page)} return await self.files_info(file=file_id, **args) async def files_list_ex( self, - user_id: str = None, - date_from: str = None, - date_to: str = None, - count: int = None, - page: int = None, + user_id: Union[str, None] = None, + date_from: Union[str, None] = None, + date_to: Union[str, None] = None, + count: Union[int, None] = None, + page: Union[int, None] = None, types: List[str] = None, ) -> SlackResponse: args = {} @@ -139,7 +139,7 @@ async def files_list_ex( return await self.files_list(**args) async def groups_history_ex( - self, channel: str, latest: str = None, oldest: str = None, count: int = None + self, channel: str, latest: Union[str, None] = None, oldest: Union[str, None] = None, count: Union[int, None] = None ) -> SlackResponse: args = {} @@ -161,7 +161,7 @@ async def get_preferences(self) -> SlackResponse: return await self.api_call("users.prefs.get", http_verb="GET") async def stars_list_ex( - self, user: str = None, count: int = None, page: int = None + self, user: Union[str, None] = None, count: Union[int, None] = None, page: Union[int, None] = None ) -> SlackResponse: args = {} @@ -183,7 +183,7 @@ async def chat_post_ephemeral_ex( channel: str, text: str, target_user: str, - parse: str = None, + parse: Union[str, None] = None, link_names: bool = False, attachments: List[str] = None, # pylint: disable=unused-argument as_user: bool = False, @@ -207,14 +207,14 @@ async def chat_post_message_ex( self, channel: str, text: str, - bot_name: str = None, - parse: str = None, + bot_name: Union[str, None] = None, + parse: Union[str, None] = None, link_names: bool = False, blocks: List[str] = None, # pylint: disable=unused-argument attachments: List[str] = None, # pylint: disable=unused-argument unfurl_links: bool = False, - icon_url: str = None, - icon_emoji: str = None, + icon_url: Union[str, None] = None, + icon_emoji: Union[str, None] = None, as_user: bool = False, ) -> SlackResponse: args = { @@ -248,11 +248,11 @@ async def chat_post_message_ex( async def search_all_ex( self, query: str, - sorting: str = None, - direction: str = None, + sorting: Union[str, None] = None, + direction: Union[str, None] = None, enable_highlights: bool = False, - count: int = None, - page: int = None, + count: Union[int, None] = None, + page: Union[int, None] = None, ) -> SlackResponse: args = {"highlight": "1" if enable_highlights else "0"} @@ -273,11 +273,11 @@ async def search_all_ex( async def search_files_ex( self, query: str, - sorting: str = None, - direction: str = None, + sorting: Union[str, None] = None, + direction: Union[str, None] = None, enable_highlights: bool = False, - count: int = None, - page: int = None, + count: Union[int, None] = None, + page: Union[int, None] = None, ) -> SlackResponse: args = {"highlight": "1" if enable_highlights else "0"} @@ -298,11 +298,11 @@ async def search_files_ex( async def search_messages_ex( self, query: str, - sorting: str = None, - direction: str = None, + sorting: Union[str, None] = None, + direction: Union[str, None] = None, enable_highlights: bool = False, - count: int = None, - page: int = None, + count: Union[int, None] = None, + page: Union[int, None] = None, ) -> SlackResponse: args = {"highlight": "1" if enable_highlights else "0"} @@ -325,8 +325,8 @@ async def chat_update_ex( timestamp: str, channel: str, text: str, - bot_name: str = None, - parse: str = None, + bot_name: Union[str, None] = None, + parse: Union[str, None] = None, link_names: bool = False, attachments: List[str] = None, # pylint: disable=unused-argument as_user: bool = False, @@ -352,11 +352,11 @@ async def chat_update_ex( async def files_upload_ex( self, file: Union[str, IOBase] = None, - content: str = None, + content: Union[str, None] = None, channels: List[str] = None, - title: str = None, - initial_comment: str = None, - file_type: str = None, + title: Union[str, None] = None, + initial_comment: Union[str, None] = None, + file_type: Union[str, None] = None, ): args = {} diff --git a/libraries/botbuilder-ai/botbuilder/ai/qna/qna_dialog_response_options.py b/libraries/botbuilder-ai/botbuilder/ai/qna/qna_dialog_response_options.py index 5490f7727..9c2272bae 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/qna/qna_dialog_response_options.py +++ b/libraries/botbuilder-ai/botbuilder/ai/qna/qna_dialog_response_options.py @@ -1,14 +1,16 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union + from botbuilder.schema import Activity class QnADialogResponseOptions: def __init__( self, - active_learning_card_title: str = None, - card_no_match_text: str = None, + active_learning_card_title: Union[str, None] = None, + card_no_match_text: Union[str, None] = None, no_answer: Activity = None, card_no_match_response: Activity = None, ): diff --git a/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py b/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py index 39b1eac3a..156b80657 100644 --- a/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py +++ b/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py @@ -3,7 +3,7 @@ """Application Insights Telemetry Client for Bots.""" import traceback -from typing import Dict, Callable +from typing import Dict, Callable, Union from applicationinsights import TelemetryClient # pylint: disable=no-name-in-module from botbuilder.core.bot_telemetry_client import ( @@ -38,7 +38,7 @@ def __init__( instrumentation_key: str, telemetry_client: TelemetryClient = None, telemetry_processor: Callable[[object, object], bool] = None, - client_queue_size: int = None, + client_queue_size: Union[int, None] = None, ): self._instrumentation_key = instrumentation_key @@ -131,7 +131,7 @@ def track_metric( name: str, value: float, tel_type: TelemetryDataPointType = None, - count: int = None, + count: Union[int, None] = None, min_val: float = None, max_val: float = None, std_dev: float = None, @@ -182,13 +182,13 @@ def track_request( name: str, url: str, success: bool, - start_time: str = None, - duration: int = None, - response_code: str = None, - http_method: str = None, + start_time: Union[str, None] = None, + duration: Union[int, None] = None, + response_code: Union[str, None] = None, + http_method: Union[str, None] = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, - request_id: str = None, + request_id: Union[str, None] = None, ): """ Sends a single request that was captured for the application. @@ -233,14 +233,14 @@ def track_dependency( self, name: str, data: str, - type_name: str = None, - target: str = None, - duration: int = None, - success: bool = None, - result_code: str = None, + type_name: Union[str, None] = None, + target: Union[str, None] = None, + duration: Union[int, None] = None, + success: Union[bool, None] = None, + result_code: Union[str, None] = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, - dependency_id: str = None, + dependency_id: Union[str, None] = None, ): """ Sends a single dependency telemetry that was captured for the application. diff --git a/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py b/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py index cfe66f8d8..de007596d 100644 --- a/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py +++ b/libraries/botbuilder-azure/botbuilder/azure/cosmosdb_partitioned_storage.py @@ -3,7 +3,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Dict, List +from typing import Dict, List, Union from threading import Lock import json from hashlib import sha256 @@ -21,10 +21,10 @@ class CosmosDbPartitionedConfig: def __init__( self, - cosmos_db_endpoint: str = None, - auth_key: str = None, - database_id: str = None, - container_id: str = None, + cosmos_db_endpoint: Union[str, None] = None, + auth_key: Union[str, None] = None, + database_id: Union[str, None] = None, + container_id: Union[str, None] = None, cosmos_client_options: dict = None, container_throughput: int = 400, key_suffix: str = "", diff --git a/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py b/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py index ebfeb303a..333f9e253 100644 --- a/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py +++ b/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py @@ -37,10 +37,10 @@ class UserToken: def __init__( self, - connection_name: str = None, - user_id: str = None, - channel_id: str = None, - token: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, + channel_id: Union[str, None] = None, + token: Union[str, None] = None, ): self.connection_name = connection_name self.user_id = user_id @@ -59,11 +59,11 @@ def equals_key(self, rhs: "UserToken"): class ExchangeableToken(UserToken): def __init__( self, - connection_name: str = None, - user_id: str = None, - channel_id: str = None, - token: str = None, - exchangeable_item: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, + channel_id: Union[str, None] = None, + token: Union[str, None] = None, + exchangeable_item: Union[str, None] = None, ): super(ExchangeableToken, self).__init__( connection_name=connection_name, @@ -86,7 +86,7 @@ def to_key(self) -> str: class TokenMagicCode: - def __init__(self, key: UserToken = None, magic_code: str = None): + def __init__(self, key: UserToken = None, magic_code: Union[str, None] = None): self.key = key self.magic_code = magic_code @@ -204,9 +204,9 @@ async def continue_conversation( self, reference: ConversationReference, callback: Callable, - bot_id: str = None, + bot_id: Union[str, None] = None, claims_identity: ClaimsIdentity = None, # pylint: disable=unused-argument - audience: str = None, + audience: Union[str, None] = None, ): """ The `TestAdapter` just calls parent implementation. @@ -334,7 +334,7 @@ def add_user_token( channel_id: str, user_id: str, token: str, - magic_code: str = None, + magic_code: Union[str, None] = None, ): key = UserToken() key.channel_id = channel_id @@ -354,7 +354,7 @@ async def get_user_token( self, context: TurnContext, connection_name: str, - magic_code: str = None, + magic_code: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, # pylint: disable=unused-argument ) -> TokenResponse: key = UserToken() @@ -393,8 +393,8 @@ async def get_user_token( async def sign_out_user( self, context: TurnContext, - connection_name: str = None, - user_id: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, # pylint: disable=unused-argument ): channel_id = context.activity.channel_id @@ -414,7 +414,7 @@ async def get_oauth_sign_in_link( self, context: TurnContext, connection_name: str, - final_redirect: str = None, # pylint: disable=unused-argument + final_redirect: Union[str, None] = None, # pylint: disable=unused-argument oauth_app_credentials: AppCredentials = None, # pylint: disable=unused-argument ) -> str: return ( @@ -425,9 +425,9 @@ async def get_oauth_sign_in_link( async def get_token_status( self, context: TurnContext, - connection_name: str = None, - user_id: str = None, - include_filter: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, + include_filter: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> Dict[str, TokenResponse]: return None @@ -437,7 +437,7 @@ async def get_aad_tokens( context: TurnContext, connection_name: str, resource_urls: List[str], - user_id: str = None, # pylint: disable=unused-argument + user_id: Union[str, None] = None, # pylint: disable=unused-argument oauth_app_credentials: AppCredentials = None, # pylint: disable=unused-argument ) -> Dict[str, TokenResponse]: return None @@ -481,7 +481,7 @@ async def get_sign_in_resource_from_user( turn_context: TurnContext, connection_name: str, user_id: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, ) -> SignInUrlResponse: return await self.get_sign_in_resource_from_user_and_credentials( turn_context, None, connection_name, user_id, final_redirect @@ -493,7 +493,7 @@ async def get_sign_in_resource_from_user_and_credentials( oauth_app_credentials: AppCredentials, connection_name: str, user_id: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, ) -> SignInUrlResponse: return SignInUrlResponse( sign_in_link=f"https://fake.com/oauthsignin/{connection_name}/{turn_context.activity.channel_id}/{user_id}", diff --git a/libraries/botbuilder-core/botbuilder/core/bot_adapter.py b/libraries/botbuilder-core/botbuilder/core/bot_adapter.py index 5ab04eafb..16431d3ff 100644 --- a/libraries/botbuilder-core/botbuilder/core/bot_adapter.py +++ b/libraries/botbuilder-core/botbuilder/core/bot_adapter.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from abc import ABC, abstractmethod -from typing import List, Callable, Awaitable +from typing import List, Callable, Awaitable, Union from botbuilder.schema import ( Activity, ConversationReference, @@ -87,9 +87,9 @@ async def continue_conversation( self, reference: ConversationReference, callback: Callable, - bot_id: str = None, # pylint: disable=unused-argument + bot_id: Union[str, None] = None, # pylint: disable=unused-argument claims_identity: ClaimsIdentity = None, # pylint: disable=unused-argument - audience: str = None, # pylint: disable=unused-argument + audience: Union[str, None] = None, # pylint: disable=unused-argument ): """ Sends a proactive message to a conversation. Call this method to proactively send a message to a conversation. @@ -118,8 +118,8 @@ async def create_conversation( reference: ConversationReference, logic: Callable[[TurnContext], Awaitable] = None, conversation_parameters: ConversationParameters = None, - channel_id: str = None, - service_url: str = None, + channel_id: Union[str, None] = None, + service_url: Union[str, None] = None, credentials: AppCredentials = None, ): """ diff --git a/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py b/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py index 601693fd3..c49338c7f 100644 --- a/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py +++ b/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py @@ -94,11 +94,11 @@ class TokenExchangeState(Model): def __init__( self, *, - connection_name: str = None, + connection_name: Union[str, None] = None, conversation=None, relates_to=None, - bot_url: str = None, - ms_app_id: str = None, + bot_url: Union[str, None] = None, + ms_app_id: Union[str, None] = None, **kwargs, ) -> None: super(TokenExchangeState, self).__init__(**kwargs) @@ -113,10 +113,10 @@ class BotFrameworkAdapterSettings: def __init__( self, app_id: str, - app_password: str = None, - channel_auth_tenant: str = None, - oauth_endpoint: str = None, - open_id_metadata: str = None, + app_password: Union[str, None] = None, + channel_auth_tenant: Union[str, None] = None, + oauth_endpoint: Union[str, None] = None, + open_id_metadata: Union[str, None] = None, channel_provider: ChannelProvider = None, auth_configuration: AuthenticationConfiguration = None, app_credentials: AppCredentials = None, @@ -221,9 +221,9 @@ async def continue_conversation( self, reference: ConversationReference, callback: Callable, - bot_id: str = None, + bot_id: Union[str, None] = None, claims_identity: ClaimsIdentity = None, - audience: str = None, + audience: Union[str, None] = None, ): """ Continues a conversation with a user. @@ -291,8 +291,8 @@ async def create_conversation( reference: ConversationReference, logic: Callable[[TurnContext], Awaitable] = None, conversation_parameters: ConversationParameters = None, - channel_id: str = None, - service_url: str = None, + channel_id: Union[str, None] = None, + service_url: Union[str, None] = None, credentials: AppCredentials = None, ): """ @@ -870,7 +870,7 @@ async def get_conversations( self, service_url: str, credentials: AppCredentials, - continuation_token: str = None, + continuation_token: Union[str, None] = None, ): """ Lists the Conversations in which this bot has participated for a given channel server. @@ -900,7 +900,7 @@ async def get_user_token( self, context: TurnContext, connection_name: str, - magic_code: str = None, + magic_code: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, # pylint: disable=unused-argument ) -> TokenResponse: """ @@ -951,8 +951,8 @@ async def get_user_token( async def sign_out_user( self, context: TurnContext, - connection_name: str = None, # pylint: disable=unused-argument - user_id: str = None, + connection_name: Union[str, None] = None, # pylint: disable=unused-argument + user_id: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ): """ @@ -983,7 +983,7 @@ async def get_oauth_sign_in_link( self, context: TurnContext, connection_name: str, - final_redirect: str = None, # pylint: disable=unused-argument + final_redirect: Union[str, None] = None, # pylint: disable=unused-argument oauth_app_credentials: AppCredentials = None, ) -> str: """ @@ -1019,9 +1019,9 @@ async def get_oauth_sign_in_link( async def get_token_status( self, context: TurnContext, - connection_name: str = None, - user_id: str = None, - include_filter: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, + include_filter: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> List[TokenStatus]: """ @@ -1061,7 +1061,7 @@ async def get_aad_tokens( context: TurnContext, connection_name: str, resource_urls: List[str], - user_id: str = None, # pylint: disable=unused-argument + user_id: Union[str, None] = None, # pylint: disable=unused-argument oauth_app_credentials: AppCredentials = None, ) -> Dict[str, TokenResponse]: """ @@ -1096,7 +1096,7 @@ async def get_aad_tokens( ) async def create_connector_client( - self, service_url: str, identity: ClaimsIdentity = None, audience: str = None + self, service_url: str, identity: ClaimsIdentity = None, audience: Union[str, None] = None ) -> ConnectorClient: """ Implementation of ConnectorClientProvider.create_connector_client. @@ -1165,7 +1165,7 @@ async def get_sign_in_resource_from_user( turn_context: TurnContext, connection_name: str, user_id: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, ) -> SignInUrlResponse: return await self.get_sign_in_resource_from_user_and_credentials( turn_context, None, connection_name, user_id, final_redirect @@ -1177,7 +1177,7 @@ async def get_sign_in_resource_from_user_and_credentials( oauth_app_credentials: AppCredentials, connection_name: str, user_id: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, ) -> SignInUrlResponse: if not connection_name: raise TypeError( @@ -1375,7 +1375,7 @@ async def __get_app_credentials( return app_credentials async def __build_credentials( - self, app_id: str, oauth_scope: str = None + self, app_id: str, oauth_scope: Union[str, None] = None ) -> AppCredentials: app_password = await self._credential_provider.get_app_password(app_id) diff --git a/libraries/botbuilder-core/botbuilder/core/bot_telemetry_client.py b/libraries/botbuilder-core/botbuilder/core/bot_telemetry_client.py index 0b935e943..95b64b4e6 100644 --- a/libraries/botbuilder-core/botbuilder/core/bot_telemetry_client.py +++ b/libraries/botbuilder-core/botbuilder/core/bot_telemetry_client.py @@ -3,7 +3,7 @@ import traceback from abc import ABC, abstractmethod -from typing import Dict +from typing import Dict, Union from enum import Enum @@ -89,7 +89,7 @@ def track_metric( name: str, value: float, tel_type: TelemetryDataPointType = None, - count: int = None, + count: Union[int, None] = None, min_val: float = None, max_val: float = None, std_dev: float = None, @@ -130,13 +130,13 @@ def track_request( name: str, url: str, success: bool, - start_time: str = None, - duration: int = None, - response_code: str = None, - http_method: str = None, + start_time: Union[str, None] = None, + duration: Union[int, None] = None, + response_code: Union[str, None] = None, + http_method: Union[str, None] = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, - request_id: str = None, + request_id: Union[str, None] = None, ): """ Sends a single request that was captured for the application. @@ -162,14 +162,14 @@ def track_dependency( self, name: str, data: str, - type_name: str = None, - target: str = None, - duration: int = None, - success: bool = None, - result_code: str = None, + type_name: Union[str, None] = None, + target: Union[str, None] = None, + duration: Union[int, None] = None, + success: Union[bool, None] = None, + result_code: Union[str, None] = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, - dependency_id: str = None, + dependency_id: Union[str, None] = None, ): """ Sends a single dependency telemetry that was captured for the application. diff --git a/libraries/botbuilder-core/botbuilder/core/cloud_adapter_base.py b/libraries/botbuilder-core/botbuilder/core/cloud_adapter_base.py index 0f695a2a7..531b85472 100644 --- a/libraries/botbuilder-core/botbuilder/core/cloud_adapter_base.py +++ b/libraries/botbuilder-core/botbuilder/core/cloud_adapter_base.py @@ -150,9 +150,9 @@ async def continue_conversation( # pylint: disable=arguments-differ self, reference: ConversationReference, callback: Callable, - bot_app_id: str = None, # pylint: disable=unused-argument + bot_app_id: Union[str, None] = None, # pylint: disable=unused-argument claims_identity: ClaimsIdentity = None, # pylint: disable=unused-argument - audience: str = None, # pylint: disable=unused-argument + audience: Union[str, None] = None, # pylint: disable=unused-argument ): """ Sends a proactive message to a conversation. @@ -199,9 +199,9 @@ async def create_conversation( # pylint: disable=arguments-differ bot_app_id: str, callback: Callable[[TurnContext], Awaitable] = None, conversation_parameters: ConversationParameters = None, - channel_id: str = None, - service_url: str = None, - audience: str = None, + channel_id: Union[str, None] = None, + service_url: Union[str, None] = None, + audience: Union[str, None] = None, ): if not service_url: raise TypeError( diff --git a/libraries/botbuilder-core/botbuilder/core/memory_transcript_store.py b/libraries/botbuilder-core/botbuilder/core/memory_transcript_store.py index 325cf32f6..77fc32854 100644 --- a/libraries/botbuilder-core/botbuilder/core/memory_transcript_store.py +++ b/libraries/botbuilder-core/botbuilder/core/memory_transcript_store.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. """The memory transcript store stores transcripts in volatile memory.""" import datetime -from typing import List, Dict +from typing import List, Dict, Union from botbuilder.schema import Activity from .transcript_logger import PagedResult, TranscriptInfo, TranscriptStore @@ -41,7 +41,7 @@ async def get_transcript_activities( self, channel_id: str, conversation_id: str, - continuation_token: str = None, + continuation_token: Union[str, None] = None, start_date: datetime = datetime.datetime.min, ) -> "PagedResult[Activity]": if not channel_id: @@ -98,7 +98,7 @@ async def delete_transcript(self, channel_id: str, conversation_id: str) -> None del self.channels[channel_id][conversation_id] async def list_transcripts( - self, channel_id: str, continuation_token: str = None + self, channel_id: str, continuation_token: Union[str, None] = None ) -> "PagedResult[TranscriptInfo]": if not channel_id: raise TypeError("Missing channel_id") diff --git a/libraries/botbuilder-core/botbuilder/core/message_factory.py b/libraries/botbuilder-core/botbuilder/core/message_factory.py index 209b12826..11a51200a 100644 --- a/libraries/botbuilder-core/botbuilder/core/message_factory.py +++ b/libraries/botbuilder-core/botbuilder/core/message_factory.py @@ -2,6 +2,7 @@ # Licensed under the MIT License. from typing import List, Union + from botbuilder.schema import ( ActivityTypes, Activity, @@ -16,8 +17,8 @@ def attachment_activity( attachment_layout: AttachmentLayoutTypes, attachments: List[Attachment], - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, input_hint: Union[InputHints, str] = InputHints.accepting_input, ) -> Activity: message = Activity( @@ -42,7 +43,7 @@ class MessageFactory: @staticmethod def text( text: str, - speak: str = None, + speak: Union[str, None] = None, input_hint: Union[InputHints, str] = InputHints.accepting_input, ) -> Activity: """ @@ -66,8 +67,8 @@ def text( @staticmethod def suggested_actions( actions: List[CardAction], - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, input_hint: Union[InputHints, str] = InputHints.accepting_input, ) -> Activity: """ @@ -99,8 +100,8 @@ def suggested_actions( @staticmethod def attachment( attachment: Attachment, - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, input_hint: Union[InputHints, str] = None, ): """ @@ -127,8 +128,8 @@ def attachment( @staticmethod def list( attachments: List[Attachment], - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, input_hint: Union[InputHints, str] = None, ) -> Activity: """ @@ -159,8 +160,8 @@ def list( @staticmethod def carousel( attachments: List[Attachment], - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, input_hint: Union[InputHints, str] = None, ) -> Activity: """ @@ -192,9 +193,9 @@ def carousel( def content_url( url: str, content_type: str, - name: str = None, - text: str = None, - speak: str = None, + name: Union[str, None] = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, input_hint: Union[InputHints, str] = None, ): """ diff --git a/libraries/botbuilder-core/botbuilder/core/null_telemetry_client.py b/libraries/botbuilder-core/botbuilder/core/null_telemetry_client.py index 6cb3e5789..222411efb 100644 --- a/libraries/botbuilder-core/botbuilder/core/null_telemetry_client.py +++ b/libraries/botbuilder-core/botbuilder/core/null_telemetry_client.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. import traceback -from typing import Dict +from typing import Dict, Union from .bot_telemetry_client import BotTelemetryClient, TelemetryDataPointType, Severity @@ -68,7 +68,7 @@ def track_metric( name: str, value: float, tel_type: TelemetryDataPointType = None, - count: int = None, + count: Union[int, None] = None, min_val: float = None, max_val: float = None, std_dev: float = None, @@ -104,13 +104,13 @@ def track_request( name: str, url: str, success: bool, - start_time: str = None, - duration: int = None, - response_code: str = None, - http_method: str = None, + start_time: Union[str, None] = None, + duration: Union[int, None] = None, + response_code: Union[str, None] = None, + http_method: Union[str, None] = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, - request_id: str = None, + request_id: Union[str, None] = None, ): """ Sends a single request that was captured for the application. @@ -133,14 +133,14 @@ def track_dependency( self, name: str, data: str, - type_name: str = None, - target: str = None, - duration: int = None, - success: bool = None, - result_code: str = None, + type_name: Union[str, None] = None, + target: Union[str, None] = None, + duration: Union[int, None] = None, + success: Union[bool, None] = None, + result_code: Union[str, None] = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, - dependency_id: str = None, + dependency_id: Union[str, None] = None, ): """ Sends a single dependency telemetry that was captured for the application. diff --git a/libraries/botbuilder-core/botbuilder/core/oauth/connector_client_builder.py b/libraries/botbuilder-core/botbuilder/core/oauth/connector_client_builder.py index e5256040f..2c1d25d85 100644 --- a/libraries/botbuilder-core/botbuilder/core/oauth/connector_client_builder.py +++ b/libraries/botbuilder-core/botbuilder/core/oauth/connector_client_builder.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC, abstractmethod +from typing import Union from botframework.connector import ConnectorClient from botframework.connector.auth import ClaimsIdentity @@ -13,7 +14,7 @@ class ConnectorClientBuilder(ABC): @abstractmethod async def create_connector_client( - self, service_url: str, identity: ClaimsIdentity = None, audience: str = None + self, service_url: str, identity: ClaimsIdentity = None, audience: Union[str, None] = None ) -> ConnectorClient: """ Creates the connector client asynchronous. diff --git a/libraries/botbuilder-core/botbuilder/core/oauth/extended_user_token_provider.py b/libraries/botbuilder-core/botbuilder/core/oauth/extended_user_token_provider.py index ad07c3989..a5eaf0c38 100644 --- a/libraries/botbuilder-core/botbuilder/core/oauth/extended_user_token_provider.py +++ b/libraries/botbuilder-core/botbuilder/core/oauth/extended_user_token_provider.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from abc import ABC -from typing import Dict, List +from typing import Dict, List, Union from botframework.connector.token_api.models import ( SignInUrlResponse, @@ -38,7 +38,7 @@ async def get_sign_in_resource_from_user( turn_context: TurnContext, connection_name: str, user_id: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, ) -> SignInUrlResponse: """ Get the raw signin link to be sent to the user for signin for a connection name. @@ -60,7 +60,7 @@ async def get_sign_in_resource_from_user_and_credentials( oauth_app_credentials: AppCredentials, connection_name: str, user_id: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, ) -> SignInUrlResponse: """ Get the raw signin link to be sent to the user for signin for a connection name. @@ -123,7 +123,7 @@ async def get_user_token( self, context: TurnContext, connection_name: str, - magic_code: str = None, + magic_code: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> TokenResponse: """ @@ -139,8 +139,8 @@ async def get_user_token( async def sign_out_user( self, context: TurnContext, - connection_name: str = None, - user_id: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ): """ @@ -157,7 +157,7 @@ async def get_oauth_sign_in_link( self, context: TurnContext, connection_name: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> str: """ @@ -175,7 +175,7 @@ async def get_aad_tokens( context: TurnContext, connection_name: str, resource_urls: List[str], - user_id: str = None, + user_id: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> Dict[str, TokenResponse]: """ diff --git a/libraries/botbuilder-core/botbuilder/core/oauth/user_token_provider.py b/libraries/botbuilder-core/botbuilder/core/oauth/user_token_provider.py index 04e92efc2..02d663a03 100644 --- a/libraries/botbuilder-core/botbuilder/core/oauth/user_token_provider.py +++ b/libraries/botbuilder-core/botbuilder/core/oauth/user_token_provider.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from abc import ABC, abstractmethod -from typing import Dict, List +from typing import Dict, List, Union from botbuilder.core.turn_context import TurnContext from botbuilder.schema import TokenResponse @@ -15,7 +15,7 @@ async def get_user_token( self, context: TurnContext, connection_name: str, - magic_code: str = None, + magic_code: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> TokenResponse: """ @@ -33,8 +33,8 @@ async def get_user_token( async def sign_out_user( self, context: TurnContext, - connection_name: str = None, - user_id: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ): """ @@ -53,7 +53,7 @@ async def get_oauth_sign_in_link( self, context: TurnContext, connection_name: str, - final_redirect: str = None, + final_redirect: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> str: """ @@ -71,9 +71,9 @@ async def get_oauth_sign_in_link( async def get_token_status( self, context: TurnContext, - connection_name: str = None, - user_id: str = None, - include_filter: str = None, + connection_name: Union[str, None] = None, + user_id: Union[str, None] = None, + include_filter: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> Dict[str, TokenResponse]: """ @@ -95,7 +95,7 @@ async def get_aad_tokens( context: TurnContext, connection_name: str, resource_urls: List[str], - user_id: str = None, + user_id: Union[str, None] = None, oauth_app_credentials: AppCredentials = None, ) -> Dict[str, TokenResponse]: """ diff --git a/libraries/botbuilder-core/botbuilder/core/recognizer_result.py b/libraries/botbuilder-core/botbuilder/core/recognizer_result.py index a3e78b3ee..ced256de9 100644 --- a/libraries/botbuilder-core/botbuilder/core/recognizer_result.py +++ b/libraries/botbuilder-core/botbuilder/core/recognizer_result.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Dict, NamedTuple +from typing import Dict, NamedTuple, Union from msrest.serialization import Model from botbuilder.core import IntentScore @@ -28,8 +28,8 @@ class RecognizerResult(Model): def __init__( self, *, - text: str = None, - altered_text: str = None, + text: Union[str, None] = None, + altered_text: Union[str, None] = None, intents: Dict[str, IntentScore] = None, entities: Dict[str, object] = None, properties: Dict[str, object] = None, diff --git a/libraries/botbuilder-core/botbuilder/core/register_class_middleware.py b/libraries/botbuilder-core/botbuilder/core/register_class_middleware.py index 38be1f46b..3fdcd37c6 100644 --- a/libraries/botbuilder-core/botbuilder/core/register_class_middleware.py +++ b/libraries/botbuilder-core/botbuilder/core/register_class_middleware.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Callable, Awaitable + +from typing import Callable, Awaitable, Union from botbuilder.core import Middleware, TurnContext @@ -10,7 +11,7 @@ class RegisterClassMiddleware(Middleware): Middleware for adding an object to or registering a service with the current turn context. """ - def __init__(self, service, key: str = None): + def __init__(self, service, key: Union[str, None] = None): self.service = service self._key = key diff --git a/libraries/botbuilder-core/botbuilder/core/skills/bot_framework_skill.py b/libraries/botbuilder-core/botbuilder/core/skills/bot_framework_skill.py index 8819d6674..1f4a95771 100644 --- a/libraries/botbuilder-core/botbuilder/core/skills/bot_framework_skill.py +++ b/libraries/botbuilder-core/botbuilder/core/skills/bot_framework_skill.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union class BotFrameworkSkill: """ @@ -8,7 +9,7 @@ class BotFrameworkSkill: """ # pylint: disable=invalid-name - def __init__(self, id: str = None, app_id: str = None, skill_endpoint: str = None): + def __init__(self, id: Union[str, None] = None, app_id: Union[str, None] = None, skill_endpoint: Union[str, None] = None): self.id = id self.app_id = app_id self.skill_endpoint = skill_endpoint diff --git a/libraries/botbuilder-core/botbuilder/core/streaming/streaming_request_handler.py b/libraries/botbuilder-core/botbuilder/core/streaming/streaming_request_handler.py index 12b748ab2..328aee65c 100644 --- a/libraries/botbuilder-core/botbuilder/core/streaming/streaming_request_handler.py +++ b/libraries/botbuilder-core/botbuilder/core/streaming/streaming_request_handler.py @@ -7,7 +7,7 @@ from datetime import datetime from logging import Logger from json import loads -from typing import Dict, List +from typing import Dict, List, Union from botbuilder.core import Bot from botbuilder.schema import Activity, Attachment, ResourceResponse @@ -56,7 +56,7 @@ def __init__( self._server = WebSocketServer(web_socket, self) self._server_is_connected = True self._server.disconnected_event_handler = self._server_disconnected - self._service_url: str = None + self._service_url: Union[str, None] = None @property def service_url(self) -> str: diff --git a/libraries/botbuilder-core/botbuilder/core/streaming/version_info.py b/libraries/botbuilder-core/botbuilder/core/streaming/version_info.py index b11250375..4b59c799e 100644 --- a/libraries/botbuilder-core/botbuilder/core/streaming/version_info.py +++ b/libraries/botbuilder-core/botbuilder/core/streaming/version_info.py @@ -2,12 +2,13 @@ # Licensed under the MIT License. import json +from typing import Union from botframework.streaming.payloads.models import Serializable class VersionInfo(Serializable): - def __init__(self, *, user_agent: str = None): + def __init__(self, *, user_agent: Union[str, None] = None): self.user_agent = user_agent def to_json(self) -> str: diff --git a/libraries/botbuilder-core/botbuilder/core/teams/teams_activity_extensions.py b/libraries/botbuilder-core/botbuilder/core/teams/teams_activity_extensions.py index 253b31f5c..9b4a22d5d 100644 --- a/libraries/botbuilder-core/botbuilder/core/teams/teams_activity_extensions.py +++ b/libraries/botbuilder-core/botbuilder/core/teams/teams_activity_extensions.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import List +from typing import List, Union from botbuilder.schema import Activity from botbuilder.schema.teams import ( NotificationInfo, @@ -62,7 +62,7 @@ def teams_get_team_info(activity: Activity) -> TeamInfo: def teams_notify_user( - activity: Activity, alert_in_meeting: bool = None, external_resource_url: str = None + activity: Activity, alert_in_meeting: Union[bool, None] = None, external_resource_url: Union[str, None] = None ): if not activity: return diff --git a/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py b/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py index 4afa50c05..a10cbea54 100644 --- a/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py +++ b/libraries/botbuilder-core/botbuilder/core/teams/teams_info.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import List, Tuple +from typing import List, Tuple, Union from botframework.connector import Channels from botframework.connector.aio import ConnectorClient @@ -37,7 +37,7 @@ async def send_message_to_teams_channel( activity: Activity, teams_channel_id: str, *, - bot_app_id: str = None, + bot_app_id: Union[str, None] = None, ) -> Tuple[ConversationReference, str]: if not turn_context: raise ValueError("The turn_context cannot be None") @@ -106,7 +106,7 @@ async def _legacy_send_message_to_teams_channel( async def send_meeting_notification( turn_context: TurnContext, notification: MeetingNotificationBase, - meeting_id: str = None, + meeting_id: Union[str, None] = None, ) -> MeetingNotificationResponse: meeting_id = ( meeting_id @@ -199,8 +199,8 @@ async def get_members(turn_context: TurnContext) -> List[TeamsChannelAccount]: async def get_paged_team_members( turn_context: TurnContext, team_id: str = "", - continuation_token: str = None, - page_size: int = None, + continuation_token: Union[str, None] = None, + page_size: Union[int, None] = None, ) -> List[TeamsPagedMembersResult]: if not team_id: team_id = TeamsInfo.get_team_id(turn_context) @@ -220,7 +220,7 @@ async def get_paged_team_members( @staticmethod async def get_paged_members( - turn_context: TurnContext, continuation_token: str = None, page_size: int = None + turn_context: TurnContext, continuation_token: Union[str, None] = None, page_size: Union[int, None] = None ) -> List[TeamsPagedMembersResult]: team_id = TeamsInfo.get_team_id(turn_context) if not team_id: @@ -236,7 +236,7 @@ async def get_paged_members( @staticmethod async def get_team_member( - turn_context: TurnContext, team_id: str = "", member_id: str = None + turn_context: TurnContext, team_id: str = "", member_id: Union[str, None] = None ) -> TeamsChannelAccount: if not team_id: team_id = TeamsInfo.get_team_id(turn_context) @@ -271,9 +271,9 @@ async def get_member( @staticmethod async def get_meeting_participant( turn_context: TurnContext, - meeting_id: str = None, - participant_id: str = None, - tenant_id: str = None, + meeting_id: Union[str, None] = None, + participant_id: Union[str, None] = None, + tenant_id: Union[str, None] = None, ) -> TeamsMeetingParticipant: meeting_id = ( meeting_id @@ -312,7 +312,7 @@ async def get_meeting_participant( @staticmethod async def get_meeting_info( - turn_context: TurnContext, meeting_id: str = None + turn_context: TurnContext, meeting_id: Union[str, None] = None ) -> MeetingInfo: meeting_id = ( meeting_id @@ -387,8 +387,8 @@ async def _get_members( async def _get_paged_members( connector_client: ConnectorClient, conversation_id: str, - continuation_token: str = None, - page_size: int = None, + continuation_token: Union[str, None] = None, + page_size: Union[int, None] = None, ) -> List[TeamsPagedMembersResult]: if connector_client is None: raise TypeError( diff --git a/libraries/botbuilder-core/botbuilder/core/teams/teams_sso_token_exchange_middleware.py b/libraries/botbuilder-core/botbuilder/core/teams/teams_sso_token_exchange_middleware.py index 1dec1210a..0e0845d52 100644 --- a/libraries/botbuilder-core/botbuilder/core/teams/teams_sso_token_exchange_middleware.py +++ b/libraries/botbuilder-core/botbuilder/core/teams/teams_sso_token_exchange_middleware.py @@ -4,7 +4,7 @@ import traceback from http import HTTPStatus -from typing import Awaitable, Callable +from typing import Awaitable, Callable, Union from botframework.connector.channels import Channels from botframework.connector.token_api.models import ( @@ -30,7 +30,7 @@ class _TokenStoreItem(StoreItem): def __init__(self, **kwargs): - self.e_tag: str = None + self.e_tag: Union[str, None] = None super().__init__(**kwargs) @staticmethod diff --git a/libraries/botbuilder-core/botbuilder/core/transcript_logger.py b/libraries/botbuilder-core/botbuilder/core/transcript_logger.py index 5aa1ea726..3a26603e7 100644 --- a/libraries/botbuilder-core/botbuilder/core/transcript_logger.py +++ b/libraries/botbuilder-core/botbuilder/core/transcript_logger.py @@ -8,7 +8,7 @@ import string from queue import Queue from abc import ABC, abstractmethod -from typing import Awaitable, Callable, List +from typing import Awaitable, Callable, List, Union from botbuilder.schema import ( Activity, ActivityEventNames, @@ -209,9 +209,9 @@ class TranscriptInfo: # pylint: disable=invalid-name def __init__( self, - channel_id: str = None, + channel_id: Union[str, None] = None, created: datetime = None, - conversation_id: str = None, + conversation_id: Union[str, None] = None, ): """ :param channel_id: Channel ID the transcript was taken from @@ -229,4 +229,4 @@ class PagedResult: # Page of Items items: List[object] = None # Token used to page through multiple pages. - continuation_token: str = None + continuation_token: Union[str, None] = None diff --git a/libraries/botbuilder-core/botbuilder/core/turn_context.py b/libraries/botbuilder-core/botbuilder/core/turn_context.py index 852fd1f31..b004eb7a6 100644 --- a/libraries/botbuilder-core/botbuilder/core/turn_context.py +++ b/libraries/botbuilder-core/botbuilder/core/turn_context.py @@ -156,8 +156,8 @@ def set(self, key: str, value: object) -> None: async def send_activity( self, activity_or_text: Union[Activity, str], - speak: str = None, - input_hint: str = None, + speak: Union[str, None] = None, + input_hint: Union[str, None] = None, ) -> Union[ResourceResponse, None]: """ Sends a single activity or message to the user. @@ -304,7 +304,7 @@ async def next_handler(): return await logic async def send_trace_activity( - self, name: str, value: object = None, value_type: str = None, label: str = None + self, name: str, value: object = None, value_type: Union[str, None] = None, label: Union[str, None] = None ) -> ResourceResponse: trace_activity = Activity( type=ActivityTypes.trace, diff --git a/libraries/botbuilder-core/tests/skills/test_skill_handler.py b/libraries/botbuilder-core/tests/skills/test_skill_handler.py index 66d79c2ce..861ed6f9b 100644 --- a/libraries/botbuilder-core/tests/skills/test_skill_handler.py +++ b/libraries/botbuilder-core/tests/skills/test_skill_handler.py @@ -6,7 +6,7 @@ from datetime import datetime from uuid import uuid4 from asyncio import Future -from typing import Dict, List, Callable +from typing import Dict, List, Callable, Union from unittest.mock import Mock, MagicMock import aiounittest @@ -190,7 +190,7 @@ async def test_on_get_conversation_paged_members( self, claims_identity: ClaimsIdentity, conversation_id: str, - page_size: int = None, + page_size: Union[int, None] = None, continuation_token: str = "", ) -> PagedMembersResult: return await self.on_get_conversation_paged_members( @@ -296,9 +296,9 @@ async def test_legacy_conversation_id_factory(self): async def continue_conversation( reference: ConversationReference, callback: Callable, - bot_id: str = None, + bot_id: Union[str, None] = None, claims_identity: ClaimsIdentity = None, - audience: str = None, + audience: Union[str, None] = None, ): # pylint: disable=unused-argument # Invoke the callback created by the handler so we can assert the rest of the execution. turn_context = TurnContext( @@ -338,9 +338,9 @@ async def test_on_send_to_conversation(self): async def continue_conversation( reference: ConversationReference, callback: Callable, - bot_id: str = None, + bot_id: Union[str, None] = None, claims_identity: ClaimsIdentity = None, - audience: str = None, + audience: Union[str, None] = None, ): # pylint: disable=unused-argument # Invoke the callback created by the handler so we can assert the rest of the execution. turn_context = TurnContext( @@ -515,9 +515,9 @@ async def test_on_update_activity(self): async def continue_conversation( reference: ConversationReference, callback: Callable, - bot_id: str = None, + bot_id: Union[str, None] = None, claims_identity: ClaimsIdentity = None, - audience: str = None, + audience: Union[str, None] = None, ): # pylint: disable=unused-argument # Invoke the callback created by the handler so we can assert the rest of the execution. nonlocal called_continue @@ -574,9 +574,9 @@ async def test_on_delete_activity(self): async def continue_conversation( reference: ConversationReference, callback: Callable, - bot_id: str = None, + bot_id: Union[str, None] = None, claims_identity: ClaimsIdentity = None, - audience: str = None, + audience: Union[str, None] = None, ): # pylint: disable=unused-argument # Invoke the callback created by the handler so we can assert the rest of the execution. nonlocal called_continue diff --git a/libraries/botbuilder-core/tests/test_bot_state.py b/libraries/botbuilder-core/tests/test_bot_state.py index fdf8ed6fa..091a34c68 100644 --- a/libraries/botbuilder-core/tests/test_bot_state.py +++ b/libraries/botbuilder-core/tests/test_bot_state.py @@ -2,6 +2,8 @@ # Licensed under the MIT License. from unittest.mock import MagicMock +from typing import Union + import aiounittest from botbuilder.core import ( @@ -41,7 +43,7 @@ def get_storage_key(self, turn_context: TurnContext) -> str: class CustomState(StoreItem): - def __init__(self, custom_string: str = None, e_tag: str = "*"): + def __init__(self, custom_string: Union[str, None] = None, e_tag: str = "*"): super().__init__(custom_string=custom_string, e_tag=e_tag) diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py index d5f9cd4df..cb1a9c80d 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py @@ -1,14 +1,14 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import List +from typing import List, Union from botbuilder.schema import CardAction class Choice: def __init__( - self, value: str = None, action: CardAction = None, synonyms: List[str] = None + self, value: Union[str, None] = None, action: CardAction = None, synonyms: List[str] = None ): self.value: str = value self.action: CardAction = action diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory.py index ef1dfc117..6b2c038db 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory.py @@ -18,8 +18,8 @@ class ChoiceFactory: def for_channel( channel_id: str, choices: List[Union[str, Choice]], - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, options: ChoiceFactoryOptions = None, ) -> Activity: """ @@ -73,8 +73,8 @@ def for_channel( @staticmethod def inline( choices: List[Union[str, Choice]], - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, options: ChoiceFactoryOptions = None, ) -> Activity: """ @@ -132,8 +132,8 @@ def inline( @staticmethod def list_style( choices: List[Union[str, Choice]], - text: str = None, - speak: str = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, options: ChoiceFactoryOptions = None, ): """ @@ -187,7 +187,7 @@ def list_style( @staticmethod def suggested_action( - choices: List[Choice], text: str = None, speak: str = None + choices: List[Choice], text: Union[str, None] = None, speak: Union[str, None] = None ) -> Activity: """ Creates a message activity that includes a list of choices that have been added as suggested actions. @@ -202,7 +202,7 @@ def suggested_action( @staticmethod def hero_card( - choices: List[Union[Choice, str]], text: str = None, speak: str = None + choices: List[Union[Choice, str]], text: Union[str, None] = None, speak: Union[str, None] = None ) -> Activity: """ Creates a message activity that includes a lsit of coices that have been added as `HeroCard`'s diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory_options.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory_options.py index 2df259593..def2fc090 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory_options.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory_options.py @@ -1,14 +1,15 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union class ChoiceFactoryOptions: def __init__( self, - inline_separator: str = None, - inline_or: str = None, - inline_or_more: str = None, - include_numbers: bool = None, + inline_separator: Union[str, None] = None, + inline_or: Union[str, None] = None, + inline_or_more: Union[str, None] = None, + include_numbers: Union[bool, None] = None, ) -> None: """Initializes a new instance. Refer to the code in the ConfirmPrompt for an example of usage. diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find_values_options.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find_values_options.py index 5af0614db..544d59e2c 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find_values_options.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/find_values_options.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Callable, List +from typing import Callable, List, Union from .token import Token @@ -11,9 +11,9 @@ class FindValuesOptions: def __init__( self, - allow_partial_matches: bool = None, - locale: str = None, - max_token_distance: int = None, + allow_partial_matches: Union[bool, None] = None, + locale: Union[str, None] = None, + max_token_distance: Union[int, None] = None, tokenizer: Callable[[str, str], List[Token]] = None, ): """ diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/found_choice.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/found_choice.py index c179eab4c..d85558522 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/found_choice.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/found_choice.py @@ -1,11 +1,12 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union class FoundChoice: """Represents a result from matching user input against a list of choices""" - def __init__(self, value: str, index: int, score: float, synonym: str = None): + def __init__(self, value: str, index: int, score: float, synonym: Union[str, None] = None): """ Parameters ---------- diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/tokenizer.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/tokenizer.py index 59e796c84..77a9cb630 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/tokenizer.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/tokenizer.py @@ -11,7 +11,7 @@ class Tokenizer: @staticmethod def default_tokenizer( # pylint: disable=unused-argument - text: str, locale: str = None + text: str, locale: Union[str, None] = None ) -> [Token]: """ Simple tokenizer that breaks on spaces and punctuation. The only normalization is to lowercase. diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py index 1e0a6267c..526fe9c8f 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from abc import ABC, abstractmethod - +from typing import Union from botbuilder.core import NullTelemetryClient, BotTelemetryClient from .dialog import Dialog @@ -13,7 +13,7 @@ class DialogContainer(Dialog, ABC): - def __init__(self, dialog_id: str = None): + def __init__(self, dialog_id: Union[str, None] = None): super().__init__(dialog_id) self.dialogs = DialogSet() diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py index 0181e67a2..002228e50 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import List, Optional +from typing import List, Optional, Union from botbuilder.core.turn_context import TurnContext from botbuilder.dialogs.memory import DialogStateManager @@ -208,8 +208,8 @@ async def end_dialog(self, result: object = None): async def cancel_all_dialogs( self, - cancel_parents: bool = None, - event_name: str = None, + cancel_parents: Union[bool, None] = None, + event_name: Union[str, None] = None, event_value: object = None, ): """ diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py index 0d4e3400b..7d6522e14 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Dict +from typing import Dict, Union class DialogInstance: @@ -10,7 +10,7 @@ class DialogInstance: """ def __init__( - self, id: str = None, state: Dict[str, object] = None + self, id: Union[str, None] = None, state: Dict[str, object] = None ): # pylint: disable=invalid-name """ Gets or sets the ID of the dialog and gets or sets the instance's persisted state. diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_manager.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_manager.py index df7a5569e..599a05be7 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_manager.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_manager.py @@ -3,6 +3,7 @@ from datetime import datetime, timedelta from threading import Lock +from typing import Union from warnings import warn from botbuilder.core import ( @@ -38,7 +39,7 @@ class DialogManager: Class which runs the dialog system. """ - def __init__(self, root_dialog: Dialog = None, dialog_state_property: str = None): + def __init__(self, root_dialog: Dialog = None, dialog_state_property: Union[str, None] = None): """ Initializes a instance of the class. :param root_dialog: Root dialog to use. @@ -68,7 +69,7 @@ def __init__(self, root_dialog: Dialog = None, dialog_state_property: str = None self.state_configuration: DialogStateManagerConfiguration = None # Gets or sets (optional) number of milliseconds to expire the bot's state after. - self.expire_after: int = None + self.expire_after: Union[int, None] = None async def on_turn(self, context: TurnContext) -> DialogManagerResult: """ @@ -156,7 +157,7 @@ async def on_turn(self, context: TurnContext) -> DialogManagerResult: @staticmethod async def send_state_snapshot_trace( dialog_context: DialogContext, - trace_label: str = None, # pylint: disable=unused-argument + trace_label: Union[str, None] = None, # pylint: disable=unused-argument ): """ Helper to send a trace activity with a memory snapshot of the active dialog DC. diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_set.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_set.py index ce2070cae..456278fd7 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_set.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_set.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. import inspect from hashlib import sha256 -from typing import Dict +from typing import Dict, Union from botbuilder.core import ( NullTelemetryClient, @@ -43,7 +43,7 @@ def __init__(self, dialog_state: StatePropertyAccessor = None): self.__telemetry_client = NullTelemetryClient() self._dialogs: Dict[str, Dialog] = {} - self._version: str = None + self._version: Union[str, None] = None @property def telemetry_client(self) -> BotTelemetryClient: diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/alias_path_resolver.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/alias_path_resolver.py index b16930284..569fe3ea8 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/alias_path_resolver.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/path_resolvers/alias_path_resolver.py @@ -1,11 +1,13 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union + from botbuilder.dialogs.memory import PathResolverBase class AliasPathResolver(PathResolverBase): - def __init__(self, alias: str, prefix: str, postfix: str = None): + def __init__(self, alias: str, prefix: str, postfix: Union[str, None] = None): """ Initializes a new instance of the class. Alias name. diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/persisted_state_keys.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/persisted_state_keys.py index 59f7c34cd..89eab6f70 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/persisted_state_keys.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/persisted_state_keys.py @@ -1,8 +1,9 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union class PersistedStateKeys: def __init__(self): - self.user_state: str = None - self.conversation_state: str = None + self.user_state: Union[str, None] = None + self.conversation_state: Union[str, None] = None diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/choice_prompt.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/choice_prompt.py index 9996c7964..3d1e788aa 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/choice_prompt.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/choice_prompt.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Callable, Dict, List +from typing import Callable, Dict, List, Union from botbuilder.core import TurnContext from botbuilder.dialogs.choices import ( @@ -42,7 +42,7 @@ def __init__( self, dialog_id: str, validator: Callable[[PromptValidatorContext], bool] = None, - default_locale: str = None, + default_locale: Union[str, None] = None, choice_defaults: Dict[str, ChoiceFactoryOptions] = None, ): """ diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/confirm_prompt.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/confirm_prompt.py index 30f2248e8..726a7e81c 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/confirm_prompt.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/confirm_prompt.py @@ -1,7 +1,8 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Dict +from typing import Dict, Union + from recognizers_choice import recognize_boolean from botbuilder.core.turn_context import TurnContext from botbuilder.schema import ActivityTypes, Activity @@ -32,7 +33,7 @@ def __init__( self, dialog_id: str, validator: object = None, - default_locale: str = None, + default_locale: Union[str, None] = None, choice_defaults: Dict[str, object] = None, ): super().__init__(dialog_id, validator) diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_resolution.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_resolution.py index 32936b5a9..eb8a3e86a 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_resolution.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_resolution.py @@ -1,10 +1,11 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union class DateTimeResolution: def __init__( - self, value: str = None, start: str = None, end: str = None, timex: str = None + self, value: Union[str, None] = None, start: Union[str, None] = None, end: Union[str, None] = None, timex: Union[str, None] = None ): self.value = value self.start = start diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py index 519ba39c9..98cdd0205 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Callable, Dict +from typing import Callable, Dict, Union from recognizers_number import recognize_number from recognizers_text import Culture, ModelResult @@ -22,7 +22,7 @@ def __init__( self, dialog_id: str, validator: Callable[[PromptValidatorContext], bool] = None, - default_locale: str = None, + default_locale: Union[str, None] = None, ): super(NumberPrompt, self).__init__(dialog_id, validator) self.default_locale = default_locale diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py index d31a0b56a..c1c483d5f 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py @@ -44,7 +44,7 @@ class CallerInfo: - def __init__(self, caller_service_url: str = None, scope: str = None): + def __init__(self, caller_service_url: Union[str, None] = None, scope: Union[str, None] = None): self.caller_service_url = caller_service_url self.scope = scope @@ -251,7 +251,7 @@ async def continue_dialog(self, dialog_context: DialogContext) -> DialogTurnResu return Dialog.end_of_turn async def get_user_token( - self, context: TurnContext, code: str = None + self, context: TurnContext, code: Union[str, None] = None ) -> TokenResponse: """ Gets the user's tokeN. @@ -529,7 +529,7 @@ async def _recognize_token( ) def _get_token_exchange_invoke_response( - self, status: int, failure_detail: str, identifier: str = None + self, status: int, failure_detail: str, identifier: Union[str, None] = None ) -> Activity: return Activity( type=ActivityTypes.invoke_response, diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt_settings.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt_settings.py index c071c590e..4c106e53e 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt_settings.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt_settings.py @@ -1,5 +1,8 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. + +from typing import Union + from botframework.connector.auth import AppCredentials @@ -8,8 +11,8 @@ def __init__( self, connection_name: str, title: str, - text: str = None, - timeout: int = None, + text: Union[str, None] = None, + timeout: Union[int, None] = None, oauth_app_credentials: AppCredentials = None, end_on_invalid_message: bool = False, ): diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/skills/skill_dialog_options.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/skills/skill_dialog_options.py index 028490a40..30962fc9b 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/skills/skill_dialog_options.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/skills/skill_dialog_options.py @@ -1,6 +1,8 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union + from botbuilder.core import ConversationState from botbuilder.core.skills import ( BotFrameworkClient, @@ -12,13 +14,13 @@ class SkillDialogOptions: def __init__( self, - bot_id: str = None, + bot_id: Union[str, None] = None, skill_client: BotFrameworkClient = None, - skill_host_endpoint: str = None, + skill_host_endpoint: Union[str, None] = None, skill: BotFrameworkSkill = None, conversation_id_factory: ConversationIdFactoryBase = None, conversation_state: ConversationState = None, - connection_name: str = None, + connection_name: Union[str, None] = None, ): self.bot_id = bot_id self.skill_client = skill_client diff --git a/libraries/botbuilder-dialogs/tests/test_dialog_manager.py b/libraries/botbuilder-dialogs/tests/test_dialog_manager.py index 3c5a4b34a..07759da6d 100644 --- a/libraries/botbuilder-dialogs/tests/test_dialog_manager.py +++ b/libraries/botbuilder-dialogs/tests/test_dialog_manager.py @@ -3,7 +3,7 @@ # pylint: disable=pointless-string-statement from enum import Enum -from typing import Callable, List, Tuple +from typing import Callable, List, Tuple, Union import aiounittest @@ -74,7 +74,7 @@ class SimpleComponentDialog(ComponentDialog): dm_turn_result: DialogManagerResult = None def __init__( - self, id: str = None, prop: str = None + self, id: Union[str, None] = None, prop: Union[str, None] = None ): # pylint: disable=unused-argument super().__init__(id or "SimpleComponentDialog") self.text_prompt = "TextPrompt" diff --git a/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py b/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py index 0c5fac1e7..0093cf98f 100644 --- a/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py +++ b/libraries/botbuilder-dialogs/tests/test_oauth_prompt.py @@ -1,6 +1,8 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union + import aiounittest from botbuilder.dialogs.prompts import OAuthPromptSettings from botbuilder.schema import ( @@ -74,7 +76,7 @@ async def callback_handler(turn_context: TurnContext): ) async def inspector( - activity: Activity, description: str = None + activity: Activity, description: Union[str, None] = None ): # pylint: disable=unused-argument self.assertTrue(len(activity.attachments) == 1) self.assertTrue( @@ -141,7 +143,7 @@ async def exec_test(turn_context: TurnContext): ) def inspector( - activity: Activity, description: str = None + activity: Activity, description: Union[str, None] = None ): # pylint: disable=unused-argument assert len(activity.attachments) == 1 assert ( @@ -206,7 +208,7 @@ async def exec_test(turn_context: TurnContext): ) def inspector( - activity: Activity, description: str = None + activity: Activity, description: Union[str, None] = None ): # pylint: disable=unused-argument assert len(activity.attachments) == 1 assert ( @@ -300,7 +302,7 @@ async def exec_test(turn_context: TurnContext): ) def inspector( - activity: Activity, description: str = None + activity: Activity, description: Union[str, None] = None ): # pylint: disable=unused-argument assert len(activity.attachments) == 1 assert ( @@ -396,7 +398,7 @@ async def exec_test(turn_context: TurnContext): ) def inspector( - activity: Activity, description: str = None + activity: Activity, description: Union[str, None] = None ): # pylint: disable=unused-argument assert len(activity.attachments) == 1 assert ( diff --git a/libraries/botbuilder-dialogs/tests/test_object_path.py b/libraries/botbuilder-dialogs/tests/test_object_path.py index 8ff6ff543..15d5ce8b1 100644 --- a/libraries/botbuilder-dialogs/tests/test_object_path.py +++ b/libraries/botbuilder-dialogs/tests/test_object_path.py @@ -1,3 +1,8 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from typing import Union + import aiounittest from botbuilder.dialogs import ObjectPath @@ -12,11 +17,11 @@ def __init__(self, lat: float = None, long: float = None): class Options: def __init__( self, - first_name: str = None, - last_name: str = None, - age: int = None, - boolean: bool = None, - dictionary: dict = None, + first_name: Union[str, None] = None, + last_name: Union[str, None] = None, + age: Union[int, None] = None, + boolean: Union[bool, None] = None, + dictionary: Union[dict, None] = None, location: Location = None, ): self.first_name = first_name diff --git a/libraries/botbuilder-dialogs/tests/test_skill_dialog.py b/libraries/botbuilder-dialogs/tests/test_skill_dialog.py index 3c2a3d1b4..b58962617 100644 --- a/libraries/botbuilder-dialogs/tests/test_skill_dialog.py +++ b/libraries/botbuilder-dialogs/tests/test_skill_dialog.py @@ -584,7 +584,7 @@ async def capture_action( def create_skill_dialog_options( conversation_state: ConversationState, skill_client: BotFrameworkClient, - connection_name: str = None, + connection_name: Union[str, None] = None, ): return SkillDialogOptions( bot_id=str(uuid.uuid4()), 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 542287af2..c1a554bc5 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 @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from typing import Union from logging import Logger from botbuilder.core import InvokeResponse @@ -43,7 +44,7 @@ async def post_activity_to_skill( to_skill: BotFrameworkSkill, service_url: str, activity: Activity, - originating_audience: str = None, + originating_audience: Union[str, None] = None, ) -> InvokeResponse: if originating_audience is None: originating_audience = ( diff --git a/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py b/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py index 1b6a631c6..93a1f5c35 100644 --- a/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py +++ b/libraries/botbuilder-schema/botbuilder/schema/_models_py3.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import List +from typing import List, Union from botbuilder.schema._connector_client_enums import ActivityTypes from datetime import datetime, timezone @@ -52,13 +52,13 @@ class ConversationReference(Model): def __init__( self, *, - activity_id: str = None, + activity_id: Union[str, None] = None, user=None, bot=None, conversation=None, - channel_id: str = None, - locale: str = None, - service_url: str = None, + channel_id: Union[str, None] = None, + locale: Union[str, None] = None, + service_url: Union[str, None] = None, **kwargs ) -> None: super(ConversationReference, self).__init__(**kwargs) @@ -89,7 +89,7 @@ class Mention(Model): } def __init__( - self, *, mentioned=None, text: str = None, type: str = None, **kwargs + self, *, mentioned=None, text: Union[str, None] = None, type: Union[str, None] = None, **kwargs ) -> None: super(Mention, self).__init__(**kwargs) self.mentioned = mentioned @@ -106,7 +106,7 @@ class ResourceResponse(Model): _attribute_map = {"id": {"key": "id", "type": "str"}} - def __init__(self, *, id: str = None, **kwargs) -> None: + def __init__(self, *, id: Union[str, None] = None, **kwargs) -> None: super(ResourceResponse, self).__init__(**kwargs) self.id = id @@ -298,12 +298,12 @@ def __init__( self, *, type=None, - id: str = None, + id: Union[str, None] = None, timestamp=None, local_timestamp=None, - local_timezone: str = None, - service_url: str = None, - channel_id: str = None, + local_timezone: Union[str, None] = None, + service_url: Union[str, None] = None, + channel_id: Union[str, None] = None, from_property=None, conversation=None, recipient=None, @@ -313,23 +313,23 @@ def __init__( members_removed=None, reactions_added=None, reactions_removed=None, - topic_name: str = None, - history_disclosed: bool = None, - locale: str = None, - text: str = None, - speak: str = None, + topic_name: Union[str, None] = None, + history_disclosed: Union[bool, None] = None, + locale: Union[str, None] = None, + text: Union[str, None] = None, + speak: Union[str, None] = None, input_hint=None, - summary: str = None, + summary: Union[str, None] = None, suggested_actions=None, attachments=None, entities=None, channel_data=None, - action: str = None, - reply_to_id: str = None, - label: str = None, - value_type: str = None, + action: Union[str, None] = None, + reply_to_id: Union[str, None] = None, + label: Union[str, None] = None, + value_type: Union[str, None] = None, value=None, - name: str = None, + name: Union[str, None] = None, relates_to=None, code=None, expiration=None, @@ -338,7 +338,7 @@ def __init__( listen_for=None, text_highlights=None, semantic_action=None, - caller_id: str = None, + caller_id: Union[str, None] = None, **kwargs ) -> None: super(Activity, self).__init__(**kwargs) @@ -616,7 +616,7 @@ def create_message_activity(): """ return Activity(type=ActivityTypes.message) - def create_reply(self, text: str = None, locale: str = None): + def create_reply(self, text: Union[str, None] = None, locale: Union[str, None] = None): """ Creates a new message activity as a response to this activity. @@ -659,7 +659,7 @@ def create_reply(self, text: str = None, locale: str = None): ) def create_trace( - self, name: str, value: object = None, value_type: str = None, label: str = None + self, name: str, value: object = None, value_type: Union[str, None] = None, label: Union[str, None] = None ): """ Creates a new trace activity based on this activity. @@ -707,7 +707,7 @@ def create_trace( @staticmethod def create_trace_activity( - name: str, value: object = None, value_type: str = None, label: str = None + name: str, value: object = None, value_type: Union[str, None] = None, label: Union[str, None] = None ): """ Creates an instance of the :class:`Activity` class as a TraceActivity object. @@ -908,17 +908,17 @@ class AnimationCard(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, image=None, media=None, buttons=None, - shareable: bool = None, - autoloop: bool = None, - autostart: bool = None, - aspect: str = None, - duration: str = None, + shareable: Union[bool, None] = None, + autoloop: Union[bool, None] = None, + autostart: Union[bool, None] = None, + aspect: Union[str, None] = None, + duration: Union[str, None] = None, value=None, **kwargs ) -> None: @@ -963,11 +963,11 @@ class Attachment(Model): def __init__( self, *, - content_type: str = None, - content_url: str = None, + content_type: Union[str, None] = None, + content_url: Union[str, None] = None, content=None, - name: str = None, - thumbnail_url: str = None, + name: Union[str, None] = None, + thumbnail_url: Union[str, None] = None, **kwargs ) -> None: super(Attachment, self).__init__(**kwargs) @@ -1001,8 +1001,8 @@ class AttachmentData(Model): def __init__( self, *, - type: str = None, - name: str = None, + type: Union[str, None] = None, + name: Union[str, None] = None, original_base64: bytearray = None, thumbnail_base64: bytearray = None, **kwargs @@ -1032,7 +1032,7 @@ class AttachmentInfo(Model): } def __init__( - self, *, name: str = None, type: str = None, views=None, **kwargs + self, *, name: Union[str, None] = None, type: Union[str, None] = None, views=None, **kwargs ) -> None: super(AttachmentInfo, self).__init__(**kwargs) self.name = name @@ -1054,7 +1054,7 @@ class AttachmentView(Model): "size": {"key": "size", "type": "int"}, } - def __init__(self, *, view_id: str = None, size: int = None, **kwargs) -> None: + def __init__(self, *, view_id: Union[str, None] = None, size: Union[int, None] = None, **kwargs) -> None: super(AttachmentView, self).__init__(**kwargs) self.view_id = view_id self.size = size @@ -1113,17 +1113,17 @@ class AudioCard(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, image=None, media=None, buttons=None, - shareable: bool = None, - autoloop: bool = None, - autostart: bool = None, - aspect: str = None, - duration: str = None, + shareable: Union[bool, None] = None, + autoloop: Union[bool, None] = None, + autostart: Union[bool, None] = None, + aspect: Union[str, None] = None, + duration: Union[str, None] = None, value=None, **kwargs ) -> None: @@ -1172,9 +1172,9 @@ class BasicCard(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, images=None, buttons=None, tap=None, @@ -1230,13 +1230,13 @@ def __init__( self, *, type=None, - title: str = None, - image: str = None, - text: str = None, - display_text: str = None, + title: Union[str, None] = None, + image: Union[str, None] = None, + text: Union[str, None] = None, + display_text: Union[str, None] = None, value=None, channel_data=None, - image_alt_text: str = None, + image_alt_text: Union[str, None] = None, **kwargs ) -> None: super(CardAction, self).__init__(**kwargs) @@ -1267,7 +1267,7 @@ class CardImage(Model): "tap": {"key": "tap", "type": "CardAction"}, } - def __init__(self, *, url: str = None, alt: str = None, tap=None, **kwargs) -> None: + def __init__(self, *, url: Union[str, None] = None, alt: Union[str, None] = None, tap=None, **kwargs) -> None: super(CardImage, self).__init__(**kwargs) self.url = url self.alt = alt @@ -1301,9 +1301,9 @@ class ChannelAccount(Model): def __init__( self, *, - id: str = None, - name: str = None, - aad_object_id: str = None, + id: Union[str, None] = None, + name: Union[str, None] = None, + aad_object_id: Union[str, None] = None, role=None, properties=None, **kwargs @@ -1356,11 +1356,11 @@ class ConversationAccount(Model): def __init__( self, *, - is_group: bool = None, - conversation_type: str = None, - id: str = None, - name: str = None, - aad_object_id: str = None, + is_group: Union[bool, None] = None, + conversation_type: Union[str, None] = None, + id: Union[str, None] = None, + name: Union[str, None] = None, + aad_object_id: Union[str, None] = None, role=None, tenant_id=None, properties=None, @@ -1391,7 +1391,7 @@ class ConversationMembers(Model): "members": {"key": "members", "type": "[ChannelAccount]"}, } - def __init__(self, *, id: str = None, members=None, **kwargs) -> None: + def __init__(self, *, id: Union[str, None] = None, members=None, **kwargs) -> None: super(ConversationMembers, self).__init__(**kwargs) self.id = id self.members = members @@ -1432,10 +1432,10 @@ class ConversationParameters(Model): def __init__( self, *, - is_group: bool = None, + is_group: Union[bool, None] = None, bot=None, members=None, - topic_name: str = None, + topic_name: Union[str, None] = None, activity=None, channel_data=None, tenant_id=None, @@ -1472,9 +1472,9 @@ class ConversationResourceResponse(Model): def __init__( self, *, - activity_id: str = None, - service_url: str = None, - id: str = None, + activity_id: Union[str, None] = None, + service_url: Union[str, None] = None, + id: Union[str, None] = None, **kwargs ) -> None: super(ConversationResourceResponse, self).__init__(**kwargs) @@ -1499,7 +1499,7 @@ class ConversationsResult(Model): } def __init__( - self, *, continuation_token: str = None, conversations=None, **kwargs + self, *, continuation_token: Union[str, None] = None, conversations=None, **kwargs ) -> None: super(ConversationsResult, self).__init__(**kwargs) self.continuation_token = continuation_token @@ -1530,7 +1530,7 @@ class Entity(Model): _attribute_map = {"type": {"key": "type", "type": "str"}} - def __init__(self, *, type: str = None, **kwargs) -> None: + def __init__(self, *, type: Union[str, None] = None, **kwargs) -> None: super(Entity, self).__init__(**kwargs) self.type = type @@ -1553,7 +1553,7 @@ class Error(Model): } def __init__( - self, *, code: str = None, message: str = None, inner_http_error=None, **kwargs + self, *, code: Union[str, None] = None, message: Union[str, None] = None, inner_http_error=None, **kwargs ) -> None: super(Error, self).__init__(**kwargs) self.code = code @@ -1605,7 +1605,7 @@ class Fact(Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, key: str = None, value: str = None, **kwargs) -> None: + def __init__(self, *, key: Union[str, None] = None, value: Union[str, None] = None, **kwargs) -> None: super(Fact, self).__init__(**kwargs) self.key = key self.value = value @@ -1643,8 +1643,8 @@ def __init__( elevation: float = None, latitude: float = None, longitude: float = None, - type: str = None, - name: str = None, + type: Union[str, None] = None, + name: Union[str, None] = None, **kwargs ) -> None: super(GeoCoordinates, self).__init__(**kwargs) @@ -1685,9 +1685,9 @@ class HeroCard(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, images=None, buttons=None, tap=None, @@ -1716,7 +1716,7 @@ class InnerHttpError(Model): "body": {"key": "body", "type": "object"}, } - def __init__(self, *, status_code: int = None, body=None, **kwargs) -> None: + def __init__(self, *, status_code: Union[int, None] = None, body=None, **kwargs) -> None: super(InnerHttpError, self).__init__(**kwargs) self.status_code = status_code self.body = body @@ -1738,7 +1738,7 @@ class InvokeResponse(Model): "body": {"key": "body", "type": "object"}, } - def __init__(self, *, status: int = None, body: object = None, **kwargs): + def __init__(self, *, status: Union[int, None] = None, body: object = None, **kwargs): """ Gets or sets the HTTP status and/or body code for the response :param status: The HTTP status code. @@ -1813,17 +1813,17 @@ class MediaCard(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, image=None, media=None, buttons=None, - shareable: bool = None, - autoloop: bool = None, - autostart: bool = None, - aspect: str = None, - duration: str = None, + shareable: Union[bool, None] = None, + autoloop: Union[bool, None] = None, + autostart: Union[bool, None] = None, + aspect: Union[str, None] = None, + duration: Union[str, None] = None, value=None, **kwargs ) -> None: @@ -1872,7 +1872,7 @@ class MediaUrl(Model): "profile": {"key": "profile", "type": "str"}, } - def __init__(self, *, url: str = None, profile: str = None, **kwargs) -> None: + def __init__(self, *, url: Union[str, None] = None, profile: Union[str, None] = None, **kwargs) -> None: super(MediaUrl, self).__init__(**kwargs) self.url = url self.profile = profile @@ -1914,8 +1914,8 @@ class OAuthCard(Model): def __init__( self, *, - text: str = None, - connection_name: str = None, + text: Union[str, None] = None, + connection_name: Union[str, None] = None, buttons=None, token_exchange_resource=None, **kwargs @@ -1942,7 +1942,7 @@ class PagedMembersResult(Model): } def __init__( - self, *, continuation_token: str = None, members=None, **kwargs + self, *, continuation_token: Union[str, None] = None, members=None, **kwargs ) -> None: super(PagedMembersResult, self).__init__(**kwargs) self.continuation_token = continuation_token @@ -1981,8 +1981,8 @@ def __init__( address=None, geo=None, has_map=None, - type: str = None, - name: str = None, + type: Union[str, None] = None, + name: Union[str, None] = None, **kwargs ) -> None: super(Place, self).__init__(**kwargs) @@ -2028,13 +2028,13 @@ class ReceiptCard(Model): def __init__( self, *, - title: str = None, + title: Union[str, None] = None, facts=None, items=None, tap=None, - total: str = None, - tax: str = None, - vat: str = None, + total: Union[str, None] = None, + tax: Union[str, None] = None, + vat: Union[str, None] = None, buttons=None, **kwargs ) -> None: @@ -2084,12 +2084,12 @@ class ReceiptItem(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, image=None, - price: str = None, - quantity: str = None, + price: Union[str, None] = None, + quantity: Union[str, None] = None, tap=None, **kwargs ) -> None: @@ -2120,7 +2120,7 @@ class SemanticAction(Model): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, id: str = None, entities=None, state=None, **kwargs) -> None: + def __init__(self, *, id: Union[str, None] = None, entities=None, state=None, **kwargs) -> None: super(SemanticAction, self).__init__(**kwargs) self.id = id self.entities = entities @@ -2141,7 +2141,7 @@ class SigninCard(Model): "buttons": {"key": "buttons", "type": "[CardAction]"}, } - def __init__(self, *, text: str = None, buttons=None, **kwargs) -> None: + def __init__(self, *, text: Union[str, None] = None, buttons=None, **kwargs) -> None: super(SigninCard, self).__init__(**kwargs) self.text = text self.buttons = buttons @@ -2184,7 +2184,7 @@ class TextHighlight(Model): "occurrence": {"key": "occurrence", "type": "int"}, } - def __init__(self, *, text: str = None, occurrence: int = None, **kwargs) -> None: + def __init__(self, *, text: Union[str, None] = None, occurrence: Union[int, None] = None, **kwargs) -> None: super(TextHighlight, self).__init__(**kwargs) self.text = text self.occurrence = occurrence @@ -2204,7 +2204,7 @@ class Thing(Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: str = None, name: str = None, **kwargs) -> None: + def __init__(self, *, type: Union[str, None] = None, name: Union[str, None] = None, **kwargs) -> None: super(Thing, self).__init__(**kwargs) self.type = type self.name = name @@ -2240,9 +2240,9 @@ class ThumbnailCard(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, images=None, buttons=None, tap=None, @@ -2271,7 +2271,7 @@ class ThumbnailUrl(Model): "alt": {"key": "alt", "type": "str"}, } - def __init__(self, *, url: str = None, alt: str = None, **kwargs) -> None: + def __init__(self, *, url: Union[str, None] = None, alt: Union[str, None] = None, **kwargs) -> None: super(ThumbnailUrl, self).__init__(**kwargs) self.url = url self.alt = alt @@ -2300,9 +2300,9 @@ class TokenExchangeInvokeRequest(Model): def __init__( self, *, - id: str = None, - connection_name: str = None, - token: str = None, + id: Union[str, None] = None, + connection_name: Union[str, None] = None, + token: Union[str, None] = None, properties=None, **kwargs ) -> None: @@ -2336,9 +2336,9 @@ class TokenExchangeInvokeResponse(Model): def __init__( self, *, - id: str = None, - connection_name: str = None, - failure_detail: str = None, + id: Union[str, None] = None, + connection_name: Union[str, None] = None, + failure_detail: Union[str, None] = None, properties=None, **kwargs ) -> None: @@ -2375,11 +2375,11 @@ class TokenExchangeState(Model): def __init__( self, *, - connection_name: str = None, + connection_name: Union[str, None] = None, conversation=None, relates_to=None, - bot_url: str = None, - ms_app_id: str = None, + bot_url: Union[str, None] = None, + ms_app_id: Union[str, None] = None, **kwargs ) -> None: super(TokenExchangeState, self).__init__(**kwargs) @@ -2405,7 +2405,7 @@ class TokenRequest(Model): "settings": {"key": "settings", "type": "{object}"}, } - def __init__(self, *, provider: str = None, settings=None, **kwargs) -> None: + def __init__(self, *, provider: Union[str, None] = None, settings=None, **kwargs) -> None: super(TokenRequest, self).__init__(**kwargs) self.provider = provider self.settings = settings @@ -2435,10 +2435,10 @@ class TokenResponse(Model): def __init__( self, *, - connection_name: str = None, - token: str = None, - expiration: str = None, - channel_id: str = None, + connection_name: Union[str, None] = None, + token: Union[str, None] = None, + expiration: Union[str, None] = None, + channel_id: Union[str, None] = None, **kwargs ) -> None: super(TokenResponse, self).__init__(**kwargs) @@ -2516,17 +2516,17 @@ class VideoCard(Model): def __init__( self, *, - title: str = None, - subtitle: str = None, - text: str = None, + title: Union[str, None] = None, + subtitle: Union[str, None] = None, + text: Union[str, None] = None, image=None, media=None, buttons=None, - shareable: bool = None, - autoloop: bool = None, - autostart: bool = None, - aspect: str = None, - duration: str = None, + shareable: Union[bool, None] = None, + autoloop: Union[bool, None] = None, + autostart: Union[bool, None] = None, + aspect: Union[str, None] = None, + duration: Union[str, None] = None, value=None, **kwargs ) -> None: @@ -2569,7 +2569,7 @@ class AdaptiveCardInvokeAction(Model): } def __init__( - self, *, type: str = None, id: str = None, verb: str = None, data=None, **kwargs + self, *, type: Union[str, None] = None, id: Union[str, None] = None, verb: Union[str, None] = None, data=None, **kwargs ) -> None: super(AdaptiveCardInvokeAction, self).__init__(**kwargs) self.type = type @@ -2598,7 +2598,7 @@ class AdaptiveCardInvokeResponse(Model): } def __init__( - self, *, status_code: int = None, type: str = None, value=None, **kwargs + self, *, status_code: Union[int, None] = None, type: Union[str, None] = None, value=None, **kwargs ) -> None: super(AdaptiveCardInvokeResponse, self).__init__(**kwargs) self.status_code = status_code @@ -2626,7 +2626,7 @@ class AdaptiveCardInvokeValue(Model): } def __init__( - self, *, action=None, authentication=None, state: str = None, **kwargs + self, *, action=None, authentication=None, state: Union[str, None] = None, **kwargs ) -> None: super(AdaptiveCardInvokeValue, self).__init__(**kwargs) self.action = action diff --git a/libraries/botbuilder-schema/botbuilder/schema/teams/_models_py3.py b/libraries/botbuilder-schema/botbuilder/schema/teams/_models_py3.py index 0b6e0e899..66d7a3a11 100644 --- a/libraries/botbuilder-schema/botbuilder/schema/teams/_models_py3.py +++ b/libraries/botbuilder-schema/botbuilder/schema/teams/_models_py3.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. from enum import Enum -from typing import List +from typing import List, Union from msrest.serialization import Model from botbuilder.schema import ( Attachment, @@ -75,7 +75,7 @@ class AppBasedLinkQuery(Model): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, url: str = None, state: str = None, **kwargs) -> None: + def __init__(self, *, url: Union[str, None] = None, state: Union[str, None] = None, **kwargs) -> None: super(AppBasedLinkQuery, self).__init__(**kwargs) self.url = url self.state = state @@ -99,7 +99,7 @@ class ChannelInfo(Model): } def __init__( - self, *, id: str = None, name: str = None, type: str = None, **kwargs + self, *, id: Union[str, None] = None, name: Union[str, None] = None, type: Union[str, None] = None, **kwargs ) -> None: super(ChannelInfo, self).__init__(**kwargs) self.id = id @@ -122,7 +122,7 @@ class CacheInfo(Model): } def __init__( - self, *, cache_type: str = None, cache_duration: int = None, **kwargs + self, *, cache_type: Union[str, None] = None, cache_duration: Union[int, None] = None, **kwargs ) -> None: super(CacheInfo, self).__init__(**kwargs) self.cache_type = cache_type @@ -172,8 +172,8 @@ class FileConsentCard(Model): def __init__( self, *, - description: str = None, - size_in_bytes: int = None, + description: Union[str, None] = None, + size_in_bytes: Union[int, None] = None, accept_context=None, decline_context=None, **kwargs @@ -237,9 +237,9 @@ class FileDownloadInfo(Model): def __init__( self, *, - download_url: str = None, - unique_id: str = None, - file_type: str = None, + download_url: Union[str, None] = None, + unique_id: Union[str, None] = None, + file_type: Union[str, None] = None, etag=None, **kwargs ) -> None: @@ -268,7 +268,7 @@ class FileInfoCard(Model): } def __init__( - self, *, unique_id: str = None, file_type: str = None, etag=None, **kwargs + self, *, unique_id: Union[str, None] = None, file_type: Union[str, None] = None, etag=None, **kwargs ) -> None: super(FileInfoCard, self).__init__(**kwargs) self.unique_id = unique_id @@ -303,11 +303,11 @@ class FileUploadInfo(Model): def __init__( self, *, - name: str = None, - upload_url: str = None, - content_url: str = None, - unique_id: str = None, - file_type: str = None, + name: Union[str, None] = None, + upload_url: Union[str, None] = None, + content_url: Union[str, None] = None, + unique_id: Union[str, None] = None, + file_type: Union[str, None] = None, **kwargs ) -> None: super(FileUploadInfo, self).__init__(**kwargs) @@ -342,8 +342,8 @@ def __init__( self, *, application_identity_type=None, - id: str = None, - display_name: str = None, + id: Union[str, None] = None, + display_name: Union[str, None] = None, **kwargs ) -> None: super(MessageActionsPayloadApp, self).__init__(**kwargs) @@ -383,12 +383,12 @@ class MessageActionsPayloadAttachment(Model): def __init__( self, *, - id: str = None, - content_type: str = None, - content_url: str = None, + id: Union[str, None] = None, + content_type: Union[str, None] = None, + content_url: Union[str, None] = None, content=None, - name: str = None, - thumbnail_url: str = None, + name: Union[str, None] = None, + thumbnail_url: Union[str, None] = None, **kwargs ) -> None: super(MessageActionsPayloadAttachment, self).__init__(**kwargs) @@ -415,7 +415,7 @@ class MessageActionsPayloadBody(Model): "content": {"key": "content", "type": "str"}, } - def __init__(self, *, content_type=None, content: str = None, **kwargs) -> None: + def __init__(self, *, content_type=None, content: Union[str, None] = None, **kwargs) -> None: super(MessageActionsPayloadBody, self).__init__(**kwargs) self.content_type = content_type self.content = content @@ -448,8 +448,8 @@ def __init__( self, *, conversation_identity_type=None, - id: str = None, - display_name: str = None, + id: Union[str, None] = None, + display_name: Union[str, None] = None, **kwargs ) -> None: super(MessageActionsPayloadConversation, self).__init__(**kwargs) @@ -509,7 +509,7 @@ class MessageActionsPayloadMention(Model): } def __init__( - self, *, id: int = None, mention_text: str = None, mentioned=None, **kwargs + self, *, id: Union[int, None] = None, mention_text: Union[str, None] = None, mentioned=None, **kwargs ) -> None: super(MessageActionsPayloadMention, self).__init__(**kwargs) self.id = id @@ -537,7 +537,7 @@ class MessageActionsPayloadReaction(Model): } def __init__( - self, *, reaction_type=None, created_date_time: str = None, user=None, **kwargs + self, *, reaction_type=None, created_date_time: Union[str, None] = None, user=None, **kwargs ) -> None: super(MessageActionsPayloadReaction, self).__init__(**kwargs) self.reaction_type = reaction_type @@ -567,8 +567,8 @@ def __init__( self, *, user_identity_type=None, - id: str = None, - display_name: str = None, + id: Union[str, None] = None, + display_name: Union[str, None] = None, **kwargs ) -> None: super(MessageActionsPayloadUser, self).__init__(**kwargs) @@ -652,20 +652,20 @@ class MessageActionsPayload(Model): def __init__( self, *, - id: str = None, - reply_to_id: str = None, + id: Union[str, None] = None, + reply_to_id: Union[str, None] = None, message_type=None, - created_date_time: str = None, - last_modified_date_time: str = None, - deleted: bool = None, - subject: str = None, - summary: str = None, + created_date_time: Union[str, None] = None, + last_modified_date_time: Union[str, None] = None, + deleted: Union[bool, None] = None, + subject: Union[str, None] = None, + summary: Union[str, None] = None, importance=None, - locale: str = None, - link_to_message: str = None, + locale: Union[str, None] = None, + link_to_message: Union[str, None] = None, from_property=None, body=None, - attachment_layout: str = None, + attachment_layout: Union[str, None] = None, attachments=None, mentions=None, reactions=None, @@ -732,7 +732,7 @@ def __init__( *, data=None, context=None, - command_id: str = None, + command_id: Union[str, None] = None, command_context=None, bot_message_preview_action=None, bot_activity_preview=None, @@ -813,11 +813,11 @@ class MessagingExtensionAttachment(Attachment): def __init__( self, *, - content_type: str = None, - content_url: str = None, + content_type: Union[str, None] = None, + content_url: Union[str, None] = None, content=None, - name: str = None, - thumbnail_url: str = None, + name: Union[str, None] = None, + thumbnail_url: Union[str, None] = None, preview=None, **kwargs ) -> None: @@ -846,7 +846,7 @@ class MessagingExtensionParameter(Model): "value": {"key": "value", "type": "object"}, } - def __init__(self, *, name: str = None, value=None, **kwargs) -> None: + def __init__(self, *, name: Union[str, None] = None, value=None, **kwargs) -> None: super(MessagingExtensionParameter, self).__init__(**kwargs) self.name = name self.value = value @@ -881,10 +881,10 @@ class MessagingExtensionQuery(Model): def __init__( self, *, - command_id: str = None, + command_id: Union[str, None] = None, parameters=None, query_options=None, - state: str = None, + state: Union[str, None] = None, **kwargs ) -> None: super(MessagingExtensionQuery, self).__init__(**kwargs) @@ -908,7 +908,7 @@ class MessagingExtensionQueryOptions(Model): "count": {"key": "count", "type": "int"}, } - def __init__(self, *, skip: int = None, count: int = None, **kwargs) -> None: + def __init__(self, *, skip: Union[int, None] = None, count: Union[int, None] = None, **kwargs) -> None: super(MessagingExtensionQueryOptions, self).__init__(**kwargs) self.skip = skip self.count = count @@ -978,7 +978,7 @@ def __init__( type=None, attachments=None, suggested_actions=None, - text: str = None, + text: Union[str, None] = None, activity_preview=None, **kwargs ) -> None: @@ -1024,9 +1024,9 @@ class NotificationInfo(Model): def __init__( self, *, - alert: bool = None, - alert_in_meeting: bool = None, - external_resource_url: str = None, + alert: Union[bool, None] = None, + alert_in_meeting: Union[bool, None] = None, + external_resource_url: Union[str, None] = None, **kwargs ) -> None: super(NotificationInfo, self).__init__(**kwargs) @@ -1069,10 +1069,10 @@ class O365ConnectorCard(Model): def __init__( self, *, - title: str = None, - text: str = None, - summary: str = None, - theme_color: str = None, + title: Union[str, None] = None, + text: Union[str, None] = None, + summary: Union[str, None] = None, + theme_color: Union[str, None] = None, sections=None, potential_action=None, **kwargs @@ -1115,10 +1115,10 @@ def __init__( self, *, type=None, - id: str = None, - is_required: bool = None, - title: str = None, - value: str = None, + id: Union[str, None] = None, + is_required: Union[bool, None] = None, + title: Union[str, None] = None, + value: Union[str, None] = None, **kwargs ) -> None: super(O365ConnectorCardInputBase, self).__init__(**kwargs) @@ -1148,7 +1148,7 @@ class O365ConnectorCardActionBase(Model): } def __init__( - self, *, type=None, name: str = None, id: str = None, **kwargs + self, *, type=None, name: Union[str, None] = None, id: Union[str, None] = None, **kwargs ) -> None: super(O365ConnectorCardActionBase, self).__init__(**kwargs) self.type = type @@ -1189,8 +1189,8 @@ def __init__( self, *, type=None, - name: str = None, - id: str = None, + name: Union[str, None] = None, + id: Union[str, None] = None, inputs=None, actions=None, **kwargs @@ -1218,7 +1218,7 @@ class O365ConnectorCardActionQuery(Model): "action_id": {"key": "actionId", "type": "str"}, } - def __init__(self, *, body: str = None, actionId: str = None, **kwargs) -> None: + def __init__(self, *, body: Union[str, None] = None, actionId: Union[str, None] = None, **kwargs) -> None: super(O365ConnectorCardActionQuery, self).__init__(**kwargs) self.body = body # This is how it comes in from Teams @@ -1258,11 +1258,11 @@ def __init__( self, *, type=None, - id: str = None, - is_required: bool = None, - title: str = None, - value: str = None, - include_time: bool = None, + id: Union[str, None] = None, + is_required: Union[bool, None] = None, + title: Union[str, None] = None, + value: Union[str, None] = None, + include_time: Union[bool, None] = None, **kwargs ) -> None: super(O365ConnectorCardDateInput, self).__init__( @@ -1290,7 +1290,7 @@ class O365ConnectorCardFact(Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: str = None, value: str = None, **kwargs) -> None: + def __init__(self, *, name: Union[str, None] = None, value: Union[str, None] = None, **kwargs) -> None: super(O365ConnectorCardFact, self).__init__(**kwargs) self.name = name self.value = value @@ -1318,7 +1318,7 @@ class O365ConnectorCardHttpPOST(O365ConnectorCardActionBase): } def __init__( - self, *, type=None, name: str = None, id: str = None, body: str = None, **kwargs + self, *, type=None, name: Union[str, None] = None, id: Union[str, None] = None, body: Union[str, None] = None, **kwargs ) -> None: super(O365ConnectorCardHttpPOST, self).__init__( type=type, name=name, id=id, **kwargs @@ -1340,7 +1340,7 @@ class O365ConnectorCardImage(Model): "title": {"key": "title", "type": "str"}, } - def __init__(self, *, image: str = None, title: str = None, **kwargs) -> None: + def __init__(self, *, image: Union[str, None] = None, title: Union[str, None] = None, **kwargs) -> None: super(O365ConnectorCardImage, self).__init__(**kwargs) self.image = image self.title = title @@ -1391,13 +1391,13 @@ def __init__( self, *, type=None, - id: str = None, - is_required: bool = None, - title: str = None, - value: str = None, + id: Union[str, None] = None, + is_required: Union[bool, None] = None, + title: Union[str, None] = None, + value: Union[str, None] = None, choices=None, style=None, - is_multi_select: bool = None, + is_multi_select: Union[bool, None] = None, **kwargs ) -> None: super(O365ConnectorCardMultichoiceInput, self).__init__( @@ -1427,7 +1427,7 @@ class O365ConnectorCardMultichoiceInputChoice(Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, display: str = None, value: str = None, **kwargs) -> None: + def __init__(self, *, display: Union[str, None] = None, value: Union[str, None] = None, **kwargs) -> None: super(O365ConnectorCardMultichoiceInputChoice, self).__init__(**kwargs) self.display = display self.value = value @@ -1456,7 +1456,7 @@ class O365ConnectorCardOpenUri(O365ConnectorCardActionBase): } def __init__( - self, *, type=None, name: str = None, id: str = None, targets=None, **kwargs + self, *, type=None, name: Union[str, None] = None, id: Union[str, None] = None, targets=None, **kwargs ) -> None: super(O365ConnectorCardOpenUri, self).__init__( type=type, name=name, id=id, **kwargs @@ -1479,7 +1479,7 @@ class O365ConnectorCardOpenUriTarget(Model): "uri": {"key": "uri", "type": "str"}, } - def __init__(self, *, os=None, uri: str = None, **kwargs) -> None: + def __init__(self, *, os=None, uri: Union[str, None] = None, **kwargs) -> None: super(O365ConnectorCardOpenUriTarget, self).__init__(**kwargs) self.os = os self.uri = uri @@ -1538,14 +1538,14 @@ class O365ConnectorCardSection(Model): def __init__( self, *, - title: str = None, - text: str = None, - activity_title: str = None, - activity_subtitle: str = None, - activity_text: str = None, - activity_image: str = None, + title: Union[str, None] = None, + text: Union[str, None] = None, + activity_title: Union[str, None] = None, + activity_subtitle: Union[str, None] = None, + activity_text: Union[str, None] = None, + activity_image: Union[str, None] = None, activity_image_type=None, - markdown: bool = None, + markdown: Union[bool, None] = None, facts=None, images=None, potential_action=None, @@ -1602,11 +1602,11 @@ def __init__( self, *, type=None, - id: str = None, - is_required: bool = None, - title: str = None, - value: str = None, - is_multiline: bool = None, + id: Union[str, None] = None, + is_required: Union[bool, None] = None, + title: Union[str, None] = None, + value: Union[str, None] = None, + is_multiline: Union[bool, None] = None, max_length: float = None, **kwargs ) -> None: @@ -1644,7 +1644,7 @@ class O365ConnectorCardViewAction(O365ConnectorCardActionBase): } def __init__( - self, *, type=None, name: str = None, id: str = None, target=None, **kwargs + self, *, type=None, name: Union[str, None] = None, id: Union[str, None] = None, target=None, **kwargs ) -> None: super(O365ConnectorCardViewAction, self).__init__( type=type, name=name, id=id, **kwargs @@ -1665,7 +1665,7 @@ class SigninStateVerificationQuery(Model): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: str = None, **kwargs) -> None: + def __init__(self, *, state: Union[str, None] = None, **kwargs) -> None: super(SigninStateVerificationQuery, self).__init__(**kwargs) self.state = state @@ -1717,7 +1717,7 @@ class TaskModuleMessageResponse(TaskModuleResponseBase): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: str = None, **kwargs) -> None: + def __init__(self, *, value: Union[str, None] = None, **kwargs) -> None: super(TaskModuleMessageResponse, self).__init__(type="message", **kwargs) self.value = value @@ -1733,7 +1733,7 @@ class TaskModuleRequestContext(Model): "theme": {"key": "theme", "type": "str"}, } - def __init__(self, *, theme: str = None, **kwargs) -> None: + def __init__(self, *, theme: Union[str, None] = None, **kwargs) -> None: super(TaskModuleRequestContext, self).__init__(**kwargs) self.theme = theme @@ -1795,13 +1795,13 @@ class TaskModuleTaskInfo(Model): def __init__( self, *, - title: str = None, + title: Union[str, None] = None, height=None, width=None, - url: str = None, + url: Union[str, None] = None, card=None, - fallback_url: str = None, - completion_bot_id: str = None, + fallback_url: Union[str, None] = None, + completion_bot_id: Union[str, None] = None, **kwargs ) -> None: super(TaskModuleTaskInfo, self).__init__(**kwargs) @@ -1843,12 +1843,12 @@ class TeamDetails(Model): def __init__( self, *, - id: str = None, - name: str = None, - aad_group_id: str = None, - member_count: int = None, - channel_count: int = None, - type: str = None, + id: Union[str, None] = None, + name: Union[str, None] = None, + aad_group_id: Union[str, None] = None, + member_count: Union[int, None] = None, + channel_count: Union[int, None] = None, + type: Union[str, None] = None, **kwargs ) -> None: super(TeamDetails, self).__init__(**kwargs) @@ -1878,7 +1878,7 @@ class TeamInfo(Model): } def __init__( - self, *, id: str = None, name: str = None, aad_group_id: str = None, **kwargs + self, *, id: Union[str, None] = None, name: Union[str, None] = None, aad_group_id: Union[str, None] = None, **kwargs ) -> None: super(TeamInfo, self).__init__(**kwargs) self.id = id @@ -1923,14 +1923,14 @@ class TeamsChannelAccount(ChannelAccount): def __init__( self, *, - id: str = None, - name: str = None, - given_name: str = None, - surname: str = None, - email: str = None, - user_principal_name: str = None, - tenant_id: str = None, - user_role: str = None, + id: Union[str, None] = None, + name: Union[str, None] = None, + given_name: Union[str, None] = None, + surname: Union[str, None] = None, + email: Union[str, None] = None, + user_principal_name: Union[str, None] = None, + tenant_id: Union[str, None] = None, + user_role: Union[str, None] = None, **kwargs ) -> None: super(TeamsChannelAccount, self).__init__(id=id, name=name, **kwargs) @@ -1959,7 +1959,7 @@ class TeamsPagedMembersResult(PagedMembersResult): def __init__( self, *, - continuation_token: str = None, + continuation_token: Union[str, None] = None, members: List[TeamsChannelAccount] = None, **kwargs ) -> None: @@ -2027,7 +2027,7 @@ def __init__( self, *, channel=None, - event_type: str = None, + event_type: Union[str, None] = None, team=None, notification=None, tenant=None, @@ -2059,7 +2059,7 @@ class TenantInfo(Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str = None, **kwargs) -> None: + def __init__(self, *, id: Union[str, None] = None, **kwargs) -> None: super(TenantInfo, self).__init__(**kwargs) self.id = id @@ -2075,7 +2075,7 @@ class TeamsMeetingInfo(Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str = None, **kwargs) -> None: + def __init__(self, *, id: Union[str, None] = None, **kwargs) -> None: super(TeamsMeetingInfo, self).__init__(**kwargs) self.id = id @@ -2094,7 +2094,7 @@ class MeetingParticipantInfo(Model): "in_meeting": {"key": "inMeeting", "type": "bool"}, } - def __init__(self, *, role: str = None, in_meeting: bool = None, **kwargs) -> None: + def __init__(self, *, role: Union[str, None] = None, in_meeting: Union[bool, None] = None, **kwargs) -> None: super(MeetingParticipantInfo, self).__init__(**kwargs) self.role = role self.in_meeting = in_meeting @@ -2433,7 +2433,7 @@ class MeetingDetailsBase(Model): } def __init__( - self, *, id: str = None, join_url: str = None, title: str = None, **kwargs + self, *, id: Union[str, None] = None, join_url: Union[str, None] = None, title: Union[str, None] = None, **kwargs ) -> None: super(MeetingDetailsBase, self).__init__(**kwargs) self.id = id @@ -2464,10 +2464,10 @@ class MeetingDetails(MeetingDetailsBase): def __init__( self, *, - ms_graph_resource_id: str = None, - scheduled_start_time: str = None, - scheduled_end_time: str = None, - type: str = None, + ms_graph_resource_id: Union[str, None] = None, + scheduled_start_time: Union[str, None] = None, + scheduled_end_time: Union[str, None] = None, + type: Union[str, None] = None, **kwargs ) -> None: super(MeetingDetails, self).__init__(**kwargs) @@ -2517,7 +2517,7 @@ class MeetingEventDetails(MeetingDetailsBase): _attribute_map = {"meeting_type": {"key": "MeetingType", "type": "str"}} - def __init__(self, *, meeting_type: str = None, **kwargs): + def __init__(self, *, meeting_type: Union[str, None] = None, **kwargs): super(MeetingEventDetails, self).__init__(**kwargs) self.meeting_type = meeting_type @@ -2531,7 +2531,7 @@ class MeetingStartEventDetails(MeetingDetailsBase): _attribute_map = {"start_time": {"key": "StartTime", "type": "str"}} - def __init__(self, *, start_time: str = None, **kwargs): + def __init__(self, *, start_time: Union[str, None] = None, **kwargs): super(MeetingStartEventDetails, self).__init__(**kwargs) self.start_time = start_time @@ -2545,7 +2545,7 @@ class MeetingEndEventDetails(MeetingDetailsBase): _attribute_map = {"end_time": {"key": "EndTime", "type": "str"}} - def __init__(self, *, end_time: str = None, **kwargs): + def __init__(self, *, end_time: Union[str, None] = None, **kwargs): super(MeetingEndEventDetails, self).__init__(**kwargs) self.end_time = end_time @@ -2564,7 +2564,7 @@ class UserMeetingDetails(Model): "in_meeting": {"key": "inMeeting", "type": "bool"}, } - def __init__(self, *, role: str = None, in_meeting: bool = None, **kwargs) -> None: + def __init__(self, *, role: Union[str, None] = None, in_meeting: Union[bool, None] = None, **kwargs) -> None: super(UserMeetingDetails, self).__init__(**kwargs) self.in_meeting = in_meeting self.role = role @@ -2623,7 +2623,7 @@ class ReadReceiptInfo(Model): "last_read_message_id": {"key": "lastReadMessageId", "type": "str"}, } - def __init__(self, *, last_read_message_id: str = None, **kwargs) -> None: + def __init__(self, *, last_read_message_id: Union[str, None] = None, **kwargs) -> None: super(ReadReceiptInfo, self).__init__(**kwargs) self.last_read_message_id = last_read_message_id @@ -2694,7 +2694,7 @@ class ConfigResponseBase(Model): "response_type": {"key": "responseType", "type": "str"}, } - def __init__(self, *, response_type: str = None, **kwargs) -> None: + def __init__(self, *, response_type: Union[str, None] = None, **kwargs) -> None: super(ConfigResponseBase, self).__init__(**kwargs) self.response_type = response_type @@ -2768,8 +2768,8 @@ def __init__( *, item_id: int = 0, mention_type: str = "person", - mri: str = None, - display_name: str = None, + mri: Union[str, None] = None, + display_name: Union[str, None] = None, **kwargs ) -> None: super(OnBehalfOf, self).__init__(**kwargs) @@ -2824,7 +2824,7 @@ class MeetingNotificationBase(Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: str = None, **kwargs) -> None: + def __init__(self, *, type: Union[str, None] = None, **kwargs) -> None: super(MeetingNotificationBase, self).__init__(**kwargs) self.type = type @@ -2883,9 +2883,9 @@ class MeetingNotificationRecipientFailureInfo(Model): def __init__( self, *, - recipient_mri: str = None, - error_code: str = None, - failure_reason: str = None, + recipient_mri: Union[str, None] = None, + error_code: Union[str, None] = None, + failure_reason: Union[str, None] = None, **kwargs ): super(MeetingNotificationRecipientFailureInfo, self).__init__(**kwargs) @@ -2974,7 +2974,7 @@ class MeetingTabIconSurface(Surface): "tab_entity_id": {"key": "tabEntityId", "type": "str"}, } - def __init__(self, *, tab_entity_id: str = None, **kwargs): + def __init__(self, *, tab_entity_id: Union[str, None] = None, **kwargs): super(MeetingTabIconSurface, self).__init__( SurfaceType.MeetingTabIcon, **kwargs ) diff --git a/libraries/botframework-connector/botframework/connector/http_request.py b/libraries/botframework-connector/botframework/connector/http_request.py index de9f2db6b..8bd54fd22 100644 --- a/libraries/botframework-connector/botframework/connector/http_request.py +++ b/libraries/botframework-connector/botframework/connector/http_request.py @@ -1,14 +1,14 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from typing import Any, Dict +from typing import Any, Dict, Union class HttpRequest: def __init__( self, *, - request_uri: str = None, + request_uri: Union[str, None] = None, content: Any = None, headers: Dict[str, str] = None ) -> None: diff --git a/libraries/botframework-connector/tests/test_auth.py b/libraries/botframework-connector/tests/test_auth.py index cc3abf66a..302ebcf75 100644 --- a/libraries/botframework-connector/tests/test_auth.py +++ b/libraries/botframework-connector/tests/test_auth.py @@ -31,7 +31,7 @@ async def jwt_token_validation_validate_auth_header_with_channel_service_succeed app_id: str, pwd: str, channel_service_or_provider: Union[str, ChannelProvider], - header: str = None, + header: Union[str, None] = None, ): if header is None: header = f"Bearer {MicrosoftAppCredentials(app_id, pwd).get_access_token()}"