From f94358ed9dc125aa49a1cc73c61572a58b1fe95a Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Tue, 7 Feb 2023 08:27:44 -0500 Subject: [PATCH] Fixing pylint issues --- .../azure-ai-ml/azure/ai/ml/_azure_environments.py | 14 +++++--------- .../azure-ai-ml/azure/ai/ml/constants/_common.py | 1 - .../unittests/test_cloud_environments.py | 2 -- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py index 16c7fd3ec56e..c42317356990 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py @@ -9,14 +9,11 @@ from typing import Dict, Optional from azure.ai.ml._utils.utils import _get_mfe_url_override -from azure.ai.ml._utils._http_utils import HttpPipeline from azure.ai.ml.constants._common import AZUREML_CLOUD_ENV_NAME from azure.ai.ml.constants._common import ArmConstants from azure.core.rest import HttpRequest from azure.mgmt.core import ARMPipelineClient -from pprint import pformat - module_logger = logging.getLogger(__name__) @@ -100,7 +97,7 @@ def _get_cloud_details(cloud: str = AzureEnvironments.ENV_DEFAULT): def _set_cloud(cloud: str = AzureEnvironments.ENV_DEFAULT): """Sets the current cloud - + :param cloud: cloud name """ if cloud is not None: @@ -216,13 +213,14 @@ def _get_registry_discovery_url(cloud, cloud_suffix=""): """Get or generate the registry discovery url :param cloud: configuration of the cloud to get the registry_discovery_url from - :param cloud_suffix: the suffix to use for the cloud, in the case that the registry_discovery_url must be generated + :param cloud_suffix: the suffix to use for the cloud, in the case that the registry_discovery_url + must be generated :return: string of discovery url """ cloud_name = cloud["name"] if cloud_name in _environments: return _environments[cloud_name].registry_url - + registry_discovery_region = os.environ.get( ArmConstants.REGISTRY_DISCOVERY_REGION_ENV_NAME, ArmConstants.REGISTRY_DISCOVERY_DEFAULT_REGION @@ -233,10 +231,8 @@ def _get_registry_discovery_url(cloud, cloud_suffix=""): cloud_suffix ) return os.environ.get(ArmConstants.REGISTRY_ENV_URL, registry_discovery_region_default) - - -def _get_clouds_by_metadata_url(metadata_url, timeout=ArmConstants.DEFAULT_TIMEOUT): +def _get_clouds_by_metadata_url(metadata_url): """Get all the clouds by the specified metadata url :return: list of the clouds diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py index 4f2ea1764bad..fd01fd4ca5e9 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py @@ -273,7 +273,6 @@ class ArmConstants(object): AZURE_MGMT_KEYVAULT_API_VERSION = "2019-09-01" AZURE_MGMT_CONTAINER_REG_API_VERSION = "2019-05-01" - DEFAULT_TIMEOUT = 30 DEFAULT_URL = "https://management.azure.com/metadata/endpoints?api-version=2019-05-01" METADATA_URL_ENV_NAME = "ARM_CLOUD_METADATA_URL" REGISTRY_DISCOVERY_DEFAULT_REGION = "west" diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py index d82629c78e3e..93f0df644dee 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_cloud_environments.py @@ -2,7 +2,6 @@ import mock import pytest from mock import MagicMock, patch -import requests from azure.ai.ml._azure_environments import ( AzureEnvironments, @@ -113,7 +112,6 @@ def test_get_default_cloud(self): with mock.patch("os.environ", {AZUREML_CLOUD_ENV_NAME: "yadadada"}): cloud_name = _get_default_cloud_name() assert cloud_name == "yadadada" - def test_get_registry_endpoint_from_public(self): cloud_environment = AzureEnvironments.ENV_DEFAULT