Skip to content

Commit d7a8529

Browse files
run black on personalizer to fix ci (Azure#29066)
* run black on personalizer to fix ci * run validate_formatting on code
1 parent 96e518c commit d7a8529

33 files changed

+446
-265
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

sdk/personalizer/azure-ai-personalizer/azure/ai/personalizer/_operations/_operations.py

Lines changed: 118 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@
88
# --------------------------------------------------------------------------
99
import datetime
1010
import sys
11-
from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
11+
from typing import (
12+
Any,
13+
Callable,
14+
Dict,
15+
IO,
16+
Iterable,
17+
Iterator,
18+
Optional,
19+
TypeVar,
20+
Union,
21+
cast,
22+
overload,
23+
)
1224
import urllib.parse
1325

1426
from azure.core.exceptions import (
@@ -66,7 +78,9 @@ def build_personalizer_get_service_configuration_request(**kwargs: Any) -> HttpR
6678
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
6779

6880

69-
def build_personalizer_update_service_configuration_request(**kwargs: Any) -> HttpRequest:
81+
def build_personalizer_update_service_configuration_request(
82+
**kwargs: Any,
83+
) -> HttpRequest:
7084
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
7185
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
7286

@@ -163,7 +177,7 @@ def build_personalizer_get_evaluation_request(
163177
end_time: datetime.datetime,
164178
interval_in_minutes: Optional[int] = None,
165179
window: Optional[str] = None,
166-
**kwargs: Any
180+
**kwargs: Any,
167181
) -> HttpRequest:
168182
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
169183
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
@@ -252,7 +266,11 @@ def build_personalizer_create_evaluation_request(evaluation_id: str, **kwargs: A
252266

253267

254268
def build_personalizer_list_evaluations_request(
255-
*, filter_expression: Optional[str] = None, top: Optional[int] = None, skip: int = 0, **kwargs: Any
269+
*,
270+
filter_expression: Optional[str] = None,
271+
top: Optional[int] = None,
272+
skip: int = 0,
273+
**kwargs: Any,
256274
) -> HttpRequest:
257275
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
258276
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
@@ -553,7 +571,14 @@ def build_personalizer_import_model_request(*, content: IO, **kwargs: Any) -> Ht
553571
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
554572
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
555573

556-
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, content=content, **kwargs)
574+
return HttpRequest(
575+
method="PUT",
576+
url=_url,
577+
params=_params,
578+
headers=_headers,
579+
content=content,
580+
**kwargs,
581+
)
557582

558583

559584
def build_personalizer_reset_model_request(**kwargs: Any) -> HttpRequest:
@@ -1412,7 +1437,7 @@ def get_evaluation(
14121437
end_time: datetime.datetime,
14131438
interval_in_minutes: Optional[int] = None,
14141439
window: Optional[str] = None,
1415-
**kwargs: Any
1440+
**kwargs: Any,
14161441
) -> JSON:
14171442
"""Offline Evaluation.
14181443
@@ -1601,7 +1626,12 @@ def delete_evaluation( # pylint: disable=inconsistent-return-statements
16011626

16021627
@overload
16031628
def create_evaluation( # pylint: disable=inconsistent-return-statements
1604-
self, evaluation_id: str, evaluation: JSON, *, content_type: str = "application/json", **kwargs: Any
1629+
self,
1630+
evaluation_id: str,
1631+
evaluation: JSON,
1632+
*,
1633+
content_type: str = "application/json",
1634+
**kwargs: Any,
16051635
) -> None:
16061636
"""Create Offline Evaluation.
16071637
@@ -1642,7 +1672,12 @@ def create_evaluation( # pylint: disable=inconsistent-return-statements
16421672

16431673
@overload
16441674
def create_evaluation( # pylint: disable=inconsistent-return-statements
1645-
self, evaluation_id: str, evaluation: IO, *, content_type: str = "application/json", **kwargs: Any
1675+
self,
1676+
evaluation_id: str,
1677+
evaluation: IO,
1678+
*,
1679+
content_type: str = "application/json",
1680+
**kwargs: Any,
16461681
) -> None:
16471682
"""Create Offline Evaluation.
16481683
@@ -1731,7 +1766,12 @@ def create_evaluation( # pylint: disable=inconsistent-return-statements
17311766

17321767
@distributed_trace
17331768
def list_evaluations(
1734-
self, *, filter_expression: Optional[str] = None, top: Optional[int] = None, skip: int = 0, **kwargs: Any
1769+
self,
1770+
*,
1771+
filter_expression: Optional[str] = None,
1772+
top: Optional[int] = None,
1773+
skip: int = 0,
1774+
**kwargs: Any,
17351775
) -> Iterable[JSON]:
17361776
"""All Offline Evaluations.
17371777
@@ -1797,7 +1837,10 @@ def prepare_request(next_link=None):
17971837
)
17981838
path_format_arguments = {
17991839
"Endpoint": self._serialize.url(
1800-
"self._config.endpoint", self._config.endpoint, "str", skip_quote=True
1840+
"self._config.endpoint",
1841+
self._config.endpoint,
1842+
"str",
1843+
skip_quote=True,
18011844
),
18021845
}
18031846
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
@@ -1813,11 +1856,16 @@ def prepare_request(next_link=None):
18131856
)
18141857
_next_request_params["api-version"] = self._config.api_version
18151858
request = HttpRequest(
1816-
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
1859+
"GET",
1860+
urllib.parse.urljoin(next_link, _parsed_next_link.path),
1861+
params=_next_request_params,
18171862
)
18181863
path_format_arguments = {
18191864
"Endpoint": self._serialize.url(
1820-
"self._config.endpoint", self._config.endpoint, "str", skip_quote=True
1865+
"self._config.endpoint",
1866+
self._config.endpoint,
1867+
"str",
1868+
skip_quote=True,
18211869
),
18221870
}
18231871
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
@@ -1840,7 +1888,11 @@ def get_next(next_link=None):
18401888
response = pipeline_response.http_response
18411889

18421890
if response.status_code not in [200]:
1843-
map_error(status_code=response.status_code, response=response, error_map=error_map)
1891+
map_error(
1892+
status_code=response.status_code,
1893+
response=response,
1894+
error_map=error_map,
1895+
)
18441896
raise HttpResponseError(response=response)
18451897

18461898
return pipeline_response
@@ -1849,7 +1901,12 @@ def get_next(next_link=None):
18491901

18501902
@overload
18511903
def reward_single_slot_event( # pylint: disable=inconsistent-return-statements
1852-
self, event_id: str, reward: JSON, *, content_type: str = "application/json", **kwargs: Any
1904+
self,
1905+
event_id: str,
1906+
reward: JSON,
1907+
*,
1908+
content_type: str = "application/json",
1909+
**kwargs: Any,
18531910
) -> None:
18541911
"""Reward.
18551912
@@ -1881,7 +1938,12 @@ def reward_single_slot_event( # pylint: disable=inconsistent-return-statements
18811938

18821939
@overload
18831940
def reward_single_slot_event( # pylint: disable=inconsistent-return-statements
1884-
self, event_id: str, reward: IO, *, content_type: str = "application/json", **kwargs: Any
1941+
self,
1942+
event_id: str,
1943+
reward: IO,
1944+
*,
1945+
content_type: str = "application/json",
1946+
**kwargs: Any,
18851947
) -> None:
18861948
"""Reward.
18871949
@@ -2277,7 +2339,7 @@ def create_feature_importance( # pylint: disable=inconsistent-return-statements
22772339
feature_importance: JSON,
22782340
*,
22792341
content_type: str = "application/json",
2280-
**kwargs: Any
2342+
**kwargs: Any,
22812343
) -> None:
22822344
"""Create Feature Importance.
22832345
@@ -2314,7 +2376,7 @@ def create_feature_importance( # pylint: disable=inconsistent-return-statements
23142376
feature_importance: IO,
23152377
*,
23162378
content_type: str = "application/json",
2317-
**kwargs: Any
2379+
**kwargs: Any,
23182380
) -> None:
23192381
"""Create Feature Importance.
23202382
@@ -2334,7 +2396,10 @@ def create_feature_importance( # pylint: disable=inconsistent-return-statements
23342396

23352397
@distributed_trace
23362398
def create_feature_importance( # pylint: disable=inconsistent-return-statements
2337-
self, feature_importance_id: str, feature_importance: Union[JSON, IO], **kwargs: Any
2399+
self,
2400+
feature_importance_id: str,
2401+
feature_importance: Union[JSON, IO],
2402+
**kwargs: Any,
23382403
) -> None:
23392404
"""Create Feature Importance.
23402405
@@ -2457,7 +2522,10 @@ def prepare_request(next_link=None):
24572522
)
24582523
path_format_arguments = {
24592524
"Endpoint": self._serialize.url(
2460-
"self._config.endpoint", self._config.endpoint, "str", skip_quote=True
2525+
"self._config.endpoint",
2526+
self._config.endpoint,
2527+
"str",
2528+
skip_quote=True,
24612529
),
24622530
}
24632531
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
@@ -2473,11 +2541,16 @@ def prepare_request(next_link=None):
24732541
)
24742542
_next_request_params["api-version"] = self._config.api_version
24752543
request = HttpRequest(
2476-
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
2544+
"GET",
2545+
urllib.parse.urljoin(next_link, _parsed_next_link.path),
2546+
params=_next_request_params,
24772547
)
24782548
path_format_arguments = {
24792549
"Endpoint": self._serialize.url(
2480-
"self._config.endpoint", self._config.endpoint, "str", skip_quote=True
2550+
"self._config.endpoint",
2551+
self._config.endpoint,
2552+
"str",
2553+
skip_quote=True,
24812554
),
24822555
}
24832556
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
@@ -2500,7 +2573,11 @@ def get_next(next_link=None):
25002573
response = pipeline_response.http_response
25012574

25022575
if response.status_code not in [200]:
2503-
map_error(status_code=response.status_code, response=response, error_map=error_map)
2576+
map_error(
2577+
status_code=response.status_code,
2578+
response=response,
2579+
error_map=error_map,
2580+
)
25042581
raise HttpResponseError(response=response)
25052582

25062583
return pipeline_response
@@ -2836,7 +2913,12 @@ def get_model_properties(self, **kwargs: Any) -> JSON:
28362913

28372914
@overload
28382915
def reward_multi_slot_event( # pylint: disable=inconsistent-return-statements
2839-
self, event_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
2916+
self,
2917+
event_id: str,
2918+
body: JSON,
2919+
*,
2920+
content_type: str = "application/json",
2921+
**kwargs: Any,
28402922
) -> None:
28412923
"""Reward (MultiSlot).
28422924
@@ -2872,7 +2954,12 @@ def reward_multi_slot_event( # pylint: disable=inconsistent-return-statements
28722954

28732955
@overload
28742956
def reward_multi_slot_event( # pylint: disable=inconsistent-return-statements
2875-
self, event_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any
2957+
self,
2958+
event_id: str,
2959+
body: IO,
2960+
*,
2961+
content_type: str = "application/json",
2962+
**kwargs: Any,
28762963
) -> None:
28772964
"""Reward (MultiSlot).
28782965
@@ -3221,7 +3308,13 @@ def rank_multi_slot(self, body: Union[JSON, IO], **kwargs: Any) -> JSON:
32213308
return cast(JSON, deserialized)
32223309

32233310
@overload
3224-
def rank_single_slot(self, rank_request: JSON, *, content_type: str = "application/json", **kwargs: Any) -> JSON:
3311+
def rank_single_slot(
3312+
self,
3313+
rank_request: JSON,
3314+
*,
3315+
content_type: str = "application/json",
3316+
**kwargs: Any,
3317+
) -> JSON:
32253318
"""Rank.
32263319
32273320
Submit a Personalizer rank request. Receives a context and a list of actions. Returns which of

sdk/personalizer/azure-ai-personalizer/azure/ai/personalizer/_patch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
import sys
1212
from typing import List, Union, Any, IO, Iterator, Iterable, Optional
1313
from azure.core.credentials import AzureKeyCredential, TokenCredential
14-
from azure.core.pipeline.policies import AzureKeyCredentialPolicy, BearerTokenCredentialPolicy
14+
from azure.core.pipeline.policies import (
15+
AzureKeyCredentialPolicy,
16+
BearerTokenCredentialPolicy,
17+
)
1518
from azure.core.tracing.decorator import distributed_trace
1619
from azure.core.rest import HttpRequest, HttpResponse
1720

@@ -47,6 +50,7 @@ def _authentication_policy(credential, **kwargs):
4750
)
4851
return authentication_policy
4952

53+
5054
class PersonalizerAdministrationClient: # pylint: disable=too-many-public-methods
5155
"""This client contains the operations that apply to Azure Personalizer. Operations allowed by the client are
5256
viewing and editing the properties, policy, model, running evaluations.

0 commit comments

Comments
 (0)