Skip to content

Commit a399664

Browse files
committed
lint: formatted the code with black
1 parent 0638e45 commit a399664

File tree

10 files changed

+40
-31
lines changed

10 files changed

+40
-31
lines changed

aml_service/00-WorkSpace.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
name=workspace_name,
4646
subscription_id=subscription_id,
4747
resource_group=resource_group,
48-
auth=cli_auth
48+
auth=cli_auth,
4949
)
5050

5151
except:
@@ -57,8 +57,7 @@
5757
resource_group=resource_group,
5858
# create_resource_group=True,
5959
location=location,
60-
auth=cli_auth
61-
60+
auth=cli_auth,
6261
)
6362

6463
# print Workspace details

aml_service/01-Experiment.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
from azureml.core import Experiment
2828
from azureml.core import Workspace
2929
from azureml.core.authentication import AzureCliAuthentication
30+
3031
cli_auth = AzureCliAuthentication()
3132

33+
3234
def getExperiment():
3335
ws = Workspace.from_config(auth=cli_auth)
3436
script_folder = "."

aml_service/02-AttachTrainingVM.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from azureml.core.compute import DsvmCompute
3535
from azureml.core.compute_target import ComputeTargetException
3636
from azureml.core.authentication import AzureCliAuthentication
37+
3738
cli_auth = AzureCliAuthentication()
3839

3940
# Get workspace

aml_service/03-AttachAmlCluster.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,29 @@
3838
with open("aml_config/security_config.json") as f:
3939
config = json.load(f)
4040

41-
aml_cluster_name = config['aml_cluster_name']
41+
aml_cluster_name = config["aml_cluster_name"]
4242

43-
# un-comment the below lines if you want to put AML Compute under Vnet. Also update /aml_config/security_config.json
43+
# un-comment the below lines if you want to put AML Compute under Vnet. Also update /aml_config/security_config.json
4444
# vnet_resourcegroup_name = config['vnet_resourcegroup_name']
4545
# vnet_name = config['vnet_name']
4646
# subnet_name = config['subnet_name']
4747

4848
# Verify that cluster does not exist already
4949
try:
5050
cpu_cluster = ComputeTarget(workspace=ws, name=aml_cluster_name)
51-
print('Found existing cluster, use it.')
51+
print("Found existing cluster, use it.")
5252
except ComputeTargetException:
53-
compute_config = AmlCompute.provisioning_configuration(vm_size='STANDARD_D2_V2',
54-
vm_priority='dedicated',
55-
min_nodes=1,
56-
max_nodes=3,
57-
idle_seconds_before_scaledown='300',
58-
# #Uncomment the below lines for VNet support
59-
# vnet_resourcegroup_name=vnet_resourcegroup_name,
60-
# vnet_name=vnet_name,
61-
# subnet_name=subnet_name
62-
)
53+
compute_config = AmlCompute.provisioning_configuration(
54+
vm_size="STANDARD_D2_V2",
55+
vm_priority="dedicated",
56+
min_nodes=1,
57+
max_nodes=3,
58+
idle_seconds_before_scaledown="300",
59+
# #Uncomment the below lines for VNet support
60+
# vnet_resourcegroup_name=vnet_resourcegroup_name,
61+
# vnet_name=vnet_name,
62+
# subnet_name=subnet_name
63+
)
6364
cpu_cluster = ComputeTarget.create(ws, aml_cluster_name, compute_config)
6465

65-
cpu_cluster.wait_for_completion(show_output=True)
66+
cpu_cluster.wait_for_completion(show_output=True)

aml_service/10-TrainOnLocal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from azureml.core import ScriptRunConfig
3131
import json
3232
from azureml.core.authentication import AzureCliAuthentication
33+
3334
cli_auth = AzureCliAuthentication()
3435

3536
# Get workspace

aml_service/11-TrainOnLocalEnv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from azureml.core import ScriptRunConfig
3434

3535
from azureml.core.authentication import AzureCliAuthentication
36+
3637
cli_auth = AzureCliAuthentication()
3738

3839
# Get workspace

aml_service/15-EvaluateModel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import azureml.core
3131
from azureml.core import Run
3232
from azureml.core.authentication import AzureCliAuthentication
33+
3334
cli_auth = AzureCliAuthentication()
3435

3536
# Get workspace

aml_service/20-RegisterModel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
from azureml.core.runconfig import RunConfiguration
3333
from azureml.core.authentication import AzureCliAuthentication
34+
3435
cli_auth = AzureCliAuthentication()
3536

3637
# Get workspace

aml_service/50-deployOnAci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
cli_auth = AzureCliAuthentication()
3636
# Get workspace
37-
ws = Workspace.from_config(auth=cli_auth)# Get the Image to deploy details
37+
ws = Workspace.from_config(auth=cli_auth) # Get the Image to deploy details
3838
try:
3939
with open("aml_config/image.json") as f:
4040
config = json.load(f)

tests/unit/data_test.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
def get_absPath(filename):
3434
"""Returns the path of the notebooks folder"""
3535
path = os.path.abspath(
36-
os.path.join(os.path.dirname(__file__), os.path.pardir,
37-
os.path.pardir, "data", filename))
36+
os.path.join(
37+
os.path.dirname(__file__), os.path.pardir, os.path.pardir, "data", filename
38+
)
39+
)
3840
return path
3941

4042

@@ -81,42 +83,42 @@ def get_absPath(filename):
8183
def test_check_schema():
8284
datafile = get_absPath("diabetes.csv")
8385
# check that file exists
84-
assert(os.path.exists(datafile))
86+
assert os.path.exists(datafile)
8587
dataset = pd.read_csv(datafile)
8688
header = dataset[dataset.columns[:-1]]
8789
actual_columns = header.shape[1]
8890
# check header has expected number of columns
89-
assert(actual_columns == expected_columns)
91+
assert actual_columns == expected_columns
9092

9193

9294
def test_check_bad_schema():
9395
datafile = get_absPath("diabetes_bad_schema.csv")
9496
# check that file exists
95-
assert(os.path.exists(datafile))
97+
assert os.path.exists(datafile)
9698
dataset = pd.read_csv(datafile)
9799
header = dataset[dataset.columns[:-1]]
98100
actual_columns = header.shape[1]
99101
# check header has expected number of columns
100-
assert(actual_columns != expected_columns)
102+
assert actual_columns != expected_columns
101103

102104

103105
def test_check_missing_values():
104106
datafile = get_absPath("diabetes_missing_values.csv")
105107
# check that file exists
106-
assert(os.path.exists(datafile))
108+
assert os.path.exists(datafile)
107109
dataset = pd.read_csv(datafile)
108110
n_nan = np.sum(np.isnan(dataset.values))
109-
assert(n_nan > 0)
111+
assert n_nan > 0
110112

111113

112114
def test_check_distribution():
113115
datafile = get_absPath("diabetes_bad_dist.csv")
114116
# check that file exists
115-
assert(os.path.exists(datafile))
117+
assert os.path.exists(datafile)
116118
dataset = pd.read_csv(datafile)
117119
mean = np.mean(dataset.values, axis=0)
118120
std = np.mean(dataset.values, axis=0)
119-
assert(np.sum(abs(mean - historical_mean) > shift_tolerance *
120-
abs(historical_mean)) or
121-
np.sum(abs(std - historical_std) > shift_tolerance *
122-
abs(historical_std)) > 0)
121+
assert (
122+
np.sum(abs(mean - historical_mean) > shift_tolerance * abs(historical_mean))
123+
or np.sum(abs(std - historical_std) > shift_tolerance * abs(historical_std)) > 0
124+
)

0 commit comments

Comments
 (0)