Skip to content

Commit 3bf7ea8

Browse files
committed
fix: 解决 f string 无法在 python2 使用的问题
1 parent a546090 commit 3bf7ea8

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

bgesdk/management/commands/model.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,10 @@ def _config_model(self, config=None):
808808
ratio = (memory_size / 1024) / cpu
809809
if ratio < 1 or ratio > 4:
810810
ratio = '%.2f' % ratio
811-
output(f'[red]vCPU 大小(核)与内存大小(GB)的比值必须在 1:1 到 1:4 之间,'
812-
f'当前为 {ratio},请重新选择[/red]')
811+
output(
812+
'[red]vCPU 大小(核)与内存大小(GB)的比值必须在 1:1 到 1:4 之间,'
813+
'当前为 {},请重新选择[/red]'.format(ratio)
814+
)
813815
qprompt.pause()
814816
continue
815817
break
@@ -1003,21 +1005,23 @@ def deploy_model(self, args):
10031005
try:
10041006
self._deploy_model_code(api, model_id, object_name, **params)
10051007
except Exception as e:
1006-
output(f'[red] 上传部署模型代码到模型 {model_id} 失败...[/red]')
1008+
output('[red] 上传部署模型代码到模型 {} 失败...[/red]'.format(model_id))
10071009
output_syntax(str(e))
10081010
if not with_mirrors or not mirror_models:
10091011
return
10101012
if not Confirm.ask(
1011-
f'是否上传部署模型源码到镜像模型 {mirror_models} 中?'):
1013+
'是否上传部署模型源码到镜像模型 {} 中?'.format(mirror_models)):
10121014
output('[yellow]已取消...[/yellow]')
10131015
return
10141016
output('\n\n')
10151017
for idx, model_id in enumerate(mirror_models.split(','), start=1):
1016-
output(f'[{idx}] 开始上传模型源码到镜像模型 {model_id}...')
1018+
output('[{}] 开始上传模型源码到镜像模型 {}...'.format(idx, model_id))
10171019
try:
10181020
self._deploy_model_code(api, model_id, object_name, **params)
10191021
except Exception as e:
1020-
output(f'[red] 上传部署模型代码到模型 {model_id} 失败...[/red]')
1022+
output(
1023+
'[red] 上传部署模型代码到模型 {} 失败...[/red]'.format(model_id)
1024+
)
10211025
output_syntax(str(e))
10221026
output('\n\n')
10231027

@@ -1170,20 +1174,20 @@ def publish_model(self, args):
11701174
try:
11711175
self._publish_model(api, model_id, message)
11721176
except Exception as e:
1173-
output(f'[red] 发布模型 {model_id} 失败...[/red]')
1177+
output('[red] 发布模型 {} 失败...[/red]'.format(model_id))
11741178
output_syntax(str(e))
11751179
if not with_mirrors or not mirror_models:
11761180
return
1177-
if not Confirm.ask(f'是否同时发布镜像模型 {mirror_models} ?'):
1181+
if not Confirm.ask('是否同时发布镜像模型 {} ?'.format(mirror_models)):
11781182
output('[yellow]已取消...[/yellow]')
11791183
return
11801184
output('\n\n')
11811185
for idx, model_id in enumerate(mirror_models.split(','), start=1):
1182-
output(f'[{idx}] 开始发布镜像模型 {model_id}...')
1186+
output('[{}] 开始发布镜像模型 {}...'.format(idx, model_id))
11831187
try:
11841188
self._publish_model(api, model_id, message)
11851189
except Exception as e:
1186-
output(f'[red] 发布模型 {model_id} 失败...[/red]')
1190+
output('[red] 发布模型 {} 失败...[/red]'.format(model_id))
11871191
output_syntax(str(e))
11881192
output('\n\n')
11891193

@@ -1564,7 +1568,7 @@ def run_model(self, args):
15641568
sort_keys=True,
15651569
ensure_ascii=False,
15661570
))
1567-
output(f'[green]模型返回值已输出至:{output_path}[/green]')
1571+
output('[green]模型返回值已输出至:{}[/green]'.format(output_path))
15681572

15691573
def get_model_config_path(self, home=None):
15701574
if home is None:

0 commit comments

Comments
 (0)