Skip to content

Commit 6a097f5

Browse files
author
SDKAuto
committed
CodeGen from PR 31823 in Azure/azure-rest-api-specs
Merge c57a776e9ed54afe935111bb21a615537f8145b3 into c9a4dc04527f7fdb4a944e2c392f2de280ef7cae
1 parent 3db032b commit 6a097f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+7798
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0b1 (1970-01-01)
4+
5+
- Initial version
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include *.md
2+
include LICENSE
3+
include azure/ai/language/documents/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/ai/__init__.py
8+
include azure/ai/language/__init__.py
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
3+
# Azure Ai Language Documents client library for Python
4+
<!-- write necessary description of service -->
5+
6+
## Getting started
7+
8+
### Install the package
9+
10+
```bash
11+
python -m pip install azure-ai-language-documents
12+
```
13+
14+
#### Prequisites
15+
16+
- Python 3.8 or later is required to use this package.
17+
- You need an [Azure subscription][azure_sub] to use this package.
18+
- An existing Azure Ai Language Documents instance.
19+
20+
## Contributing
21+
22+
This project welcomes contributions and suggestions. Most contributions require
23+
you to agree to a Contributor License Agreement (CLA) declaring that you have
24+
the right to, and actually do, grant us the rights to use your contribution.
25+
For details, visit https://cla.microsoft.com.
26+
27+
When you submit a pull request, a CLA-bot will automatically determine whether
28+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
29+
comment). Simply follow the instructions provided by the bot. You will only
30+
need to do this once across all repos using our CLA.
31+
32+
This project has adopted the
33+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
34+
see the Code of Conduct FAQ or contact [email protected] with any
35+
additional questions or comments.
36+
37+
<!-- LINKS -->
38+
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
39+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
40+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
41+
[azure_identity_pip]: https://pypi.org/project/azure-identity/
42+
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
43+
[pip]: https://pypi.org/project/pip/
44+
[azure_sub]: https://azure.microsoft.com/free/
45+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "437bf20a10977612aff21b95f0bf444014fed4cc",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/cognitiveservices/Language.AnalyzeDocuments",
5+
"@azure-tools/typespec-python": "0.37.2"
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
9+
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import AnalyzeDocumentsClient # type: ignore
16+
from ._version import VERSION
17+
18+
__version__ = VERSION
19+
20+
try:
21+
from ._patch import __all__ as _patch_all
22+
from ._patch import *
23+
except ImportError:
24+
_patch_all = []
25+
from ._patch import patch_sdk as _patch_sdk
26+
27+
__all__ = [
28+
"AnalyzeDocumentsClient",
29+
]
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
31+
32+
_patch_sdk()
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING, Union
11+
from typing_extensions import Self
12+
13+
from azure.core import PipelineClient
14+
from azure.core.credentials import AzureKeyCredential
15+
from azure.core.pipeline import policies
16+
from azure.core.rest import HttpRequest, HttpResponse
17+
18+
from ._configuration import AnalyzeDocumentsClientConfiguration
19+
from ._operations import AnalyzeDocumentsClientOperationsMixin
20+
from ._serialization import Deserializer, Serializer
21+
22+
if TYPE_CHECKING:
23+
from azure.core.credentials import TokenCredential
24+
25+
26+
class AnalyzeDocumentsClient(AnalyzeDocumentsClientOperationsMixin):
27+
"""The language service API is a suite of natural language processing (NLP) skills built with
28+
best-in-class Microsoft machine learning algorithms.
29+
The API can be used to analyze unstructured text for tasks such as sentiment analysis, key
30+
phrase extraction, language detection and question answering.
31+
Further documentation can be found in <a
32+
href=\\"https://learn.microsoft.com/azure/cognitive-services/language-service/overview\\">https://learn.microsoft.com/azure/cognitive-services/language-service/overview</a>.0.
33+
34+
:param endpoint: Supported Cognitive Services endpoint (e.g., https://\\\\
35+
:code:`<resource-name>`.api.cognitiveservices.azure.com). Required.
36+
:type endpoint: str
37+
:param credential: Credential used to authenticate requests to the service. Is either a
38+
AzureKeyCredential type or a TokenCredential type. Required.
39+
:type credential: ~azure.core.credentials.AzureKeyCredential or
40+
~azure.core.credentials.TokenCredential
41+
:keyword api_version: The API version to use for this operation. Default value is
42+
"2024-11-15-preview". Note that overriding this default value may result in unsupported
43+
behavior.
44+
:paramtype api_version: str
45+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
46+
Retry-After header is present.
47+
"""
48+
49+
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
50+
_endpoint = "{Endpoint}/language"
51+
self._config = AnalyzeDocumentsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
52+
_policies = kwargs.pop("policies", None)
53+
if _policies is None:
54+
_policies = [
55+
policies.RequestIdPolicy(**kwargs),
56+
self._config.headers_policy,
57+
self._config.user_agent_policy,
58+
self._config.proxy_policy,
59+
policies.ContentDecodePolicy(**kwargs),
60+
self._config.redirect_policy,
61+
self._config.retry_policy,
62+
self._config.authentication_policy,
63+
self._config.custom_hook_policy,
64+
self._config.logging_policy,
65+
policies.DistributedTracingPolicy(**kwargs),
66+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
67+
self._config.http_logging_policy,
68+
]
69+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
70+
71+
self._serialize = Serializer()
72+
self._deserialize = Deserializer()
73+
self._serialize.client_side_validation = False
74+
75+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
76+
"""Runs the network request through the client's chained policies.
77+
78+
>>> from azure.core.rest import HttpRequest
79+
>>> request = HttpRequest("GET", "https://www.example.org/")
80+
<HttpRequest [GET], url: 'https://www.example.org/'>
81+
>>> response = client.send_request(request)
82+
<HttpResponse: 200 OK>
83+
84+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
85+
86+
:param request: The network request you want to make. Required.
87+
:type request: ~azure.core.rest.HttpRequest
88+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
89+
:return: The response of your network call. Does not do error handling on your response.
90+
:rtype: ~azure.core.rest.HttpResponse
91+
"""
92+
93+
request_copy = deepcopy(request)
94+
path_format_arguments = {
95+
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"),
96+
}
97+
98+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
99+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
100+
101+
def close(self) -> None:
102+
self._client.close()
103+
104+
def __enter__(self) -> Self:
105+
self._client.__enter__()
106+
return self
107+
108+
def __exit__(self, *exc_details: Any) -> None:
109+
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)