Skip to content

Fix optional typing issue #2211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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__
)
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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 = {}

Original file line number Diff line number Diff line change
@@ -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,
):
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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 = "",
Loading