|
2 | 2 | # Copyright (c) Microsoft Corporation. All rights reserved. |
3 | 3 | # --------------------------------------------------------- |
4 | 4 |
|
| 5 | +# pylint: disable=too-many-lines |
| 6 | + |
5 | 7 | import logging |
6 | 8 | import warnings |
7 | 9 | from os import PathLike |
@@ -802,6 +804,36 @@ def load_connection( |
802 | 804 | return cast(Connection, load_common(Connection, source, relative_origin, params_override, **kwargs)) |
803 | 805 |
|
804 | 806 |
|
| 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 | + |
805 | 837 | def load_schedule( |
806 | 838 | source: Union[str, PathLike, IO[AnyStr]], |
807 | 839 | relative_origin: Optional[str] = None, |
|
0 commit comments