Skip to content

Commit 1dc0898

Browse files
refactor: lazy imports of expensive libs
1 parent 3b51ff5 commit 1dc0898

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

.vscode/launch.json

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,34 @@
33
"configurations": [
44
{
55
"name": "Azure CLI Debug (Integrated Console)",
6-
"type": "python",
6+
"type": "debugpy",
77
"request": "launch",
88
"python": "${command:python.interpreterPath}",
99
"program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py",
1010
"cwd": "${workspaceRoot}",
1111
"args": [
12-
"--help"
12+
"Version"
1313
],
1414
"console": "integratedTerminal",
15-
"debugOptions": [
16-
"WaitOnAbnormalExit",
17-
"WaitOnNormalExit",
18-
"RedirectOutput"
19-
],
2015
"justMyCode": false
2116
},
2217
{
2318
"name": "Azure CLI Debug (External Console)",
24-
"type": "python",
19+
"type": "debugpy",
2520
"request": "launch",
2621
"stopOnEntry": true,
2722
"python": "${command:python.interpreterPath}",
2823
"program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py",
2924
"cwd": "${workspaceRoot}",
3025
"args": [
31-
"--help"
26+
"VERSION"
3227
],
3328
"console": "externalTerminal",
34-
"debugOptions": [
35-
"WaitOnAbnormalExit",
36-
"WaitOnNormalExit"
37-
]
29+
"justMyCode": false
3830
},
3931
{
4032
"name": "Azdev Scripts",
41-
"type": "python",
33+
"type": "debugpy",
4234
"request": "launch",
4335
"python": "${command:python.interpreterPath}",
4436
"program": "${workspaceRoot}/tools/automation/__main__.py",
@@ -47,11 +39,6 @@
4739
"--help"
4840
],
4941
"console": "integratedTerminal",
50-
"debugOptions": [
51-
"WaitOnAbnormalExit",
52-
"WaitOnNormalExit",
53-
"RedirectOutput"
54-
]
5542
}
5643
]
57-
}
44+
}

src/azure-cli-core/azure/cli/core/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
import binascii
99
import getpass
1010
import json
11-
import yaml
1211
import logging
1312
import os
1413
import platform
1514
import re
1615
import ssl
1716
import sys
18-
from urllib.request import urlopen
1917

2018
from knack.log import get_logger
2119
from knack.util import CLIError, to_snake_case, to_camel_case
@@ -534,6 +532,7 @@ def get_file_json(file_path, throw_on_empty=True, preserve_order=False):
534532

535533

536534
def get_file_yaml(file_path, throw_on_empty=True):
535+
import yaml
537536
content = read_file_content(file_path)
538537
if not content:
539538
if throw_on_empty:
@@ -1168,6 +1167,7 @@ def _ssl_context():
11681167

11691168

11701169
def urlretrieve(url):
1170+
from urllib.request import urlopen
11711171
req = urlopen(url, context=_ssl_context())
11721172
return req.read()
11731173

0 commit comments

Comments
 (0)