Skip to content

Commit

Permalink
Cognitive Services stable version (#2515)
Browse files Browse the repository at this point in the history
* Latest VideoSearch

* Latest NewsSearch

* Latest ImageSearch

* Latest EntitySearch

* Latest Spellcheck

* Latest WebSearch

* CS with Autorest 3.0.50

* Packaging

* Documentation

* Remove deprecated build.json

* VisualSearch 0.1.0 (#2489)

* Packaging of VisualSearch
  • Loading branch information
lmazuel authored May 2, 2018
1 parent 215a44f commit 174435d
Show file tree
Hide file tree
Showing 486 changed files with 22,393 additions and 3,515 deletions.
32 changes: 32 additions & 0 deletions azure-cognitiveservices-language-spellcheck/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@
Release History
===============

1.0.0 (2018-05-02)
++++++++++++++++++

**Features**

- Client class can be used as a context manager to keep the underlying HTTP session open for performance

**General Breaking changes**

This version uses a next-generation code generator that *might* introduce breaking changes.

- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments.
To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered.
While this is not a breaking change, the distinctions are important, and are documented here:
https://docs.python.org/3/library/enum.html#others
At a glance:

- "is" should not be used at all.
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered.

- New Long Running Operation:

- Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same.
- Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used.
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`.
- New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`,
the response of the initial call will be returned without polling.
- `polling` parameter accepts instances of subclasses of `msrest.polling.PollingMethod`.
- `add_done_callback` will no longer raise if called after polling is finished, but will instead execute the callback right away.

0.1.0 (2018-01-12)
++++++++++++++++++

Expand Down
16 changes: 9 additions & 7 deletions azure-cognitiveservices-language-spellcheck/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ Microsoft Azure SDK for Python

This is the Microsoft Azure Cognitive Services Bing Spell Check Client Library.

Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.3, 3.4, 3.5 and 3.6.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.

For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.

Expand All @@ -33,6 +27,14 @@ If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
pip uninstall azure
Usage
=====

For code examples, see `Spell Check
<https://docs.microsoft.com/python/api/overview/azure/cognitive-services>`__
on readthedocs.org.


Provide Feedback
================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,26 @@
# regenerated.
# --------------------------------------------------------------------------

from .spelling_token_suggestion import SpellingTokenSuggestion
from .spelling_flagged_token import SpellingFlaggedToken
from .spell_check import SpellCheck
from .answer import Answer
from .response import Response
from .identifiable import Identifiable
from .error import Error
from .error_response import ErrorResponse, ErrorResponseException
from .response_base import ResponseBase
try:
from .spelling_token_suggestion_py3 import SpellingTokenSuggestion
from .spelling_flagged_token_py3 import SpellingFlaggedToken
from .spell_check_py3 import SpellCheck
from .answer_py3 import Answer
from .response_py3 import Response
from .identifiable_py3 import Identifiable
from .error_py3 import Error
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .response_base_py3 import ResponseBase
except (SyntaxError, ImportError):
from .spelling_token_suggestion import SpellingTokenSuggestion
from .spelling_flagged_token import SpellingFlaggedToken
from .spell_check import SpellCheck
from .answer import Answer
from .response import Response
from .identifiable import Identifiable
from .error import Error
from .error_response import ErrorResponse, ErrorResponseException
from .response_base import ResponseBase
from .spell_check_api_enums import (
ErrorType,
ErrorCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class Answer(Response):
Variables are only populated by the server, and will be ignored when
sending a request.
:param _type: Constant filled by server.
All required parameters must be populated in order to send to Azure.
:param _type: Required. Constant filled by server.
:type _type: str
:ivar id: A String identifier.
:vartype id: str
Expand All @@ -32,10 +34,15 @@ class Answer(Response):
'id': {'readonly': True},
}

_attribute_map = {
'_type': {'key': '_type', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
}

_subtype_map = {
'_type': {'SpellCheck': 'SpellCheck'}
}

def __init__(self):
super(Answer, self).__init__()
def __init__(self, **kwargs):
super(Answer, self).__init__(**kwargs)
self._type = 'Answer'
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .response import Response


class Answer(Response):
"""Answer.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: SpellCheck
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:param _type: Required. Constant filled by server.
:type _type: str
:ivar id: A String identifier.
:vartype id: str
"""

_validation = {
'_type': {'required': True},
'id': {'readonly': True},
}

_attribute_map = {
'_type': {'key': '_type', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
}

_subtype_map = {
'_type': {'SpellCheck': 'SpellCheck'}
}

def __init__(self, **kwargs) -> None:
super(Answer, self).__init__(**kwargs)
self._type = 'Answer'
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ class Error(Model):
Variables are only populated by the server, and will be ignored when
sending a request.
:param code: The error code that identifies the category of error.
Possible values include: 'None', 'ServerError', 'InvalidRequest',
All required parameters must be populated in order to send to Azure.
:param code: Required. The error code that identifies the category of
error. Possible values include: 'None', 'ServerError', 'InvalidRequest',
'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'.
Default value: "None" .
:type code: str or
Expand All @@ -31,7 +33,7 @@ class Error(Model):
'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'
:vartype sub_code: str or
~azure.cognitiveservices.language.spellcheck.models.ErrorSubCode
:param message: A description of the error.
:param message: Required. A description of the error.
:type message: str
:ivar more_details: A description that provides additional information
about the error.
Expand Down Expand Up @@ -60,11 +62,11 @@ class Error(Model):
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, message, code="None"):
super(Error, self).__init__()
self.code = code
def __init__(self, **kwargs):
super(Error, self).__init__(**kwargs)
self.code = kwargs.get('code', "None")
self.sub_code = None
self.message = message
self.message = kwargs.get('message', None)
self.more_details = None
self.parameter = None
self.value = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class Error(Model):
"""Defines the error that occurred.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:param code: Required. The error code that identifies the category of
error. Possible values include: 'None', 'ServerError', 'InvalidRequest',
'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'.
Default value: "None" .
:type code: str or
~azure.cognitiveservices.language.spellcheck.models.ErrorCode
:ivar sub_code: The error code that further helps to identify the error.
Possible values include: 'UnexpectedError', 'ResourceError',
'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue',
'HttpNotAllowed', 'Blocked', 'AuthorizationMissing',
'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'
:vartype sub_code: str or
~azure.cognitiveservices.language.spellcheck.models.ErrorSubCode
:param message: Required. A description of the error.
:type message: str
:ivar more_details: A description that provides additional information
about the error.
:vartype more_details: str
:ivar parameter: The parameter in the request that caused the error.
:vartype parameter: str
:ivar value: The parameter's value in the request that was not valid.
:vartype value: str
"""

_validation = {
'code': {'required': True},
'sub_code': {'readonly': True},
'message': {'required': True},
'more_details': {'readonly': True},
'parameter': {'readonly': True},
'value': {'readonly': True},
}

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'sub_code': {'key': 'subCode', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'more_details': {'key': 'moreDetails', 'type': 'str'},
'parameter': {'key': 'parameter', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, *, message: str, code="None", **kwargs) -> None:
super(Error, self).__init__(**kwargs)
self.code = code
self.sub_code = None
self.message = message
self.more_details = None
self.parameter = None
self.value = None
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ class ErrorResponse(Response):
Variables are only populated by the server, and will be ignored when
sending a request.
:param _type: Constant filled by server.
All required parameters must be populated in order to send to Azure.
:param _type: Required. Constant filled by server.
:type _type: str
:ivar id: A String identifier.
:vartype id: str
:param errors: A list of errors that describe the reasons why the request
failed.
:param errors: Required. A list of errors that describe the reasons why
the request failed.
:type errors:
list[~azure.cognitiveservices.language.spellcheck.models.Error]
"""
Expand All @@ -41,9 +43,9 @@ class ErrorResponse(Response):
'errors': {'key': 'errors', 'type': '[Error]'},
}

def __init__(self, errors):
super(ErrorResponse, self).__init__()
self.errors = errors
def __init__(self, **kwargs):
super(ErrorResponse, self).__init__(**kwargs)
self.errors = kwargs.get('errors', None)
self._type = 'ErrorResponse'


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .response import Response
from msrest.exceptions import HttpOperationError


class ErrorResponse(Response):
"""The top-level response that represents a failed request.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:param _type: Required. Constant filled by server.
:type _type: str
:ivar id: A String identifier.
:vartype id: str
:param errors: Required. A list of errors that describe the reasons why
the request failed.
:type errors:
list[~azure.cognitiveservices.language.spellcheck.models.Error]
"""

_validation = {
'_type': {'required': True},
'id': {'readonly': True},
'errors': {'required': True},
}

_attribute_map = {
'_type': {'key': '_type', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'errors': {'key': 'errors', 'type': '[Error]'},
}

def __init__(self, *, errors, **kwargs) -> None:
super(ErrorResponse, self).__init__(**kwargs)
self.errors = errors
self._type = 'ErrorResponse'


class ErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)
Loading

0 comments on commit 174435d

Please sign in to comment.