Skip to content

Commit c48ed46

Browse files
authored
32850 Fix mypy typing errors for azure-maps-geolocation (#34984)
* 32850 Fix mypy typing errors for azure-maps-geolocation * 32850: Use optional fileds in CountryRegionResult model * 32850: Enable type check for azure-maps-geolocation
1 parent ab6b74f commit c48ed46

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33
# Licensed under the MIT License.
44
# ------------------------------------
55

6+
from typing import Optional
7+
68
class CountryRegionResult(object):
79
"""Represents coordinate latitude and longitude
810
911
:keyword ip_address:
1012
The IP Address of the request.
11-
:paramtype ip_address: str
13+
:paramtype ip_address: Optional[str]
1214
:keyword iso_code: iso_code:
1315
The IP Address's 2-character code of the country or region.
1416
Please note, IP address in ranges reserved for special purpose will return Null for country/region.
15-
:paramtype iso_code: str
17+
:paramtype iso_code: Optional[str]
1618
"""
1719
def __init__(
1820
self,
19-
ip_address: str = None,
20-
iso_code: str = None
21+
ip_address: Optional[str] = None,
22+
iso_code: Optional[str] = None
2123
):
2224
self.ip_address = ip_address
2325
self.iso_code = iso_code
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[tool.azure-sdk-build]
22
pyright = false
3-
type_check_samples = false
43
verifytypes = false
54
ci_enabled = false
65
strict_sphinx = true

sdk/maps/azure-maps-geolocation/samples/async_samples/sample_authentication_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def authentication_maps_service_client_with_subscription_key_credential_as
3131
from azure.core.credentials import AzureKeyCredential
3232
from azure.maps.geolocation.aio import MapsGeolocationClient
3333

34-
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY")
34+
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") or "your subscription key"
3535

3636
maps_geolocation_client = MapsGeolocationClient(credential=AzureKeyCredential(subscription_key))
3737
# [END create_maps_geolocation_service_client_with_key_async]

sdk/maps/azure-maps-geolocation/samples/async_samples/sample_get_country_code_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import asyncio
2020
import os
2121

22-
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY")
22+
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") or "your subscription key"
2323

2424
async def get_country_code_async():
2525
# [START get_country_code_async]

sdk/maps/azure-maps-geolocation/samples/sample_authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def authentication_maps_service_client_with_subscription_key_credential():
2929
from azure.core.credentials import AzureKeyCredential
3030
from azure.maps.geolocation import MapsGeolocationClient
3131

32-
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY")
32+
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") or "your subscription key"
3333

3434
maps_geolocation_client = MapsGeolocationClient(credential=AzureKeyCredential(subscription_key))
3535
# [END create_maps_geolocation_service_client_with_key]

sdk/maps/azure-maps-geolocation/samples/sample_get_country_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import os
2121

22-
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY")
22+
subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") or "your subscription key"
2323

2424
def get_country_code():
2525
# [START get_country_code]

0 commit comments

Comments
 (0)