Skip to content

Commit 7c624e0

Browse files
authored
re-add load_workspace_connection (Azure#35437)
* re-add load_workspace_connection * run black * fix pytlin * comments
1 parent 91813fc commit 7c624e0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

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

5+
# pylint: disable=too-many-lines
6+
57
import logging
68
import warnings
79
from os import PathLike
@@ -802,6 +804,36 @@ def load_connection(
802804
return cast(Connection, load_common(Connection, source, relative_origin, params_override, **kwargs))
803805

804806

807+
# Unlike other aspects of connections, this wasn't made experimental, and thus couldn't just be replaced
808+
# During the renaming from 'workspace connection' to just 'connection'.
809+
def load_workspace_connection(
810+
source: Union[str, PathLike, IO[AnyStr]],
811+
*,
812+
relative_origin: Optional[str] = None,
813+
**kwargs: Any,
814+
) -> Connection:
815+
"""Construct a connection object from yaml file.
816+
817+
:param source: The local yaml source of a connection object. Must be either a
818+
path to a local file, or an already-open file.
819+
If the source is a path, it will be open and read.
820+
An exception is raised if the file does not exist.
821+
If the source is an open file, the file will be read directly,
822+
and an exception is raised if the file is not readable.
823+
:type source: Union[PathLike, str, io.TextIOWrapper]
824+
:keyword relative_origin: The origin to be used when deducing
825+
the relative locations of files referenced in the parsed yaml.
826+
Defaults to the inputted source's directory if it is a file or file path input.
827+
Defaults to "./" if the source is a stream input with no name value.
828+
:paramtype relative_origin: str
829+
830+
:return: Constructed connection object.
831+
:rtype: Connection
832+
833+
"""
834+
return load_workspace_connection(source, relative_origin=relative_origin, **kwargs)
835+
836+
805837
def load_schedule(
806838
source: Union[str, PathLike, IO[AnyStr]],
807839
relative_origin: Optional[str] = None,

0 commit comments

Comments
 (0)