diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_operations.py index cb3e0fe4d804..2fe6e639ad62 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_operations.py @@ -299,9 +299,6 @@ def analyze_conversation(self, task: Union[JSON, IO[bytes]], **kwargs: Any) -> J :param task: A single conversational task to execute. Is either a JSON type or a IO[bytes] type. Required. :type task: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -550,13 +547,6 @@ def begin_conversation_analysis( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -675,13 +665,6 @@ def begin_conversation_analysis( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -783,16 +766,6 @@ def begin_conversation_analysis(self, task: Union[JSON, IO[bytes]], **kwargs: An :param task: Collection of conversations to analyze and one or more tasks to execute. Is either a JSON type or a IO[bytes] type. Required. :type task: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_serialization.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_serialization.py index baa661cb82d2..2f781d740827 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_serialization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1370,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_operations.py index f9dd37e3a744..1f8caff744c3 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_operations.py @@ -253,9 +253,6 @@ async def analyze_conversation(self, task: Union[JSON, IO[bytes]], **kwargs: Any :param task: A single conversational task to execute. Is either a JSON type or a IO[bytes] type. Required. :type task: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -504,13 +501,6 @@ async def begin_conversation_analysis( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -629,13 +619,6 @@ async def begin_conversation_analysis( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -737,16 +720,6 @@ async def begin_conversation_analysis(self, task: Union[JSON, IO[bytes]], **kwar :param task: Collection of conversations to analyze and one or more tasks to execute. Is either a JSON type or a IO[bytes] type. Required. :type task: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_operations.py index a7df83152902..d0e796dd9f8f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_operations.py @@ -1221,9 +1221,6 @@ def create_project(self, project_name: str, project: Union[JSON, IO[bytes]], **k :type project_name: str :param project: The project parameters. Is either a JSON type or a IO[bytes] type. Required. :type project: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: - 'application/merge-patch+json'. Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -1502,13 +1499,6 @@ def begin_delete_project(self, project_name: str, **kwargs: Any) -> LROPoller[JS :param project_name: The name of the project to use. Required. :type project_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1715,13 +1705,6 @@ def begin_export_project( :keyword trained_model_label: Trained model label to export. If the trainedModelLabel is null, the default behavior is to export the current working copy. Default value is None. :paramtype trained_model_label: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1942,13 +1925,6 @@ def begin_import_project( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2176,13 +2152,6 @@ def begin_import_project( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2271,16 +2240,6 @@ def begin_import_project( :keyword exported_project_format: The format of the exported project file to use. Known values are: "Conversation" and "Luis". Default value is None. :paramtype exported_project_format: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2617,13 +2576,6 @@ def begin_train( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2759,13 +2711,6 @@ def begin_train( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2876,16 +2821,6 @@ def begin_train(self, project_name: str, configuration: Union[JSON, IO[bytes]], :param configuration: The training input parameters. Is either a JSON type or a IO[bytes] type. Required. :type configuration: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -3261,13 +3196,6 @@ def begin_swap_deployments( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -3357,13 +3285,6 @@ def begin_swap_deployments( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -3443,16 +3364,6 @@ def begin_swap_deployments( :param deployments: The job object to swap two deployments. Is either a JSON type or a IO[bytes] type. Required. :type deployments: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -3751,13 +3662,6 @@ def begin_deploy_project( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -3810,13 +3714,6 @@ def begin_deploy_project( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -3856,16 +3753,6 @@ def begin_deploy_project( :param deployment: The new deployment info. Is either a JSON type or a IO[bytes] type. Required. :type deployment: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -4014,13 +3901,6 @@ def begin_delete_deployment(self, project_name: str, deployment_name: str, **kwa :type project_name: str :param deployment_name: The name of the specific deployment of the project to use. Required. :type deployment_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -4961,13 +4841,6 @@ def begin_load_snapshot(self, project_name: str, trained_model_label: str, **kwa :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -5942,13 +5815,6 @@ def begin_cancel_training_job(self, project_name: str, job_id: str, **kwargs: An :type project_name: str :param job_id: The job ID. Required. :type job_id: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_serialization.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_serialization.py index baa661cb82d2..2f781d740827 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_serialization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1370,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_operations.py index 8d382d86ca0d..8a9b8af8beff 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_operations.py @@ -348,9 +348,6 @@ async def create_project(self, project_name: str, project: Union[JSON, IO[bytes] :type project_name: str :param project: The project parameters. Is either a JSON type or a IO[bytes] type. Required. :type project: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: - 'application/merge-patch+json'. Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -629,13 +626,6 @@ async def begin_delete_project(self, project_name: str, **kwargs: Any) -> AsyncL :param project_name: The name of the project to use. Required. :type project_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -843,13 +833,6 @@ async def begin_export_project( :keyword trained_model_label: Trained model label to export. If the trainedModelLabel is null, the default behavior is to export the current working copy. Default value is None. :paramtype trained_model_label: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1071,13 +1054,6 @@ async def begin_import_project( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1305,13 +1281,6 @@ async def begin_import_project( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1400,16 +1369,6 @@ async def begin_import_project( :keyword exported_project_format: The format of the exported project file to use. Known values are: "Conversation" and "Luis". Default value is None. :paramtype exported_project_format: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1749,13 +1708,6 @@ async def begin_train( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1891,13 +1843,6 @@ async def begin_train( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2010,16 +1955,6 @@ async def begin_train( :param configuration: The training input parameters. Is either a JSON type or a IO[bytes] type. Required. :type configuration: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2396,13 +2331,6 @@ async def begin_swap_deployments( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2492,13 +2420,6 @@ async def begin_swap_deployments( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2578,16 +2499,6 @@ async def begin_swap_deployments( :param deployments: The job object to swap two deployments. Is either a JSON type or a IO[bytes] type. Required. :type deployments: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2887,13 +2798,6 @@ async def begin_deploy_project( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2946,13 +2850,6 @@ async def begin_deploy_project( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2992,16 +2889,6 @@ async def begin_deploy_project( :param deployment: The new deployment info. Is either a JSON type or a IO[bytes] type. Required. :type deployment: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -3155,13 +3042,6 @@ async def begin_delete_deployment( :type project_name: str :param deployment_name: The name of the specific deployment of the project to use. Required. :type deployment_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -4109,13 +3989,6 @@ async def begin_load_snapshot( :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -5091,13 +4964,6 @@ async def begin_cancel_training_job(self, project_name: str, job_id: str, **kwar :type project_name: str :param job_id: The job ID. Required. :type job_id: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.ai.language.rst b/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.ai.language.rst deleted file mode 100644 index 4c6a4ac56de3..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.ai.language.rst +++ /dev/null @@ -1,15 +0,0 @@ -azure.ai.language package -==================================== - -.. automodule:: azure.ai.language - :members: - :undoc-members: - :inherited-members: - -Subpackages ------------ - -.. toctree:: - :maxdepth: 6 - - azure.ai.language.conversations diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.ai.rst b/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.ai.rst deleted file mode 100644 index 8078081a2ebb..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.ai.rst +++ /dev/null @@ -1,15 +0,0 @@ -azure.ai package -============================ - -.. automodule:: azure.ai - :members: - :undoc-members: - :inherited-members: - -Subpackages ------------ - -.. toctree:: - :maxdepth: 6 - - azure.ai.language diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.rst b/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.rst deleted file mode 100644 index c5752d2eb389..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/doc/azure.rst +++ /dev/null @@ -1,15 +0,0 @@ -azure package -============= - -.. automodule:: azure - :members: - :undoc-members: - :inherited-members: - -Subpackages ------------ - -.. toctree:: - :maxdepth: 6 - - azure.ai diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/pyproject.toml b/sdk/cognitivelanguage/azure-ai-language-conversations/pyproject.toml new file mode 100644 index 000000000000..556e80ea236e --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +strict_sphinx = true diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md index 092f33e18c6e..3345da0465f0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md @@ -394,7 +394,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [questionanswering_docs_features]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#features [questionanswering_pypi_package]: https://pypi.org/project/azure-ai-language-questionanswering/ [questionanswering_refdocs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.html -[questionanswering_rest_docs]: https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering [questionanswering_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/README.md [cognitive_authentication_aad]: https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_operations.py index d6361f12c5b7..3f53de1dc162 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_operations.py @@ -160,9 +160,6 @@ def get_answers( :paramtype project_name: str :keyword deployment_name: The name of the specific deployment of the project to use. Required. :paramtype deployment_name: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: AnswersResult :rtype: ~azure.ai.language.questionanswering.models.AnswersResult :raises ~azure.core.exceptions.HttpResponseError: @@ -272,9 +269,6 @@ def get_answers_from_text( :param options: Post body of the request. Is either a AnswersFromTextOptions type or a IO[bytes] type. Required. :type options: ~azure.ai.language.questionanswering.models.AnswersFromTextOptions or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: AnswersFromTextResult :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_patch.py index 6b17f0f22c90..92309e39559e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_operations/_patch.py @@ -147,7 +147,19 @@ class QuestionAnsweringClientOperationsMixin(QuestionAnsweringClientOperationsMi def get_answers( self, options: AnswersOptions, *, project_name: str, deployment_name: str, **kwargs: Any ) -> AnswersResult: - ... + """Answers the specified question using your knowledge base. + + :param options: Positional only. POST body of the request. Provide either `options`, OR + individual keyword arguments. If both are provided, only the options object will be used. + :type options: ~azure.ai.language.questionanswering.models.AnswersOptions + :keyword project_name: The name of the knowledge base project to use. + :paramtype project_name: str + :keyword deployment_name: The name of the specific deployment of the project to use. + :paramtype deployment_name: str + :return: AnswersResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @overload def get_answers( # pylint: disable=arguments-differ @@ -167,8 +179,42 @@ def get_answers( # pylint: disable=arguments-differ include_unstructured_sources: Optional[bool] = None, **kwargs: Any ) -> AnswersResult: - ... + """Answers the specified question using your knowledge base. + :keyword project_name: The name of the knowledge base project to use. + :paramtype project_name: str + :keyword deployment_name: The name of the specific deployment of the project to use. + :paramtype deployment_name: str + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. + :paramtype qna_id: int + :keyword question: User question to query against the knowledge base. + :paramtype question: str + :keyword top: Max number of answers to be returned for the question. + :paramtype top: int + :keyword user_id: Unique identifier for the user. + :paramtype user_id: str + :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :paramtype confidence_threshold: float + :keyword answer_context: Context object with previous QnA's information. + :paramtype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword ranker_kind: Type of ranker to be used. Possible + values include: "Default", "QuestionOnly". + :paramtype ranker_kind: str + :keyword filters: Filter QnAs based on given metadata list and knowledge base sources. + :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters + :keyword short_answer_options: To configure Answer span prediction feature. + :paramtype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured + Sources. + :paramtype include_unstructured_sources: bool + :return: AnswersResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + # pylint ignore b/c with overloads we need to doc ALL the params in the impl for them to show up in docs + # pylint: disable=docstring-keyword-should-match-keyword-only,docstring-missing-param,docstring-should-be-keyword @distributed_trace def get_answers(self, *args: AnswersOptions, **kwargs: Any) -> AnswersResult: """Answers the specified question using your knowledge base. @@ -221,7 +267,15 @@ def get_answers(self, *args: AnswersOptions, **kwargs: Any) -> AnswersResult: @overload # type: ignore def get_answers_from_text(self, options: AnswersFromTextOptions, **kwargs: Any) -> AnswersFromTextResult: - pass + """Answers the specified question using the provided text in the body. + + :param options: Positional only. POST body of the request. Provide either `options`, OR + individual keyword arguments. If both are provided, only the options object will be used. + :type options: ~azure.ai.language.questionanswering.models.AnswersFromTextOptions + :return: AnswersFromTextResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @overload def get_answers_from_text( # pylint: disable=arguments-differ @@ -232,7 +286,20 @@ def get_answers_from_text( # pylint: disable=arguments-differ language: Optional[str] = None, **kwargs: Any ) -> AnswersFromTextResult: - ... + """Answers the specified question using the provided text in the body. + + :keyword question: User question to query against the given text records. + :paramtype question: str + :keyword text_documents: Text records to be searched for given question. + :paramtype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] + :keyword language: Language of the text records. This is BCP-47 representation of a language. + For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :paramtype language: str + :return: AnswersFromTextResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def get_answers_from_text(self, *args: AnswersFromTextOptions, **kwargs: Any) -> AnswersFromTextResult: diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_serialization.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_serialization.py index baa661cb82d2..2f781d740827 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_serialization.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1370,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_operations.py index d135b5ef6a82..5e370c76369b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_operations.py @@ -110,9 +110,6 @@ async def get_answers( :paramtype project_name: str :keyword deployment_name: The name of the specific deployment of the project to use. Required. :paramtype deployment_name: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: AnswersResult :rtype: ~azure.ai.language.questionanswering.models.AnswersResult :raises ~azure.core.exceptions.HttpResponseError: @@ -222,9 +219,6 @@ async def get_answers_from_text( :param options: Post body of the request. Is either a AnswersFromTextOptions type or a IO[bytes] type. Required. :type options: ~azure.ai.language.questionanswering.models.AnswersFromTextOptions or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: AnswersFromTextResult :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_patch.py index 331981363e25..014309ffbaf1 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_operations/_patch.py @@ -28,7 +28,19 @@ class QuestionAnsweringClientOperationsMixin(QuestionAnsweringClientOperationsMi async def get_answers( self, options: AnswersOptions, *, project_name: str, deployment_name: str, **kwargs: Any ) -> AnswersResult: - ... + """Answers the specified question using your knowledge base. + + :param options: Positional only. POST body of the request. Provide either `options`, OR + individual keyword arguments. If both are provided, only the options object will be used. + :type options: ~azure.ai.language.questionanswering.models.AnswersOptions + :keyword project_name: The name of the knowledge base project to use. + :paramtype project_name: str + :keyword deployment_name: The name of the specific deployment of the project to use. + :paramtype deployment_name: str + :return: AnswersResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @overload async def get_answers( # pylint: disable=arguments-differ @@ -48,8 +60,42 @@ async def get_answers( # pylint: disable=arguments-differ include_unstructured_sources: Optional[bool] = None, **kwargs: Any ) -> AnswersResult: - ... + """Answers the specified question using your knowledge base. + :keyword project_name: The name of the knowledge base project to use. + :paramtype project_name: str + :keyword deployment_name: The name of the specific deployment of the project to use. + :paramtype deployment_name: str + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. + :paramtype qna_id: int + :keyword question: User question to query against the knowledge base. + :paramtype question: str + :keyword top: Max number of answers to be returned for the question. + :paramtype top: int + :keyword user_id: Unique identifier for the user. + :paramtype user_id: str + :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :paramtype confidence_threshold: float + :keyword answer_context: Context object with previous QnA's information. + :paramtype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword ranker_kind: Type of ranker to be used. Possible + values include: "Default", "QuestionOnly". + :paramtype ranker_kind: str + :keyword filters: Filter QnAs based on given metadata list and knowledge base sources. + :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters + :keyword short_answer_options: To configure Answer span prediction feature. + :paramtype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured + Sources. + :paramtype include_unstructured_sources: bool + :return: AnswersResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + # pylint ignore b/c with overloads we need to doc ALL the params in the impl for them to show up in docs + # pylint: disable=docstring-keyword-should-match-keyword-only,docstring-missing-param,docstring-should-be-keyword @distributed_trace_async async def get_answers(self, *args, **kwargs) -> AnswersResult: # type: ignore """Answers the specified question using your knowledge base. @@ -102,7 +148,15 @@ async def get_answers(self, *args, **kwargs) -> AnswersResult: # type: ignore @overload # type: ignore async def get_answers_from_text(self, options: AnswersFromTextOptions, **kwargs: Any) -> AnswersFromTextResult: - ... + """Answers the specified question using the provided text in the body. + + :param options: Positional only. POST body of the request. Provide either `options`, OR + individual keyword arguments. If both are provided, only the options object will be used. + :type options: ~azure.ai.language.questionanswering.models.AnswersFromTextOptions + :return: AnswersFromTextResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @overload async def get_answers_from_text( # pylint: disable=arguments-differ @@ -113,7 +167,20 @@ async def get_answers_from_text( # pylint: disable=arguments-differ language: Optional[str] = None, **kwargs: Any ) -> AnswersFromTextResult: - ... + """Answers the specified question using the provided text in the body. + + :keyword question: User question to query against the given text records. + :paramtype question: str + :keyword text_documents: Text records to be searched for given question. + :paramtype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] + :keyword language: Language of the text records. This is BCP-47 representation of a language. + For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :paramtype language: str + :return: AnswersFromTextResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def get_answers_from_text(self, *args, **kwargs) -> AnswersFromTextResult: # type: ignore diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_operations/_operations.py index 5380d28b51df..0602d2728e21 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_operations/_operations.py @@ -825,9 +825,6 @@ def create_project(self, project_name: str, options: Union[JSON, IO[bytes]], **k :param options: Parameters needed to create the project. Is either a JSON type or a IO[bytes] type. Required. :type options: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -992,13 +989,6 @@ def begin_delete_project(self, project_name: str, **kwargs: Any) -> LROPoller[No :param project_name: The name of the project to use. Required. :type project_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1120,13 +1110,6 @@ def begin_export( :keyword asset_kind: Kind of the asset of the project. Known values are: "qnas" and "synonyms". Default value is None. :paramtype asset_kind: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1340,13 +1323,6 @@ def begin_import_assets( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1560,13 +1536,6 @@ def begin_import_assets( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1645,16 +1614,6 @@ def begin_import_assets( :keyword asset_kind: Kind of the asset of the project. Known values are: "qnas" and "synonyms". Default value is None. :paramtype asset_kind: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1958,13 +1917,6 @@ def begin_deploy_project(self, project_name: str, deployment_name: str, **kwargs :type project_name: str :param deployment_name: The name of the specific deployment of the project to use. Required. :type deployment_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns JSON object :rtype: ~azure.core.polling.LROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -2328,9 +2280,6 @@ def update_synonyms( # pylint: disable=inconsistent-return-statements :param synonyms: All the synonyms of a project. Is either a JSON type or a IO[bytes] type. Required. :type synonyms: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -2611,13 +2560,6 @@ def begin_update_sources( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -2681,13 +2623,6 @@ def begin_update_sources( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -2726,16 +2661,6 @@ def begin_update_sources( :param sources: Update sources parameters of a project. Is either a [JSON] type or a IO[bytes] type. Required. :type sources: list[JSON] or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -3185,13 +3110,6 @@ def begin_update_qnas( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -3369,13 +3287,6 @@ def begin_update_qnas( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -3491,16 +3402,6 @@ def begin_update_qnas( :param qnas: Update QnAs parameters of a project. Is either a [JSON] type or a IO[bytes] type. Required. :type qnas: list[JSON] or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -3806,9 +3707,6 @@ def add_feedback( # pylint: disable=inconsistent-return-statements :param feedback: Feedback for Active Learning. Is either a JSON type or a IO[bytes] type. Required. :type feedback: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_serialization.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_serialization.py index baa661cb82d2..2f781d740827 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_serialization.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1370,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/aio/_operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/aio/_operations/_operations.py index aa5430bba350..67cc1b7d2b8d 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/aio/_operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/authoring/aio/_operations/_operations.py @@ -390,9 +390,6 @@ async def create_project(self, project_name: str, options: Union[JSON, IO[bytes] :param options: Parameters needed to create the project. Is either a JSON type or a IO[bytes] type. Required. :type options: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -557,13 +554,6 @@ async def begin_delete_project(self, project_name: str, **kwargs: Any) -> AsyncL :param project_name: The name of the project to use. Required. :type project_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -686,13 +676,6 @@ async def begin_export( :keyword asset_kind: Kind of the asset of the project. Known values are: "qnas" and "synonyms". Default value is None. :paramtype asset_kind: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -907,13 +890,6 @@ async def begin_import_assets( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1127,13 +1103,6 @@ async def begin_import_assets( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1212,16 +1181,6 @@ async def begin_import_assets( :keyword asset_kind: Kind of the asset of the project. Known values are: "qnas" and "synonyms". Default value is None. :paramtype asset_kind: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1528,13 +1487,6 @@ async def begin_deploy_project( :type project_name: str :param deployment_name: The name of the specific deployment of the project to use. Required. :type deployment_name: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object :rtype: ~azure.core.polling.AsyncLROPoller[JSON] :raises ~azure.core.exceptions.HttpResponseError: @@ -1899,9 +1851,6 @@ async def update_synonyms( # pylint: disable=inconsistent-return-statements :param synonyms: All the synonyms of a project. Is either a JSON type or a IO[bytes] type. Required. :type synonyms: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -2182,13 +2131,6 @@ async def begin_update_sources( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -2252,13 +2194,6 @@ async def begin_update_sources( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -2297,16 +2232,6 @@ async def begin_update_sources( :param sources: Update sources parameters of a project. Is either a [JSON] type or a IO[bytes] type. Required. :type sources: list[JSON] or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -2757,13 +2682,6 @@ async def begin_update_qnas( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -2941,13 +2859,6 @@ async def begin_update_qnas( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -3063,16 +2974,6 @@ async def begin_update_qnas( :param qnas: Update QnAs parameters of a project. Is either a [JSON] type or a IO[bytes] type. Required. :type qnas: list[JSON] or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[JSON]] :raises ~azure.core.exceptions.HttpResponseError: @@ -3379,9 +3280,6 @@ async def add_feedback( # pylint: disable=inconsistent-return-statements :param feedback: Feedback for Active Learning. Is either a JSON type or a IO[bytes] type. Required. :type feedback: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/pyproject.toml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/pyproject.toml new file mode 100644 index 000000000000..556e80ea236e --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +strict_sphinx = true