Skip to content

Commit 7a33b93

Browse files
committed
Style changes introduced by black
1 parent 8ceb970 commit 7a33b93

File tree

5 files changed

+30
-24
lines changed

5 files changed

+30
-24
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
source_suffix = ".rst" # The suffix of source filenames.
4949
master_doc = "index" # The master toctree document.
5050

51-
copyright = u"%s, Amazon" % datetime.now().year
51+
copyright = "%s, Amazon" % datetime.now().year
5252

5353
pygments_style = "default"
5454

sagemaker_run_notebook/container_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def create_project(repo_name, role, zipfile, base_image=default_base):
3838
sts = session.client("sts")
3939
identity = sts.get_caller_identity()
4040
account = identity["Account"]
41-
partition = identity["Arn"].split(':')[1]
41+
partition = identity["Arn"].split(":")[1]
4242
args = {
4343
"name": f"create-sagemaker-container-{repo_name}",
4444
"description": f"Build the container {repo_name} for running notebooks in SageMaker",

sagemaker_run_notebook/lambda_function.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def execute_notebook(
2020
):
2121
session = ensure_session()
2222
region = session.region_name
23-
caller_id=session.client("sts").get_caller_identity()
24-
partition = caller_id["Arn"].split(':')[1]
23+
caller_id = session.client("sts").get_caller_identity()
24+
partition = caller_id["Arn"].split(":")[1]
2525
account = caller_id["Account"]
2626
domain = domain_for_region(region)
2727
if not image:
@@ -151,6 +151,7 @@ def ensure_session(session=None):
151151
session = boto3.session.Session()
152152
return session
153153

154+
154155
def domain_for_region(region):
155156
"""Get the DNS suffix for the given region.
156157
Args:
@@ -163,8 +164,8 @@ def domain_for_region(region):
163164
if region.startswith("us-isob-"):
164165
return "sc2s.sgov.gov"
165166
if region.startswith("cn-"):
166-
return "amazonaws.com.cn"
167-
return "amazonaws.com"
167+
return "amazonaws.com.cn"
168+
return "amazonaws.com"
168169

169170

170171
def lambda_handler(event, context):

sagemaker_run_notebook/run_notebook.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def abbreviate_image(image):
4747

4848

4949
abbrev_role_pat = re.compile(
50-
r"arn:aws([^:]*):iam::(?P<account>\d+):role/(?P<name>[^/]+)")
50+
r"arn:aws([^:]*):iam::(?P<account>\d+):role/(?P<name>[^/]+)"
51+
)
5152

5253

5354
def abbreviate_role(role):
@@ -127,15 +128,14 @@ def execute_notebook(
127128
elif "/" not in role:
128129
identity = session.client("sts").get_caller_identity()
129130
account = identity["Account"]
130-
partition = identity["Arn"].split(':')[1]
131+
partition = identity["Arn"].split(":")[1]
131132
role = "arn:{}:iam::{}:role/{}".format(partition, account, role)
132133

133134
if "/" not in image:
134135
account = session.client("sts").get_caller_identity()["Account"]
135136
region = session.region_name
136137
domain = domain_for_region(region)
137-
image = "{}.dkr.ecr.{}.{}/{}:latest".format(
138-
account, region, domain, image)
138+
image = "{}.dkr.ecr.{}.{}/{}:latest".format(account, region, domain, image)
139139

140140
if notebook == None:
141141
notebook = input_path
@@ -145,8 +145,7 @@ def execute_notebook(
145145
timestamp = time.strftime("%Y-%m-%d-%H-%M-%S", time.gmtime())
146146

147147
job_name = (
148-
("papermill-" + re.sub(r"[^-a-zA-Z0-9]",
149-
"-", nb_name))[: 62 - len(timestamp)]
148+
("papermill-" + re.sub(r"[^-a-zA-Z0-9]", "-", nb_name))[: 62 - len(timestamp)]
150149
+ "-"
151150
+ timestamp
152151
)
@@ -636,7 +635,7 @@ def create_lambda(role=None, session=None):
636635
if "/" not in role:
637636
identity = session.client("sts").get_caller_identity()
638637
account = identity["Account"]
639-
partition = identity["Arn"].split(':')[1]
638+
partition = identity["Arn"].split(":")[1]
640639
role = "arn:{}:iam::{}:role/{}".format(partition, account, role)
641640

642641
code_bytes = zip_bytes(code_file)
@@ -788,9 +787,8 @@ def proc(extras):
788787
if "/" not in image:
789788
account = session.client("sts").get_caller_identity()["Account"]
790789
region = session.region_name
791-
domain = domain_for_region(region)
792-
image = "{}.dkr.ecr.{}.{}/{}:latest".format(
793-
account, region, domain, image)
790+
domain = domain_for_region(region)
791+
image = "{}.dkr.ecr.{}.{}/{}:latest".format(account, region, domain, image)
794792

795793
if not role:
796794
try:
@@ -801,7 +799,7 @@ def proc(extras):
801799
if "/" not in role:
802800
identity = session.client("sts").get_caller_identity()
803801
account = identity["Account"]
804-
partition = identity["Arn"].split(':')[1]
802+
partition = identity["Arn"].split(":")[1]
805803
role = "arn:{}:iam::{}:role/{}".format(partition, account, role)
806804

807805
if input_path is None:
@@ -918,8 +916,7 @@ def proc(extras):
918916
account = session.client("sts").get_caller_identity()["Account"]
919917
region = session.region_name
920918
domain = domain_for_region(region)
921-
image = "{}.dkr.ecr.{}.{}/{}:latest".format(
922-
account, region, domain, image)
919+
image = "{}.dkr.ecr.{}.{}/{}:latest".format(account, region, domain, image)
923920

924921
if not role:
925922
try:
@@ -930,7 +927,7 @@ def proc(extras):
930927
if "/" not in role:
931928
identity = session.client("sts").get_caller_identity()
932929
account = identity["Account"]
933-
partition = identity["Arn"].split(':')[1]
930+
partition = identity["Arn"].split(":")[1]
934931
role = "arn:{}:iam::{}:role/{}".format(partition, account, role)
935932

936933
if input_path is None:
@@ -963,7 +960,7 @@ def proc(extras):
963960
)
964961
identity = session.client("sts").get_caller_identity()
965962
account = identity["Account"]
966-
partition = identity["Arn"].split(':')[1]
963+
partition = identity["Arn"].split(":")[1]
967964
region = session.region_name
968965
target_arn = "arn:{}:lambda:{}:{}:function:{}".format(
969966
partition, region, account, lambda_function_name

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@
2323
# Get our version
2424
version = get_version(str(Path(HERE) / name / "server_extension" / "_version.py"))
2525

26-
lab_path = Path(HERE) / "labextension"
26+
lab_path = Path(HERE) / "labextension"
2727

2828
data_files_spec = [
29-
("share/jupyter/labextensions/%s/static" % name, str(lab_path / name / "labextension" / "static"), "**"),
30-
("share/jupyter/labextensions/%s" % name, str(lab_path / name / "labextension"), "package.json"),
29+
(
30+
"share/jupyter/labextensions/%s/static" % name,
31+
str(lab_path / name / "labextension" / "static"),
32+
"**",
33+
),
34+
(
35+
"share/jupyter/labextensions/%s" % name,
36+
str(lab_path / name / "labextension"),
37+
"package.json",
38+
),
3139
(
3240
"etc/jupyter/jupyter_notebook_config.d",
3341
"sagemaker_run_notebook/server_extension/jupyter-config/jupyter_notebook_config.d",

0 commit comments

Comments
 (0)