Skip to content

Commit 8694c6d

Browse files
Remove usages of protected variables/class from external libraries [azure-ai-ml] (Azure#39875)
* remove protected variables/class usage * correct variable * update changelog
1 parent 5d3777d commit 8694c6d

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
- #39744 - Fixing a serialization issue in RecurrencePattern schedule.
1111
- Fix environment archiving and restore
1212

13+
### Other Changes
14+
- Removing use of protected methods/classes imported from external libraries.
15+
1316
## 1.25.0 (2025-02-11)
1417

1518
### Features Added

sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_group_decorator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# disable redefined-builtin to use globals/locals as argument name
66

77
# Attribute on customized group class to mark a value type as a group of inputs/outputs.
8-
import _thread
8+
import threading
99
import functools
1010
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union
1111

@@ -271,7 +271,7 @@ def _recursive_repr(user_function: Any) -> Any:
271271

272272
@functools.wraps(user_function)
273273
def wrapper(self: Any) -> Any:
274-
key = id(self), _thread.get_ident()
274+
key = id(self), threading.get_ident()
275275
if key in repr_running:
276276
return "..."
277277
repr_running.add(key)

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_autogen_entities/_model_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from azure.core.exceptions import DeserializationError
2525
from azure.core import CaseInsensitiveEnumMeta
2626
from azure.core.pipeline import PipelineResponse
27-
from azure.core.serialization import _Null
27+
from azure.core.serialization import NULL
2828

2929
if sys.version_info >= (3, 9):
3030
from collections.abc import MutableMapping
@@ -145,7 +145,7 @@ def default(self, o): # pylint: disable=too-many-return-statements
145145
try:
146146
return super(SdkJSONEncoder, self).default(o)
147147
except TypeError:
148-
if isinstance(o, _Null):
148+
if isinstance(o, type(NULL)):
149149
return None
150150
if isinstance(o, decimal.Decimal):
151151
return float(o)
@@ -581,7 +581,7 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.
581581

582582
@staticmethod
583583
def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any:
584-
if v is None or isinstance(v, _Null):
584+
if v is None or isinstance(v, type(NULL)):
585585
return None
586586
if isinstance(v, (list, tuple, set)):
587587
return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v)
@@ -754,7 +754,7 @@ def _deserialize_with_callable(
754754
value: typing.Any,
755755
):
756756
try:
757-
if value is None or isinstance(value, _Null):
757+
if value is None or isinstance(value, type(NULL)):
758758
return None
759759
if deserializer is None:
760760
return value

0 commit comments

Comments
 (0)