Skip to content

Commit de4d77b

Browse files
Unexclude constants folder (#34013)
* unexclude constants folder * fix mypy errors
1 parent 5861568 commit de4d77b

File tree

18 files changed

+28
-29
lines changed

18 files changed

+28
-29
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/constants/_component.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# ---------------------------------------------------------
44

5+
from typing import Dict
6+
57
DO_WHILE_MAX_ITERATION = 1000
68

79

@@ -106,7 +108,7 @@ class IOConstants:
106108
ComponentParameterTypes.NUMBER: "Number",
107109
ComponentParameterTypes.BOOLEAN: "Boolean",
108110
}
109-
PARAM_PARSERS = {
111+
PARAM_PARSERS: Dict = {
110112
ComponentParameterTypes.INTEGER: lambda v: int(float(v)), # parse case like 10.0 -> 10
111113
ComponentParameterTypes.BOOLEAN: lambda v: str(v).lower() == "true",
112114
ComponentParameterTypes.NUMBER: float,

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/_artifacts/model.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ def _update_path(self, asset_artifact: ArtifactStorageInfo) -> None:
198198
asset_artifact.relative_path,
199199
)
200200

201-
def _to_arm_resource_param(
202-
self, **kwargs: Any # pylint: disable=unused-argument
203-
) -> ArmConstants.MODEL_VERSION_TYPE:
201+
def _to_arm_resource_param(self, **kwargs: Any) -> Dict: # pylint: disable=unused-argument
204202
properties = self._to_rest_object().properties
205203

206204
return {

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_credentials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# pylint: disable=protected-access,redefined-builtin
66

77
from abc import ABC
8-
from typing import Dict, List, Optional, Union
8+
from typing import Any, Dict, List, Optional, Union
99

1010
from azure.ai.ml._azure_environments import _get_active_directory_url_from_metadata
1111
from azure.ai.ml._restclient.v2022_01_01_preview.models import Identity as RestIdentityConfiguration
@@ -66,7 +66,7 @@
6666

6767
class _BaseIdentityConfiguration(ABC, DictMixin, RestTranslatableMixin):
6868
def __init__(self) -> None:
69-
self.type = None
69+
self.type: Any = None
7070

7171

7272
class AccountKeyConfiguration(RestTranslatableMixin, DictMixin):

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DistributionConfiguration(RestTranslatableMixin):
3333
"""
3434

3535
def __init__(self, **kwargs: Any) -> None:
36-
self.type = None
36+
self.type: Any = None
3737

3838
@classmethod
3939
def _from_rest_object(

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/job_limits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class JobLimits(RestTranslatableMixin, ABC):
2424
def __init__(
2525
self,
2626
) -> None:
27-
self.type = None
27+
self.type: Any = None
2828

2929
def __eq__(self, other: Any) -> bool:
3030
if not isinstance(other, JobLimits):

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/job_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__( # pylint: disable=unused-argument
5353
**kwargs: Dict,
5454
) -> None:
5555
self.endpoint = endpoint
56-
self.type = type
56+
self.type: Any = type
5757
self.nodes = nodes
5858
self.status = status
5959
self.port = port
@@ -109,7 +109,9 @@ def _to_rest_job_services(
109109
def _from_rest_job_service_object(cls, obj: RestJobService) -> "JobServiceBase":
110110
return cls(
111111
endpoint=obj.endpoint,
112-
type=JobServiceTypeNames.REST_TO_ENTITY.get(obj.job_service_type, None) if obj.job_service_type else None,
112+
type=JobServiceTypeNames.REST_TO_ENTITY.get(obj.job_service_type, None) # type: ignore[arg-type]
113+
if obj.job_service_type
114+
else None,
113115
nodes="all" if obj.nodes else None,
114116
status=obj.status,
115117
port=obj.port,

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_pipeline_expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _enumerate_operation_combination() -> Dict[str, Union[str, Exception]]:
6060
* An Exception
6161
:rtype: Dict[str, Union[str, Exception]]
6262
"""
63-
res = {}
63+
res: Dict = {}
6464
primitive_types_values = {
6565
NONE_PARAMETER_TYPE: repr(None),
6666
ComponentParameterTypes.BOOLEAN: repr(True),

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/queue_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _validate(self) -> None:
7777
error_category=ErrorCategory.USER_ERROR,
7878
error_type=ValidationErrorType.INVALID_VALUE,
7979
)
80-
valid_keys = list(enum_class.ENTITY_TO_REST.keys())
80+
valid_keys = list(enum_class.ENTITY_TO_REST.keys()) # type: ignore[attr-defined]
8181
if value and value.lower() not in valid_keys:
8282
msg = f"{key} should be one of {valid_keys}, but received '{value}'."
8383
raise ValidationException(

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_monitoring/definition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _from_rest_object(
102102
obj: RestMonitorDefinition,
103103
**kwargs: Any,
104104
) -> "MonitorDefinition":
105-
from_rest_alert_notification = None
105+
from_rest_alert_notification: Any = None
106106
if obj.alert_notification_setting:
107107
if isinstance(obj.alert_notification_setting, AzMonMonitoringAlertNotificationSettings):
108108
from_rest_alert_notification = AZMONITORING

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_monitoring/input_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class MonitorInputData(RestTranslatableMixin):
3838
def __init__(
3939
self,
4040
*,
41-
type: MonitorInputDataType = None,
42-
data_context: MonitorDatasetContext = None,
41+
type: Optional[MonitorInputDataType] = None,
42+
data_context: Optional[MonitorDatasetContext] = None,
4343
target_columns: Optional[Dict] = None,
4444
job_type: Optional[str] = None,
4545
uri: Optional[str] = None,

0 commit comments

Comments
 (0)