From a1ed59d1169238c1a3323f8a5f5f31d6d534ef9f Mon Sep 17 00:00:00 2001 From: halo Date: Sat, 27 May 2023 11:53:00 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20yaml=E6=96=87=E4=BB=B6=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E4=BD=BF=E7=94=A8utf-8=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/automations/methods.py | 2 +- apps/terminal/models/applet/applet.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/assets/automations/methods.py b/apps/assets/automations/methods.py index 332923534..8db474d7b 100644 --- a/apps/assets/automations/methods.py +++ b/apps/assets/automations/methods.py @@ -39,7 +39,7 @@ def get_platform_automation_methods(path): if not path.endswith('manifest.yml'): continue - with open(path, 'r') as f: + with open(path, 'r', encoding='utf8') as f: manifest = yaml_load_with_i18n(f) check_platform_method(manifest, path) manifest['dir'] = os.path.dirname(path) diff --git a/apps/terminal/models/applet/applet.py b/apps/terminal/models/applet/applet.py index a83ead302..8293668ed 100644 --- a/apps/terminal/models/applet/applet.py +++ b/apps/terminal/models/applet/applet.py @@ -84,7 +84,7 @@ class Applet(JMSBaseModel): if not os.path.exists(path): raise ValidationError({'error': _('Applet pkg not valid, Missing file {}').format(name)}) - with open(os.path.join(d, 'manifest.yml')) as f: + with open(os.path.join(d, 'manifest.yml'), encoding='utf8') as f: manifest = yaml_load_with_i18n(f) if not manifest.get('name', ''): @@ -99,7 +99,7 @@ class Applet(JMSBaseModel): if not os.path.exists(os.path.join(d, 'platform.yml')): return try: - with open(os.path.join(d, 'platform.yml')) as f: + with open(os.path.join(d, 'platform.yml'), encoding='utf8') as f: data = yaml_load_with_i18n(f) except Exception as e: raise ValidationError({'error': _('Load platform.yml failed: {}').format(e)})