Skip to content

Commit 9726e39

Browse files
author
SDKAuto
committed
CodeGen from PR 33495 in Azure/azure-rest-api-specs
Merge 762e359637e295fa533f11bfa0836b60f95a9c84 into d18ba009da04dd6afc04402c39f87e032051fe9b
1 parent e37eeb2 commit 9726e39

Some content is hidden

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

42 files changed

+2941
-987
lines changed

sdk/contentsafety/azure-ai-contentsafety/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ include azure/ai/contentsafety/py.typed
44
recursive-include tests *.py
55
recursive-include samples *.py *.md
66
include azure/__init__.py
7-
include azure/ai/__init__.py
7+
include azure/ai/__init__.py
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "21ac2e62a27a5f2bb82172a7f6a5b1c8a1037b78",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/cognitiveservices/ContentSafety",
5+
"@azure-tools/typespec-python": "0.42.2"
6+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"CrossLanguagePackageId": "ContentSafety",
3+
"CrossLanguageDefinitionId": {
4+
"azure.ai.contentsafety.models.AddOrUpdateTextBlocklistItemsOptions": "ContentSafety.AddOrUpdateTextBlocklistItemsOptions",
5+
"azure.ai.contentsafety.models.AddOrUpdateTextBlocklistItemsResult": "ContentSafety.AddOrUpdateTextBlocklistItemsResult",
6+
"azure.ai.contentsafety.models.AnalyzeImageOptions": "ContentSafety.AnalyzeImageOptions",
7+
"azure.ai.contentsafety.models.AnalyzeImageResult": "ContentSafety.AnalyzeImageResult",
8+
"azure.ai.contentsafety.models.AnalyzeTextOptions": "ContentSafety.AnalyzeTextOptions",
9+
"azure.ai.contentsafety.models.AnalyzeTextResult": "ContentSafety.AnalyzeTextResult",
10+
"azure.ai.contentsafety.models.DetectTextProtectedMaterialOptions": "ContentSafety.DetectTextProtectedMaterialOptions",
11+
"azure.ai.contentsafety.models.DetectTextProtectedMaterialResult": "ContentSafety.DetectTextProtectedMaterialResult",
12+
"azure.ai.contentsafety.models.DocumentInjectionAnalysisResult": "ContentSafety.DocumentInjectionAnalysisResult",
13+
"azure.ai.contentsafety.models.ImageCategoriesAnalysis": "ContentSafety.ImageCategoriesAnalysis",
14+
"azure.ai.contentsafety.models.ImageData": "ContentSafety.ImageData",
15+
"azure.ai.contentsafety.models.RemoveTextBlocklistItemsOptions": "ContentSafety.RemoveTextBlocklistItemsOptions",
16+
"azure.ai.contentsafety.models.ShieldPromptOptions": "ContentSafety.ShieldPromptOptions",
17+
"azure.ai.contentsafety.models.ShieldPromptResult": "ContentSafety.ShieldPromptResult",
18+
"azure.ai.contentsafety.models.TextBlocklist": "ContentSafety.TextBlocklist",
19+
"azure.ai.contentsafety.models.TextBlocklistItem": "ContentSafety.TextBlocklistItem",
20+
"azure.ai.contentsafety.models.TextBlocklistMatch": "ContentSafety.TextBlocklistMatch",
21+
"azure.ai.contentsafety.models.TextCategoriesAnalysis": "ContentSafety.TextCategoriesAnalysis",
22+
"azure.ai.contentsafety.models.TextProtectedMaterialAnalysisResult": "ContentSafety.TextProtectedMaterialAnalysisResult",
23+
"azure.ai.contentsafety.models.UserPromptInjectionAnalysisResult": "ContentSafety.UserPromptInjectionAnalysisResult",
24+
"azure.ai.contentsafety.models.ImageCategory": "ContentSafety.ImageCategory",
25+
"azure.ai.contentsafety.models.AnalyzeImageOutputType": "ContentSafety.AnalyzeImageOutputType",
26+
"azure.ai.contentsafety.models.TextCategory": "ContentSafety.TextCategory",
27+
"azure.ai.contentsafety.models.AnalyzeTextOutputType": "ContentSafety.AnalyzeTextOutputType",
28+
"azure.ai.contentsafety.ContentSafetyClient.analyze_image": "Customizations.ContentSafetyClient.analyzeImage",
29+
"azure.ai.contentsafety.ContentSafetyClient.analyze_text": "Customizations.ContentSafetyClient.analyzeText",
30+
"azure.ai.contentsafety.ContentSafetyClient.detect_text_protected_material": "Customizations.ContentSafetyClient.detectTextProtectedMaterial",
31+
"azure.ai.contentsafety.ContentSafetyClient.shield_prompt": "Customizations.ContentSafetyClient.shieldPrompt",
32+
"azure.ai.contentsafety.BlocklistClient.add_or_update_blocklist_items": "Customizations.BlocklistClient.addOrUpdateBlocklistItems",
33+
"azure.ai.contentsafety.BlocklistClient.create_or_update_text_blocklist": "Customizations.BlocklistClient.createOrUpdateTextBlocklist",
34+
"azure.ai.contentsafety.BlocklistClient.delete_text_blocklist": "Customizations.BlocklistClient.deleteTextBlocklist",
35+
"azure.ai.contentsafety.BlocklistClient.get_text_blocklist": "Customizations.BlocklistClient.getTextBlocklist",
36+
"azure.ai.contentsafety.BlocklistClient.get_text_blocklist_item": "Customizations.BlocklistClient.getTextBlocklistItem",
37+
"azure.ai.contentsafety.BlocklistClient.list_text_blocklist_items": "Customizations.BlocklistClient.listTextBlocklistItems",
38+
"azure.ai.contentsafety.BlocklistClient.list_text_blocklists": "Customizations.BlocklistClient.listTextBlocklists",
39+
"azure.ai.contentsafety.BlocklistClient.remove_blocklist_items": "Customizations.BlocklistClient.removeBlocklistItems"
40+
}
41+
}

sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._client import ContentSafetyClient
10-
from ._client import BlocklistClient
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 ContentSafetyClient # type: ignore
16+
from ._client import BlocklistClient # type: ignore
1117
from ._version import VERSION
1218

1319
__version__ = VERSION
1420

1521
try:
1622
from ._patch import __all__ as _patch_all
17-
from ._patch import * # pylint: disable=unused-wildcard-import
23+
from ._patch import *
1824
except ImportError:
1925
_patch_all = []
2026
from ._patch import patch_sdk as _patch_sdk
@@ -23,6 +29,6 @@
2329
"ContentSafetyClient",
2430
"BlocklistClient",
2531
]
26-
__all__.extend([p for p in _patch_all if p not in __all__])
32+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2733

2834
_patch_sdk()

sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_client.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING, Union
11+
from typing_extensions import Self
1112

1213
from azure.core import PipelineClient
1314
from azure.core.credentials import AzureKeyCredential
@@ -19,21 +20,20 @@
1920
from ._serialization import Deserializer, Serializer
2021

2122
if TYPE_CHECKING:
22-
# pylint: disable=unused-import,ungrouped-imports
2323
from azure.core.credentials import TokenCredential
2424

2525

26-
class ContentSafetyClient(ContentSafetyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
26+
class ContentSafetyClient(ContentSafetyClientOperationsMixin):
2727
"""ContentSafetyClient.
2828
2929
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
30-
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
30+
https://<resource-name>.cognitiveservices.azure.com). Required.
3131
:type endpoint: str
32-
:param credential: Credential needed for the client to connect to Azure. Is either a
33-
AzureKeyCredential type or a TokenCredential type. Required.
32+
:param credential: Credential used to authenticate requests to the service. Is either a key
33+
credential type or a token credential type. Required.
3434
:type credential: ~azure.core.credentials.AzureKeyCredential or
3535
~azure.core.credentials.TokenCredential
36-
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
36+
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
3737
Note that overriding this default value may result in unsupported behavior.
3838
:paramtype api_version: str
3939
"""
@@ -84,7 +84,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
8484

8585
request_copy = deepcopy(request)
8686
path_format_arguments = {
87-
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
87+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"),
8888
}
8989

9090
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
@@ -93,25 +93,25 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
9393
def close(self) -> None:
9494
self._client.close()
9595

96-
def __enter__(self) -> "ContentSafetyClient":
96+
def __enter__(self) -> Self:
9797
self._client.__enter__()
9898
return self
9999

100100
def __exit__(self, *exc_details: Any) -> None:
101101
self._client.__exit__(*exc_details)
102102

103103

104-
class BlocklistClient(BlocklistClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
104+
class BlocklistClient(BlocklistClientOperationsMixin):
105105
"""BlocklistClient.
106106
107107
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
108-
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
108+
https://<resource-name>.cognitiveservices.azure.com). Required.
109109
:type endpoint: str
110-
:param credential: Credential needed for the client to connect to Azure. Is either a
111-
AzureKeyCredential type or a TokenCredential type. Required.
110+
:param credential: Credential used to authenticate requests to the service. Is either a key
111+
credential type or a token credential type. Required.
112112
:type credential: ~azure.core.credentials.AzureKeyCredential or
113113
~azure.core.credentials.TokenCredential
114-
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
114+
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
115115
Note that overriding this default value may result in unsupported behavior.
116116
:paramtype api_version: str
117117
"""
@@ -162,7 +162,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
162162

163163
request_copy = deepcopy(request)
164164
path_format_arguments = {
165-
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
165+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"),
166166
}
167167

168168
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
@@ -171,7 +171,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
171171
def close(self) -> None:
172172
self._client.close()
173173

174-
def __enter__(self) -> "BlocklistClient":
174+
def __enter__(self) -> Self:
175175
self._client.__enter__()
176176
return self
177177

sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_configuration.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,29 @@
1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17-
# pylint: disable=unused-import,ungrouped-imports
1817
from azure.core.credentials import TokenCredential
1918

2019

21-
class ContentSafetyClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
20+
class ContentSafetyClientConfiguration: # pylint: disable=too-many-instance-attributes
2221
"""Configuration for ContentSafetyClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
2524
attributes.
2625
2726
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
28-
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
27+
https://<resource-name>.cognitiveservices.azure.com). Required.
2928
:type endpoint: str
30-
:param credential: Credential needed for the client to connect to Azure. Is either a
31-
AzureKeyCredential type or a TokenCredential type. Required.
29+
:param credential: Credential used to authenticate requests to the service. Is either a key
30+
credential type or a token credential type. Required.
3231
:type credential: ~azure.core.credentials.AzureKeyCredential or
3332
~azure.core.credentials.TokenCredential
34-
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
33+
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
3534
Note that overriding this default value may result in unsupported behavior.
3635
:paramtype api_version: str
3736
"""
3837

3938
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
40-
api_version: str = kwargs.pop("api_version", "2023-10-01")
39+
api_version: str = kwargs.pop("api_version", "2024-09-01")
4140

4241
if endpoint is None:
4342
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -73,26 +72,26 @@ def _configure(self, **kwargs: Any) -> None:
7372
self.authentication_policy = self._infer_policy(**kwargs)
7473

7574

76-
class BlocklistClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
75+
class BlocklistClientConfiguration: # pylint: disable=too-many-instance-attributes
7776
"""Configuration for BlocklistClient.
7877
7978
Note that all parameters used to create this instance are saved as instance
8079
attributes.
8180
8281
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
83-
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
82+
https://<resource-name>.cognitiveservices.azure.com). Required.
8483
:type endpoint: str
85-
:param credential: Credential needed for the client to connect to Azure. Is either a
86-
AzureKeyCredential type or a TokenCredential type. Required.
84+
:param credential: Credential used to authenticate requests to the service. Is either a key
85+
credential type or a token credential type. Required.
8786
:type credential: ~azure.core.credentials.AzureKeyCredential or
8887
~azure.core.credentials.TokenCredential
89-
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
88+
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
9089
Note that overriding this default value may result in unsupported behavior.
9190
:paramtype api_version: str
9291
"""
9392

9493
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
95-
api_version: str = kwargs.pop("api_version", "2023-10-01")
94+
api_version: str = kwargs.pop("api_version", "2024-09-01")
9695

9796
if endpoint is None:
9897
raise ValueError("Parameter 'endpoint' must not be None.")

0 commit comments

Comments
 (0)