From 92614062ccedc9c1af53ec98363ec8692ed1a0e7 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Fri, 7 Nov 2025 23:10:57 +0800 Subject: [PATCH] chore: update --- pkg/config/impls/json.py | 6 ++++-- pkg/config/impls/yaml.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/config/impls/json.py b/pkg/config/impls/json.py index 31c1ae5d..59ab6dee 100644 --- a/pkg/config/impls/json.py +++ b/pkg/config/impls/json.py @@ -25,8 +25,10 @@ class JSONConfigFile(file_model.ConfigFile): if self.template_resource_name is None: return None - with resources.path('langbot.templates', self.template_resource_name) as path: - return path.open('r', encoding='utf-8').read() + with ( + resources.files('langbot.templates').joinpath(self.template_resource_name).open('r', encoding='utf-8') as f + ): + return f.read() async def create(self): if await self.get_template_file_str() is not None: diff --git a/pkg/config/impls/yaml.py b/pkg/config/impls/yaml.py index bf013629..56e3fc8d 100644 --- a/pkg/config/impls/yaml.py +++ b/pkg/config/impls/yaml.py @@ -25,8 +25,10 @@ class YAMLConfigFile(file_model.ConfigFile): if self.template_resource_name is None: return None - with resources.path('langbot.templates', self.template_resource_name) as path: - return path.open('r', encoding='utf-8').read() + with ( + resources.files('langbot.templates').joinpath(self.template_resource_name).open('r', encoding='utf-8') as f + ): + return f.read() async def create(self): if await self.get_template_file_str() is not None: