Skip to content

Commit dad2f74

Browse files
authored
Update Route changelog for the release (#38361)
* Update changelog * Apply formatting
1 parent 2139c12 commit dad2f74

25 files changed

+187
-266
lines changed

sdk/maps/azure-maps-route/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Release History
22

3-
## 1.0.0b2 (2024-05-15)
3+
## 1.0.0b2 (2024-11-06)
4+
5+
### Breaking Changes
6+
7+
- Updated `get_route_matrix` to accept a `RouteMatrixQuery` object instead of a dictionary.
48

59
### Other Changes
610

sdk/maps/azure-maps-route/azure/maps/route/_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ def __init__(
7878
self._deserialize = Deserializer(client_models)
7979
self._serialize.client_side_validation = False
8080
super().__init__(
81-
client=self._client,
82-
config=self._config,
83-
serializer=self._serialize,
84-
deserializer=self._deserialize
81+
client=self._client, config=self._config, serializer=self._serialize, deserializer=self._deserialize
8582
)
8683

8784
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:

sdk/maps/azure-maps-route/azure/maps/route/_patch.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,25 @@ def patch_sdk():
2525
https://aka.ms/azsdk/python/dpcodegen/python/customize
2626
"""
2727

28+
2829
# To check the credential is either AzureKeyCredential or TokenCredential
2930
def _authentication_policy(credential):
3031
authentication_policy = None
3132
if credential is None:
3233
raise ValueError("Parameter 'credential' must not be None.")
3334
if isinstance(credential, AzureKeyCredential):
34-
authentication_policy = AzureKeyCredentialPolicy(
35-
name="subscription-key", credential=credential
36-
)
35+
authentication_policy = AzureKeyCredentialPolicy(name="subscription-key", credential=credential)
3736
elif credential is not None and not hasattr(credential, "get_token"):
3837
raise TypeError(
3938
"Unsupported credential: {}. Use an instance of AzureKeyCredential "
4039
"or a token credential from azure.identity".format(type(credential))
4140
)
4241
return authentication_policy
4342

43+
4444
# pylint: disable=C4748
4545
class MapsRouteClient(MapsRouteClientGenerated):
46-
def __init__(
47-
self,
48-
credential: Union[AzureKeyCredential, TokenCredential],
49-
**kwargs: Any
50-
) -> None:
46+
def __init__(self, credential: Union[AzureKeyCredential, TokenCredential], **kwargs: Any) -> None:
5147

5248
super().__init__(
5349
credential=credential, # type: ignore

sdk/maps/azure-maps-route/azure/maps/route/aio/_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ def __init__(
7878
self._deserialize = Deserializer(client_models)
7979
self._serialize.client_side_validation = False
8080
super().__init__(
81-
client=self._client,
82-
config=self._config,
83-
serializer=self._serialize,
84-
deserializer=self._deserialize
81+
client=self._client, config=self._config, serializer=self._serialize, deserializer=self._deserialize
8582
)
8683

8784
def send_request(

sdk/maps/azure-maps-route/azure/maps/route/aio/_patch.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,25 @@ def patch_sdk():
2626
https://aka.ms/azsdk/python/dpcodegen/python/customize
2727
"""
2828

29+
2930
# To check the credential is either AzureKeyCredential or TokenCredential
3031
def _authentication_policy(credential):
3132
authentication_policy = None
3233
if credential is None:
3334
raise ValueError("Parameter 'credential' must not be None.")
3435
if isinstance(credential, AzureKeyCredential):
35-
authentication_policy = AzureKeyCredentialPolicy(
36-
name="subscription-key", credential=credential
37-
)
36+
authentication_policy = AzureKeyCredentialPolicy(name="subscription-key", credential=credential)
3837
elif credential is not None and not hasattr(credential, "get_token"):
3938
raise TypeError(
4039
"Unsupported credential: {}. Use an instance of AzureKeyCredential "
4140
"or a token credential from azure.identity".format(type(credential))
4241
)
4342
return authentication_policy
4443

44+
4545
# pylint: disable=C4748
4646
class MapsRouteClient(MapsRouteClientGenerated):
47-
def __init__(
48-
self,
49-
credential: Union[AzureKeyCredential, AsyncTokenCredential],
50-
**kwargs: Any
51-
) -> None:
47+
def __init__(self, credential: Union[AzureKeyCredential, AsyncTokenCredential], **kwargs: Any) -> None:
5248

5349
super().__init__(
5450
credential=credential, # type: ignore

sdk/maps/azure-maps-route/azure/maps/route/aio/operations/_patch.py

Lines changed: 31 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
RouteMatrixQuery,
2323
RouteMatrixResult,
2424
BatchRequest,
25-
BatchRequestItem
25+
BatchRequestItem,
2626
)
2727
from ._operations import RouteOperations as RouteOperationsGenerated
2828

@@ -36,12 +36,12 @@ def patch_sdk():
3636
you can't accomplish using the techniques described in
3737
https://aka.ms/azsdk/python/dpcodegen/python/customize
3838
"""
39+
40+
3941
class RouteOperations(RouteOperationsGenerated):
4042
@distributed_trace_async
41-
async def get_route_directions( # type: ignore
42-
self,
43-
route_points: Union[List[LatLongPair], List[Tuple]],
44-
**kwargs: Any
43+
async def get_route_directions( # type: ignore
44+
self, route_points: Union[List[LatLongPair], List[Tuple]], **kwargs: Any
4545
) -> RouteDirections:
4646
"""
4747
Returns a route between an origin and a destination, passing through waypoints if they are
@@ -269,38 +269,31 @@ async def get_route_directions( # type: ignore
269269
coordinates.append(f"{route_point[0]},{route_point[1]}")
270270
query_items = ":".join(coordinates)
271271

272-
supporting_points = kwargs.pop('supporting_points', None)
273-
avoid_vignette = kwargs.pop('avoid_vignette', None)
274-
allow_vignette = kwargs.pop('allow_vignette', None)
275-
avoid_areas = kwargs.pop('avoid_areas', None)
272+
supporting_points = kwargs.pop("supporting_points", None)
273+
avoid_vignette = kwargs.pop("avoid_vignette", None)
274+
allow_vignette = kwargs.pop("allow_vignette", None)
275+
avoid_areas = kwargs.pop("avoid_areas", None)
276276

277277
if supporting_points or avoid_areas or allow_vignette or avoid_vignette:
278278
route_directions_body = RouteDirectionParameters(
279279
supporting_points=supporting_points,
280280
avoid_vignette=avoid_vignette,
281281
allow_vignette=allow_vignette,
282-
avoid_areas=avoid_areas
282+
avoid_areas=avoid_areas,
283283
)
284284
return await super().get_route_directions_with_additional_parameters(
285285
route_direction_parameters=route_directions_body,
286286
format=ResponseFormat.JSON,
287287
route_points=query_items,
288-
**kwargs
288+
**kwargs,
289289
)
290-
return await super().get_route_directions(
291-
format=ResponseFormat.JSON,
292-
route_points=query_items,
293-
**kwargs
294-
)
290+
return await super().get_route_directions(format=ResponseFormat.JSON, route_points=query_items, **kwargs)
295291

296292
# cSpell:disable
297293
@distributed_trace_async
298-
async def get_route_range( # type: ignore
299-
self,
300-
coordinates: Union[LatLongPair, Tuple[float, float]],
301-
**kwargs: Any
294+
async def get_route_range( # type: ignore
295+
self, coordinates: Union[LatLongPair, Tuple[float, float]], **kwargs: Any
302296
) -> RouteRangeResult:
303-
304297
"""**Route Range (Isochrone) API**
305298
306299
This service will calculate a set of locations that can be reached from the origin point based
@@ -461,20 +454,10 @@ async def get_route_range( # type: ignore
461454
elif isinstance(coordinates, LatLongPair) and coordinates.latitude and coordinates.longitude:
462455
query = [coordinates.latitude, coordinates.longitude]
463456

464-
return await super().get_route_range(
465-
format=ResponseFormat.JSON,
466-
query=query,
467-
**kwargs
468-
)
469-
457+
return await super().get_route_range(format=ResponseFormat.JSON, query=query, **kwargs)
470458

471459
@distributed_trace_async
472-
async def get_route_directions_batch_sync(
473-
self,
474-
queries: List[str],
475-
**kwargs: Any
476-
) -> RouteDirectionsBatchResult:
477-
460+
async def get_route_directions_batch_sync(self, queries: List[str], **kwargs: Any) -> RouteDirectionsBatchResult:
478461
"""Sends batches of route directions requests.
479462
The method return the result directly.
480463
@@ -491,15 +474,13 @@ async def get_route_directions_batch_sync(
491474
route_directions_batch_queries=BatchRequest(
492475
batch_items=[BatchRequestItem(query=f"?query={query}") for query in queries] if queries else []
493476
),
494-
**kwargs
477+
**kwargs,
495478
)
496479

497480
@distributed_trace_async
498-
async def begin_get_route_directions_batch( # type: ignore
499-
self,
500-
**kwargs: Any
481+
async def begin_get_route_directions_batch( # type: ignore
482+
self, **kwargs: Any
501483
) -> AsyncLROPoller[RouteDirectionsBatchResult]:
502-
503484
"""Sends batches of route direction queries.
504485
The method returns a poller for retrieving the result later.
505486
@@ -520,14 +501,12 @@ async def begin_get_route_directions_batch( # type: ignore
520501
:rtype: ~azure.core.polling.AsyncLROPoller[RouteDirectionsBatchResult]
521502
:raises ~azure.core.exceptions.HttpResponseError:
522503
"""
523-
queries=kwargs.pop('queries', None)
524-
batch_id=kwargs.pop('batch_id', None)
504+
queries = kwargs.pop("queries", None)
505+
batch_id = kwargs.pop("batch_id", None)
525506

526507
if batch_id:
527508
poller = await super().begin_get_route_directions_batch(
528-
format=ResponseFormat.JSON,
529-
batch_id=batch_id,
530-
**kwargs
509+
format=ResponseFormat.JSON, batch_id=batch_id, **kwargs
531510
)
532511
return poller
533512

@@ -536,25 +515,20 @@ async def begin_get_route_directions_batch( # type: ignore
536515
route_directions_batch_queries=BatchRequest(
537516
batch_items=[BatchRequestItem(query=f"?query={query}") for query in queries] if queries else []
538517
),
539-
**kwargs
518+
**kwargs,
540519
)
541520

542521
polling_method = batch_poller.polling_method()
543522
if hasattr(polling_method, "_operation"):
544523
operation = polling_method._operation
545-
batch_poller.batch_id = operation._location_url.split('/')[-1].split('?')[0]
524+
batch_poller.batch_id = operation._location_url.split("/")[-1].split("?")[0]
546525
else:
547526
batch_poller.batch_id = None
548527

549528
return batch_poller
550529

551530
@distributed_trace_async
552-
async def get_route_matrix(
553-
self,
554-
query: RouteMatrixQuery,
555-
**kwargs: Any
556-
) -> RouteMatrixResult:
557-
531+
async def get_route_matrix(self, query: RouteMatrixQuery, **kwargs: Any) -> RouteMatrixResult:
558532
"""
559533
Calculates a matrix of route summaries for a set of routes defined by origin and destination locations.
560534
The method return the result directly.
@@ -659,18 +633,10 @@ async def get_route_matrix(
659633
:rtype: ~azure.maps.route.models.RouteMatrixResult
660634
:raises ~azure.core.exceptions.HttpResponseError:
661635
"""
662-
return await super().request_route_matrix_sync(
663-
format=ResponseFormat.JSON,
664-
route_matrix_query=query,
665-
**kwargs
666-
)
636+
return await super().request_route_matrix_sync(format=ResponseFormat.JSON, route_matrix_query=query, **kwargs)
667637

668638
@distributed_trace_async
669-
async def begin_get_route_matrix_batch(
670-
self,
671-
**kwargs: Any
672-
) -> AsyncLROPoller[RouteMatrixResult]:
673-
639+
async def begin_get_route_matrix_batch(self, **kwargs: Any) -> AsyncLROPoller[RouteMatrixResult]:
674640
"""
675641
Calculates a matrix of route summaries for a set of routes defined by origin and destination locations.
676642
The method returns a poller for retrieving the result later.
@@ -785,18 +751,13 @@ async def begin_get_route_matrix_batch(
785751
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteMatrixResult]
786752
:raises ~azure.core.exceptions.HttpResponseError:
787753
"""
788-
query=kwargs.pop('query', None)
789-
matrix_id = kwargs.pop('matrix_id', None)
754+
query = kwargs.pop("query", None)
755+
matrix_id = kwargs.pop("matrix_id", None)
790756

791757
if matrix_id:
792-
return await super().begin_get_route_matrix(
793-
matrix_id=matrix_id,
794-
**kwargs
795-
)
758+
return await super().begin_get_route_matrix(matrix_id=matrix_id, **kwargs)
796759

797760
poller = await super().begin_request_route_matrix(
798-
format=ResponseFormat.JSON,
799-
route_matrix_query=query,
800-
**kwargs
761+
format=ResponseFormat.JSON, route_matrix_query=query, **kwargs
801762
)
802763
return poller

sdk/maps/azure-maps-route/azure/maps/route/models/_models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
if TYPE_CHECKING:
2121
from .. import models as _models
22-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
22+
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
2323

2424

2525
class BatchRequest(_serialization.Model):
@@ -429,7 +429,7 @@ def __init__(
429429
self.properties = properties
430430
self.id = id
431431
self.feature_type = feature_type
432-
self.type: str = "Feature" # type: ignore
432+
self.type: str = "Feature" # type: ignore
433433

434434

435435
class GeoJsonFeatureCollectionData(_serialization.Model):
@@ -491,7 +491,7 @@ def __init__(self, *, features: List["_models.GeoJsonFeature"], **kwargs: Any) -
491491
"""
492492
super().__init__(features=features, **kwargs)
493493
self.features = features
494-
self.type: str = "FeatureCollection" # type: ignore
494+
self.type: str = "FeatureCollection" # type: ignore
495495

496496

497497
class GeoJsonGeometry(GeoJsonObject):
@@ -537,7 +537,7 @@ class GeoJsonGeometry(GeoJsonObject):
537537
def __init__(self, **kwargs: Any) -> None:
538538
""" """
539539
super().__init__(**kwargs)
540-
self.type: str = "GeoJsonGeometry" # type: ignore
540+
self.type: str = "GeoJsonGeometry" # type: ignore
541541

542542

543543
class GeoJsonGeometryCollectionData(_serialization.Model):

sdk/maps/azure-maps-route/azure/maps/route/operations/_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4375,7 +4375,7 @@ def get_route_directions_with_additional_parameters( # pylint: disable=name-too
43754375
consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is
43764376
provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will
43774377
again use 60 km/hour. Default value is 0.
4378-
4378+
43794379
:paramtype vehicle_max_speed: int
43804380
:keyword vehicle_weight: Weight of the vehicle in kilograms.
43814381

0 commit comments

Comments
 (0)