Skip to content

Commit 5ca9f1a

Browse files
committed
Update s3 path splitting in notebooks
1 parent 2f8dac9 commit 5ca9f1a

File tree

5 files changed

+5
-10
lines changed

5 files changed

+5
-10
lines changed

examples/tensorflow/image-classifier/inception.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@
150150
"\n",
151151
"else:\n",
152152
" try:\n",
153-
" bucket = re.search(\"s3://(.+?)/\", S3_UPLOAD_PATH).group(1)\n",
154-
" key = re.search(\"s3://.+?/(.+)\", S3_UPLOAD_PATH).group(1)\n",
153+
" bucket, key = re.match(\"s3://(.+?)/(.+)\", S3_UPLOAD_PATH).groups()\n",
155154
" except:\n",
156155
" print(\"\\033[91m{}\\033[00m\".format(\"ERROR: Invalid s3 path (should be of the form s3://my-bucket/path/to/file)\"), file=sys.stderr)"
157156
],

examples/tensorflow/iris-classifier/tensorflow.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@
235235
"\n",
236236
"else:\n",
237237
" try:\n",
238-
" bucket = re.search(\"s3://(.+?)/\", S3_UPLOAD_PATH).group(1)\n",
239-
" key = re.search(\"s3://.+?/(.+)\", S3_UPLOAD_PATH).group(1)\n",
238+
" bucket, key = re.match(\"s3://(.+?)/(.+)\", S3_UPLOAD_PATH).groups()\n",
240239
" except:\n",
241240
" print(\"\\033[91m{}\\033[00m\".format(\"ERROR: Invalid s3 path (should be of the form s3://my-bucket/path/to/file)\"), file=sys.stderr)"
242241
],

examples/tensorflow/sentiment-analysis/bert.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,7 @@
946946
"\n",
947947
"else:\n",
948948
" try:\n",
949-
" bucket = re.search(\"s3://(.+?)/\", S3_UPLOAD_PATH).group(1)\n",
950-
" key = re.search(\"s3://.+?/(.+)\", S3_UPLOAD_PATH).group(1)\n",
949+
" bucket, key = re.match(\"s3://(.+?)/(.+)\", S3_UPLOAD_PATH).groups()\n",
951950
" except:\n",
952951
" print(\"\\033[91m{}\\033[00m\".format(\"ERROR: Invalid s3 path (should be of the form s3://my-bucket/path/to/file)\"), file=sys.stderr)"
953952
],

examples/tensorflow/text-generator/gpt-2.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,7 @@
292292
"\n",
293293
"else:\n",
294294
" try:\n",
295-
" bucket = re.search(\"s3://(.+?)/\", S3_UPLOAD_PATH).group(1)\n",
296-
" key = re.search(\"s3://.+?/(.+)\", S3_UPLOAD_PATH).group(1)\n",
295+
" bucket, key = re.match(\"s3://(.+?)/(.+)\", S3_UPLOAD_PATH).groups()\n",
297296
" except:\n",
298297
" print(\"\\033[91m {}\\033[00m\".format(\"ERROR: Invalid s3 path (should be of the form s3://my-bucket/path/to/file)\"), file=sys.stderr)"
299298
],

examples/xgboost/iris-classifier/xgboost.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@
191191
"\n",
192192
"else:\n",
193193
" try:\n",
194-
" bucket = re.search(\"s3://(.+?)/\", S3_UPLOAD_PATH).group(1)\n",
195-
" key = re.search(\"s3://.+?/(.+)\", S3_UPLOAD_PATH).group(1)\n",
194+
" bucket, key = re.match(\"s3://(.+?)/(.+)\", S3_UPLOAD_PATH).groups()\n",
196195
" except:\n",
197196
" print(\"\\033[91m{}\\033[00m\".format(\"ERROR: Invalid s3 path (should be of the form s3://my-bucket/path/to/file)\"), file=sys.stderr)"
198197
],

0 commit comments

Comments
 (0)