From f31fdd00ef461112f31d635e06450889fa458f68 Mon Sep 17 00:00:00 2001 From: Axel Suarez Date: Wed, 3 Jul 2019 13:22:10 -0700 Subject: [PATCH] removed unnecessary properties and a couple of style fixes --- .../botbuilder/ai/luis/intent_score.py | 48 +--- .../botbuilder/ai/luis/luis_application.py | 72 +----- .../ai/luis/luis_prediction_options.py | 241 +----------------- .../botbuilder/ai/luis/luis_recognizer.py | 46 +--- .../botbuilder/ai/luis/recognizer_result.py | 123 +-------- .../botbuilder/ai/qna/qnamaker.py | 46 +--- .../botbuilder/core/bot_state.py | 21 +- .../botbuilder/core/state_property_info.py | 2 +- .../botbuilder/dialogs/choices/choice.py | 68 +---- .../dialogs/choices/choice_factory_options.py | 105 +------- .../botbuilder/dialogs/component_dialog.py | 21 +- .../botbuilder/dialogs/dialog_context.py | 20 -- .../botbuilder/dialogs/dialog_instance.py | 47 +--- .../botbuilder/dialogs/dialog_state.py | 2 +- .../dialogs/prompts/datetime_prompt.py | 16 +- .../dialogs/prompts/number_prompt.py | 18 +- 16 files changed, 44 insertions(+), 852 deletions(-) diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/intent_score.py b/libraries/botbuilder-ai/botbuilder/ai/luis/intent_score.py index 7e175046e..059688b44 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/intent_score.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/intent_score.py @@ -10,49 +10,5 @@ class IntentScore(object): """ def __init__(self, score: float = None, properties: Dict[str, object] = {}): - self._score: float = score - self._properties: Dict[str, object] = properties - - @property - def score(self) -> float: - """Gets confidence in an intent. - - :return: Confidence in an intent. - :rtype: float - """ - - return self._score - - @score.setter - def score(self, value: float) -> None: - """Sets confidence in an intent. - - :param value: Confidence in an intent. - :type value: float - :return: - :rtype: None - """ - - self._score = value - - @property - def properties(self) -> Dict[str, object]: - """Gets any extra properties to include in the results. - - :return: Any extra properties to include in the results. - :rtype: Dict[str, object] - """ - - return self._properties - - @properties.setter - def properties(self, value: Dict[str, object]) -> None: - """Sets any extra properties to include in the results. - - :param value: Any extra properties to include in the results. - :type value: Dict[str, object] - :return: - :rtype: None - """ - - self._properties = value + self.score: float = score + self.properties: Dict[str, object] = properties diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_application.py b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_application.py index 4f77cb5bd..364b9924e 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_application.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_application.py @@ -41,9 +41,9 @@ def __init__(self, application_id: str, endpoint_key: str, endpoint: str): if not valid: raise ValueError(f'"{endpoint}" is not a valid LUIS endpoint.') - self._application_id = application_id - self._endpoint_key = endpoint_key - self._endpoint = endpoint + self.application_id = application_id + self.endpoint_key = endpoint_key + self.endpoint = endpoint @classmethod def from_application_endpoint(cls, application_endpoint: str): @@ -59,72 +59,6 @@ def from_application_endpoint(cls, application_endpoint: str): ) return cls(application_id, endpoint_key, endpoint) - @property - def application_id(self) -> str: - """Gets LUIS application ID. - - :return: LUIS application ID. - :rtype: str - """ - - return self._application_id - - @application_id.setter - def application_id(self, value: str) -> None: - """Sets LUIS application ID. - - :param value: LUIS application ID. - :type value: str - :return: - :rtype: None - """ - - self._application_id = value - - @property - def endpoint_key(self) -> str: - """Gets LUIS subscription or endpoint key. - - :return: LUIS subscription or endpoint key. - :rtype: str - """ - - return self._endpoint_key - - @endpoint_key.setter - def endpoint_key(self, value: str) -> None: - """Sets LUIS subscription or endpoint key. - - :param value: LUIS subscription or endpoint key. - :type value: str - :return: - :rtype: None - """ - - self._endpoint_key = value - - @property - def endpoint(self) -> str: - """Gets LUIS endpoint like https://westus.api.cognitive.microsoft.com. - - :return: LUIS endpoint where application is hosted. - :rtype: str - """ - - return self._endpoint - - @endpoint.setter - def endpoint(self, value: str) -> None: - """Sets LUIS endpoint like https://westus.api.cognitive.microsoft.com. - - :param value: LUIS endpoint where application is hosted. - :type value: str - :return: - :rtype: None - """ - - self._endpoint = value - @staticmethod def _parse(application_endpoint: str) -> Tuple[str, str, str]: url, valid = LuisApplication._try_parse_url(application_endpoint) diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_prediction_options.py b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_prediction_options.py index 6d54a0ba8..8dd350f1b 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_prediction_options.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_prediction_options.py @@ -22,234 +22,13 @@ def __init__( telemetry_client: BotTelemetryClient = NullTelemetryClient(), log_personal_information: bool = False, ): - self._bing_spell_check_subscription_key: str = bing_spell_check_subscription_key - self._include_all_intents: bool = include_all_intents - self._include_instance_data: bool = include_instance_data - self._log: bool = log - self._spell_check: bool = spell_check - self._staging: bool = staging - self._timeout: float = timeout - self._timezone_offset: float = timezone_offset - self._telemetry_client: BotTelemetryClient = telemetry_client - self._log_personal_information: bool = log_personal_information - - @property - def bing_spell_check_subscription_key(self) -> str: - """Gets the Bing Spell Check subscription key. - - :return: The Bing Spell Check subscription key. - :rtype: str - """ - - return self._bing_spell_check_subscription_key - - @bing_spell_check_subscription_key.setter - def bing_spell_check_subscription_key(self, value: str) -> None: - """Sets the Bing Spell Check subscription key. - - :param value: The Bing Spell Check subscription key. - :type value: str - :return: - :rtype: None - """ - - self._bing_spell_check_subscription_key = value - - @property - def include_all_intents(self) -> bool: - """Gets whether all intents come back or only the top one. - - :return: True for returning all intents. - :rtype: bool - """ - - return self._include_all_intents - - @include_all_intents.setter - def include_all_intents(self, value: bool) -> None: - """Sets whether all intents come back or only the top one. - - :param value: True for returning all intents. - :type value: bool - :return: - :rtype: None - """ - - self._include_all_intents = value - - @property - def include_instance_data(self) -> bool: - """Gets a value indicating whether or not instance data should be included in response. - - :return: A value indicating whether or not instance data should be included in response. - :rtype: bool - """ - - return self._include_instance_data - - @include_instance_data.setter - def include_instance_data(self, value: bool) -> None: - """Sets a value indicating whether or not instance data should be included in response. - - :param value: A value indicating whether or not instance data should be included in response. - :type value: bool - :return: - :rtype: None - """ - - self._include_instance_data = value - - @property - def log(self) -> bool: - """Gets if queries should be logged in LUIS. - - :return: If queries should be logged in LUIS. - :rtype: bool - """ - - return self._log - - @log.setter - def log(self, value: bool) -> None: - """Sets if queries should be logged in LUIS. - - :param value: If queries should be logged in LUIS. - :type value: bool - :return: - :rtype: None - """ - - self._log = value - - @property - def spell_check(self) -> bool: - """Gets whether to spell check queries. - - :return: Whether to spell check queries. - :rtype: bool - """ - - return self._spell_check - - @spell_check.setter - def spell_check(self, value: bool) -> None: - """Sets whether to spell check queries. - - :param value: Whether to spell check queries. - :type value: bool - :return: - :rtype: None - """ - - self._spell_check = value - - @property - def staging(self) -> bool: - """Gets whether to use the staging endpoint. - - :return: Whether to use the staging endpoint. - :rtype: bool - """ - - return self._staging - - @staging.setter - def staging(self, value: bool) -> None: - """Sets whether to use the staging endpoint. - - - :param value: Whether to use the staging endpoint. - :type value: bool - :return: - :rtype: None - """ - - self._staging = value - - @property - def timeout(self) -> float: - """Gets the time in milliseconds to wait before the request times out. - - :return: The time in milliseconds to wait before the request times out. Default is 100000 milliseconds. - :rtype: float - """ - - return self._timeout - - @timeout.setter - def timeout(self, value: float) -> None: - """Sets the time in milliseconds to wait before the request times out. - - :param value: The time in milliseconds to wait before the request times out. Default is 100000 milliseconds. - :type value: float - :return: - :rtype: None - """ - - self._timeout = value - - @property - def timezone_offset(self) -> float: - """Gets the time zone offset. - - :return: The time zone offset. - :rtype: float - """ - - return self._timezone_offset - - @timezone_offset.setter - def timezone_offset(self, value: float) -> None: - """Sets the time zone offset. - - :param value: The time zone offset. - :type value: float - :return: - :rtype: None - """ - - self._timezone_offset = value - - @property - def telemetry_client(self) -> BotTelemetryClient: - """Gets the BotTelemetryClient used to log the LuisResult event. - - :return: The client used to log telemetry events. - :rtype: BotTelemetryClient - """ - - return self._telemetry_client - - @telemetry_client.setter - def telemetry_client(self, value: BotTelemetryClient) -> None: - """Sets the BotTelemetryClient used to log the LuisResult event. - - :param value: The client used to log telemetry events. - :type value: BotTelemetryClient - :return: - :rtype: None - """ - - self._telemetry_client = value - - @property - def log_personal_information(self) -> bool: - """Gets a value indicating whether to log personal information that came from the user to telemetry. - - :return: If true, personal information is logged to Telemetry; otherwise the properties will be filtered. - :rtype: bool - """ - - return self._log_personal_information - - @log_personal_information.setter - def log_personal_information(self, value: bool) -> None: - """Sets a value indicating whether to log personal information that came from the user to telemetry. - - :param value: If true, personal information is logged to Telemetry; otherwise the properties will be filtered. - :type value: bool - :return: - :rtype: None - """ - - self.log_personal_information = value + self.bing_spell_check_subscription_key: str = bing_spell_check_subscription_key + self.include_all_intents: bool = include_all_intents + self.include_instance_data: bool = include_instance_data + self.log: bool = log + self.spell_check: bool = spell_check + self.staging: bool = staging + self.timeout: float = timeout + self.timezone_offset: float = timezone_offset + self.telemetry_client: BotTelemetryClient = telemetry_client + self.log_personal_information: bool = log_personal_information diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py index a432178e8..71c48d7a1 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer.py @@ -68,56 +68,14 @@ def __init__( self._include_api_results = include_api_results - self._telemetry_client = self._options.telemetry_client - self._log_personal_information = self._options.log_personal_information + self.telemetry_client = self._options.telemetry_client + self.log_personal_information = self._options.log_personal_information credentials = CognitiveServicesCredentials(self._application.endpoint_key) self._runtime = LUISRuntimeClient(self._application.endpoint, credentials) self._runtime.config.add_user_agent(LuisUtil.get_user_agent()) self._runtime.config.connection.timeout = self._options.timeout // 1000 - @property - def log_personal_information(self) -> bool: - """Gets a value indicating whether to log personal information that came from the user to telemetry. - - :return: If True, personal information is logged to Telemetry; otherwise the properties will be filtered. - :rtype: bool - """ - - return self._log_personal_information - - @log_personal_information.setter - def log_personal_information(self, value: bool) -> None: - """Sets a value indicating whether to log personal information that came from the user to telemetry. - - :param value: If True, personal information is logged to Telemetry; otherwise the properties will be filtered. - :type value: bool - :return: - :rtype: None - """ - - self._log_personal_information = value - - @property - def telemetry_client(self) -> BotTelemetryClient: - """Gets the currently configured that logs the LuisResult event. - - :return: The being used to log events. - :rtype: BotTelemetryClient - """ - - return self._telemetry_client - - @telemetry_client.setter - def telemetry_client(self, value: BotTelemetryClient): - """Gets the currently configured that logs the LuisResult event. - - :param value: The being used to log events. - :type value: BotTelemetryClient - """ - - self._telemetry_client = value - @staticmethod def top_intent( results: RecognizerResult, default_intent: str = "None", min_score: float = 0.0 diff --git a/libraries/botbuilder-ai/botbuilder/ai/luis/recognizer_result.py b/libraries/botbuilder-ai/botbuilder/ai/luis/recognizer_result.py index 32da809e4..d6aef5516 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/luis/recognizer_result.py +++ b/libraries/botbuilder-ai/botbuilder/ai/luis/recognizer_result.py @@ -25,124 +25,11 @@ def __init__( intents: Dict[str, IntentScore] = None, entities: Dict[str, object] = None, ): - self._text: str = text - self._altered_text: str = altered_text - self._intents: Dict[str, IntentScore] = intents - self._entities: Dict[str, object] = entities - self._properties: Dict[str, object] = {} - - @property - def text(self) -> str: - """Gets the input text to recognize. - - :return: Original text to recognizer. - :rtype: str - """ - - return self._text - - @text.setter - def text(self, value: str) -> None: - """Sets the input text to recognize. - - :param value: Original text to recognizer. - :type value: str - :return: - :rtype: None - """ - - self._text = value - - @property - def altered_text(self) -> str: - """Gets the input text as modified by the recognizer, for example for spelling correction. - - :return: Text modified by recognizer. - :rtype: str - """ - - return self._altered_text - - @altered_text.setter - def altered_text(self, value: str) -> None: - """Sets the input text as modified by the recognizer, for example for spelling correction. - - :param value: Text modified by recognizer. - :type value: str - :return: - :rtype: None - """ - - self._altered_text = value - - @property - def intents(self) -> Dict[str, IntentScore]: - """Gets the recognized intents, with the intent as key and the confidence as value. - - :return: Mapping from intent to information about the intent. - :rtype: Dict[str, IntentScore] - """ - - return self._intents - - @intents.setter - def intents(self, value: Dict[str, IntentScore]) -> None: - """Sets the recognized intents, with the intent as key and the confidence as value. - - - :param value: Mapping from intent to information about the intent. - :type value: Dict[str, IntentScore] - :return: - :rtype: None - """ - - self._intents = value - - @property - def entities(self) -> Dict[str, object]: - """Gets the recognized top-level entities. - - :return: Object with each top-level recognized entity as a key. - :rtype: Dict[str, object] - """ - - return self._entities - - @entities.setter - def entities(self, value: Dict[str, object]) -> None: - """Sets the recognized top-level entities. - - :param value: Object with each top-level recognized entity as a key. - :type value: Dict[str, object] - :return: - :rtype: None - """ - - self._entities = value - - @property - def properties(self) -> Dict[str, object]: - """Gets properties that are not otherwise defined by the type but that - might appear in the REST JSON object. - - :return: The extended properties for the object. - :rtype: Dict[str, object] - """ - - return self._properties - - @properties.setter - def properties(self, value: Dict[str, object]) -> None: - """Sets properties that are not otherwise defined by the type but that - might appear in the REST JSON object. - - :param value: The extended properties for the object. - :type value: Dict[str, object] - :return: - :rtype: None - """ - - self._properties = value + self.text: str = text + self.altered_text: str = altered_text + self.intents: Dict[str, IntentScore] = intents + self.entities: Dict[str, object] = entities + self.properties: Dict[str, object] = {} def get_top_scoring_intent(self) -> TopIntent: """Return the top scoring intent and its score. diff --git a/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py b/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py index 8c3a09a43..35f43197b 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py +++ b/libraries/botbuilder-ai/botbuilder/ai/qna/qnamaker.py @@ -55,50 +55,8 @@ def __init__( instance_timeout = ClientTimeout(total=self._options.timeout/1000) self._req_client = http_client or ClientSession(timeout=instance_timeout) - self._telemetry_client: Union[BotTelemetryClient, NullTelemetryClient] = telemetry_client or NullTelemetryClient() - self._log_personal_information = log_personal_information or False - - @property - def log_personal_information(self) -> bool: - """Gets a value indicating whether to log personal information that came from the user to telemetry. - - :return: If True, personal information is logged to Telemetry; otherwise the properties will be filtered. - :rtype: bool - """ - - return self._log_personal_information - - @log_personal_information.setter - def log_personal_information(self, value: bool) -> None: - """Sets a value indicating whether to log personal information that came from the user to telemetry. - - :param value: If True, personal information is logged to Telemetry; otherwise the properties will be filtered. - :type value: bool - :return: - :rtype: None - """ - - self._log_personal_information = value - - @property - def telemetry_client(self) -> BotTelemetryClient: - """Gets the currently configured BotTelemetryClient that logs the event. - - :return: The BotTelemetryClient being used to log events. - :rtype: BotTelemetryClient - """ - - return self._telemetry_client - - @telemetry_client.setter - def telemetry_client(self, value: BotTelemetryClient): - """Sets the currently configured BotTelemetryClient that logs the event. - - :param value: The BotTelemetryClient being used to log events. - :type value: BotTelemetryClient - """ - - self._telemetry_client = value + self.telemetry_client: Union[BotTelemetryClient, NullTelemetryClient] = telemetry_client or NullTelemetryClient() + self.log_personal_information = log_personal_information or False async def on_qna_result( self, diff --git a/libraries/botbuilder-core/botbuilder/core/bot_state.py b/libraries/botbuilder-core/botbuilder/core/bot_state.py index 53a45ff64..dc95da298 100644 --- a/libraries/botbuilder-core/botbuilder/core/bot_state.py +++ b/libraries/botbuilder-core/botbuilder/core/bot_state.py @@ -16,27 +16,12 @@ class CachedBotState: Internal cached bot state. """ def __init__(self, state: Dict[str, object] = None) : - self._state = state if state != None else {} - self._hash = self.compute_hash(state) - - @property - def state(self) -> Dict[str, object]: - return self._state - @state.setter - def state(self, state: Dict[str, object]): - self._state = self._state - - @property - def hash(self) -> str: - return self._hash - - @hash.setter - def hash(self, hash: str): - self._hash = hash + self.state = state if state is not None else {} + self.hash = self.compute_hash(state) @property def is_changed(self) -> bool: - return self.hash != self.compute_hash(self._state) + return self.hash != self.compute_hash(self.state) def compute_hash(self, obj: object) -> str: # TODO: Should this be compatible with C# JsonConvert.SerializeObject ? diff --git a/libraries/botbuilder-core/botbuilder/core/state_property_info.py b/libraries/botbuilder-core/botbuilder/core/state_property_info.py index d63277578..5a83a4a2b 100644 --- a/libraries/botbuilder-core/botbuilder/core/state_property_info.py +++ b/libraries/botbuilder-core/botbuilder/core/state_property_info.py @@ -6,4 +6,4 @@ class StatePropertyInfo(ABC): @property def name(self): - raise NotImplementedError(); \ No newline at end of file + raise NotImplementedError() \ No newline at end of file diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py index 663f8b43e..175042f0e 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py @@ -10,68 +10,6 @@ class Choice(object): def __init__( self, value: str = None, action: CardAction = None, synonyms: List[str] = None ): - self._value: str = value - self._action: CardAction = action - self._synonyms: List[str] = synonyms - - @property - def value(self) -> str: - """Gets the value to return when selected. - - :return: The value to return when selected. - :rtype: str - """ - return self._value - - @value.setter - def value(self, value: str) -> None: - """Sets the value to return when selected. - - :param value: The value to return when selected. - :type value: str - :return: - :rtype: None - """ - self._value = value - - @property - def action(self) -> CardAction: - """Gets the action to use when rendering the choice as a suggested action or hero card. - This is optional. - - :return: The action to use when rendering the choice as a suggested action or hero card. - :rtype: CardAction - """ - return self._action - - @action.setter - def action(self, value: CardAction) -> None: - """Sets the action to use when rendering the choice as a suggested action or hero card. - This is optional. - - :param value: The action to use when rendering the choice as a suggested action or hero card. - :type value: CardAction - :return: - :rtype: None - """ - self._action = value - - @property - def synonyms(self) -> List[str]: - """Gets the list of synonyms to recognize in addition to the value. This is optional. - - :return: The list of synonyms to recognize in addition to the value. - :rtype: List[str] - """ - return self._synonyms - - @synonyms.setter - def synonyms(self, value: List[str]) -> None: - """Sets the list of synonyms to recognize in addition to the value. This is optional. - - :param value: The list of synonyms to recognize in addition to the value. - :type value: List[str] - :return: - :rtype: None - """ - self._synonyms = value + self.value: str = value + self.action: CardAction = action + self.synonyms: List[str] = synonyms 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 5b4ce1537..fc9133e8a 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory_options.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory_options.py @@ -27,104 +27,7 @@ def __init__( :rtype: None """ - self._inline_separator = inline_separator - self._inline_or = inline_or - self._inline_or_more = inline_or_more - self._include_numbers = include_numbers - - @property - def inline_separator(self) -> str: - """ - Gets the character used to separate individual choices when there are more than 2 choices. - The default value is `", "`. This is optional. - - Returns: - str: The character used to separate individual choices when there are more than 2 choices. - """ - - return self._inline_separator - - @inline_separator.setter - def inline_separator(self, value: str) -> None: - """Sets the character used to separate individual choices when there are more than 2 choices. - The default value is `", "`. This is optional. - - :param value: The character used to separate individual choices when there are more than 2 choices. - :type value: str - :return: - :rtype: None - """ - - self._inline_separator = value - - @property - def inline_or(self) -> str: - """Gets the separator inserted between the choices when their are only 2 choices. The default - value is `" or "`. This is optional. - - :return: The separator inserted between the choices when their are only 2 choices. - :rtype: str - """ - - return self._inline_or - - @inline_or.setter - def inline_or(self, value: str) -> None: - """Sets the separator inserted between the choices when their are only 2 choices. The default - value is `" or "`. This is optional. - - :param value: The separator inserted between the choices when their are only 2 choices. - :type value: str - :return: - :rtype: None - """ - - self._inline_or = value - - @property - def inline_or_more(self) -> str: - """Gets the separator inserted between the last 2 choices when their are more than 2 choices. - The default value is `", or "`. This is optional. - - :return: The separator inserted between the last 2 choices when their are more than 2 choices. - :rtype: str - """ - return self._inline_or_more - - @inline_or_more.setter - def inline_or_more(self, value: str) -> None: - """Sets the separator inserted between the last 2 choices when their are more than 2 choices. - The default value is `", or "`. This is optional. - - :param value: The separator inserted between the last 2 choices when their are more than 2 choices. - :type value: str - :return: - :rtype: None - """ - - self._inline_or_more = value - - @property - def include_numbers(self) -> bool: - """Gets a value indicating whether an inline and list style choices will be prefixed with the index of the - choice as in "1. choice". If , the list style will use a bulleted list instead.The default value is . - - :return: A trueif an inline and list style choices will be prefixed with the index of the - choice as in "1. choice"; otherwise a false and the list style will use a bulleted list instead. - :rtype: bool - """ - return self._include_numbers - - @include_numbers.setter - def include_numbers(self, value: bool) -> None: - """Sets a value indicating whether an inline and list style choices will be prefixed with the index of the - choice as in "1. choice". If , the list style will use a bulleted list instead.The default value is . - - :param value: A trueif an inline and list style choices will be prefixed with the index of the - choice as in "1. choice"; otherwise a false and the list style will use a bulleted list instead. - :type value: bool - :return: - :rtype: None - """ - - self._include_numbers = value + self.inline_separator = inline_separator + self.inline_or = inline_or + self.inline_or_more = inline_or_more + self.include_numbers = include_numbers diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/component_dialog.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/component_dialog.py index cfa30aca2..7f1e7cdb6 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/component_dialog.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/component_dialog.py @@ -26,29 +26,10 @@ def __init__(self, dialog_id: str): raise TypeError('ComponentDialog(): dialog_id cannot be None.') self._dialogs = DialogSet() - self._initial_dialog_id = None + self.initial_dialog_id = None # TODO: Add TelemetryClient - - @property - def initial_dialog_id(self) -> str: - """Gets the ID of the initial dialog id. - - :param: - :return str:ID of the dialog this instance is for. - """ - return self._initial_dialog_id - - @initial_dialog_id.setter - def initial_dialog_id(self, value: str) -> None: - """Sets the ID of the initial dialog id. - - :param value: ID of the dialog this instance is for. - :return: - """ - self._initial_dialog_id = value - async def begin_dialog(self, outer_dc: DialogContext, options: object = None) -> DialogTurnResult: if outer_dc is None: raise TypeError('ComponentDialog.begin_dialog(): outer_dc cannot be None.') diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py index 3eb6dcd8e..ee08ba2bc 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_context.py @@ -50,26 +50,6 @@ def stack(self): """ return self._stack - @property - def parent(self) -> 'DialogContext': - """ - Gets the parent DialogContext if any. Used when searching for dialogs to start. - - :param: - :return The parent DialogContext: - """ - return self._parent - - @parent.setter - def parent(self, parent_dialog_context: object): - """ - Sets the parent DialogContext if any. Used when searching for dialogs to start. - - :param parent_dialog_context: The parent dialog context - :return str: - """ - self._parent = parent_dialog_context - @property def active_dialog(self): diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py index 128837d54..fdf04035e 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_instance.py @@ -10,51 +10,12 @@ class DialogInstance: """ def __init__(self): - self._id: str = None - self._state: Dict[str, object] = {} - - @property - def id(self) -> str: - """Gets the ID of the dialog this instance is for. - - :param: - :return str: - """ - return self._id - - @id.setter - def id(self, value: str) -> None: - """Sets the ID of the dialog this instance is for. - - :param: - :param value: ID of the dialog this instance is for. - :return: - """ - self._id = value - - @property - def state(self) -> Dict[str, object]: - """Gets the instance's persisted state. - - :param: - :return Dict[str, object]: - """ - return self._state - - @state.setter - def state(self, value: Dict[str, object]) -> None: - """Sets the instance's persisted state. - - :param: - :param value: The instance's persisted state. - :return: - """ - - self._state = value + self.id: str = None + self.state: Dict[str, object] = {} def __str__(self): result = "\ndialog_instance_id: %s\n" % self.id - if not self._state is None: - for key, value in self._state.items(): + if not self.state is None: + for key, value in self.state.items(): result += " {} ({})\n".format(key, str(value)) return result \ No newline at end of file diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_state.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_state.py index 0c47a2c76..14a8fd17c 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_state.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_state.py @@ -6,7 +6,7 @@ class DialogState(): def __init__(self, stack: List[DialogInstance] = None): - if stack == None: + if stack is None: self._dialog_stack = [] else: self._dialog_stack = stack diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_prompt.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_prompt.py index 20dc75c2b..c5f105599 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_prompt.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/datetime_prompt.py @@ -12,21 +12,7 @@ class DateTimePrompt(Prompt): def __init__(self, dialog_id: str, validator: object = None, default_locale: str = None): super(DateTimePrompt, self).__init__(dialog_id, validator) - self._default_locale = default_locale - - @property - def default_locale(self) -> str: - """Gets the locale used if `TurnContext.activity.locale` is not specified. - """ - return self._default_locale - - @default_locale.setter - def default_locale(self, value: str) -> None: - """Gets the locale used if `TurnContext.activity.locale` is not specified. - - :param value: The locale used if `TurnContext.activity.locale` is not specified. - """ - self._default_locale = value + self.default_locale = default_locale async def on_prompt(self, turn_context: TurnContext, state: Dict[str, object], options: PromptOptions, is_retry: bool): if not turn_context: diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py index 6ef1c292d..953f2bb1e 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/number_prompt.py @@ -13,22 +13,8 @@ class NumberPrompt(Prompt): # TODO: PromptValidator def __init__(self, dialog_id: str, validator: object, default_locale: str): - super(ConfirmPrompt, self).__init__(dialog_id, validator) - self._default_locale = default_locale - - @property - def default_locale(self) -> str: - """Gets the locale used if `TurnContext.activity.locale` is not specified. - """ - return self._default_locale - - @default_locale.setter - def default_locale(self, value: str) -> None: - """Gets the locale used if `TurnContext.activity.locale` is not specified. - - :param value: The locale used if `TurnContext.activity.locale` is not specified. - """ - self._default_locale = value + super(NumberPrompt, self).__init__(dialog_id, validator) + self.default_locale = default_locale async def on_prompt(self, turn_context: TurnContext, state: Dict[str, object], options: PromptOptions, is_retry: bool):