@@ -89,12 +89,12 @@ def add_dlc_framework_version(
89
89
existing_content [scope ]["processors" ].append (processor )
90
90
existing_content [scope ]["version_aliases" ][short_version ] = full_version
91
91
92
- add_version = {
92
+ new_version = {
93
93
"registries" : registries ,
94
94
"repository" : repository ,
95
95
"py_versions" : py_versions ,
96
96
}
97
- existing_content [scope ]["versions" ][full_version ] = add_version
97
+ existing_content [scope ]["versions" ][full_version ] = new_version
98
98
99
99
100
100
def add_algo_version (
@@ -127,14 +127,14 @@ def add_algo_version(
127
127
if scope not in existing_content ["scope" ]:
128
128
existing_content ["scope" ].append (scope )
129
129
130
- add_version = {
130
+ new_version = {
131
131
"py_versions" : py_versions ,
132
132
"registries" : registries ,
133
133
"repository" : repository ,
134
134
}
135
135
if tag_prefix :
136
- add_version ["tag_prefix" ] = tag_prefix
137
- existing_content ["versions" ][full_version ] = add_version
136
+ new_version ["tag_prefix" ] = tag_prefix
137
+ existing_content ["versions" ][full_version ] = new_version
138
138
139
139
140
140
def add_region (existing_content , region , account ):
@@ -155,7 +155,7 @@ def add_region(existing_content, region, account):
155
155
existing_content ["versions" ][version ]["registries" ][region ] = account
156
156
157
157
158
- def update_json (
158
+ def add_version (
159
159
existing_content , short_version , full_version , scope , processors , py_versions , tag_prefix ,
160
160
):
161
161
"""Read framework image uri information from json file to a dictionary, update it with new
@@ -222,28 +222,25 @@ def main():
222
222
parser .add_argument ("--account" , help = "Registry account of new region" )
223
223
224
224
args = parser .parse_args ()
225
- framework = args .framework
226
- short_version = args .short_version
227
- full_version = args .full_version
228
- processors = args .processors
229
- py_versions = args .py_versions
230
- scope = args .scope
231
- tag_prefix = args .tag_prefix
232
- region = args .region
233
- account = args .account
234
-
235
- content = config_for_framework (framework )
236
-
237
- if region or account :
238
- if region and not account or account and not region :
225
+
226
+ content = config_for_framework (args .framework )
227
+
228
+ if args .region or args .account :
229
+ if args .region and not args .account or args .account and not args .region :
239
230
raise ValueError ("--region and --account must be used together to expand region." )
240
- add_region (content , region , account )
231
+ add_region (content , args . region , args . account )
241
232
else :
242
- update_json (
243
- content , short_version , full_version , scope , processors , py_versions , tag_prefix ,
233
+ add_version (
234
+ content ,
235
+ args .short_version ,
236
+ args .full_version ,
237
+ args .scope ,
238
+ args .processors ,
239
+ args .py_versions ,
240
+ args .tag_prefix ,
244
241
)
245
242
246
- file = os .path .join (IMAGE_URI_CONFIG_DIR , "{}.json" .format (framework ))
243
+ file = os .path .join (IMAGE_URI_CONFIG_DIR , "{}.json" .format (args . framework ))
247
244
_write_dict_to_json (file , content )
248
245
249
246
0 commit comments