From 7607cc3e32a8b812f7e5ea01dd342bff698af03c Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 11 Jan 2025 14:19:36 +0800 Subject: [PATCH] fix lint --- custom_components/xiaomi_home/miot/web_pages.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/xiaomi_home/miot/web_pages.py b/custom_components/xiaomi_home/miot/web_pages.py index ab11cf4..e28ee38 100644 --- a/custom_components/xiaomi_home/miot/web_pages.py +++ b/custom_components/xiaomi_home/miot/web_pages.py @@ -54,17 +54,17 @@ _template = "" def _load_page_template(): path = os.path.join( os.path.dirname(os.path.abspath(__file__)), - 'resource/oauth_redirect_page.html') - global _template - with open(path, "r") as f: + "resource/oauth_redirect_page.html") + with open(path, "r", encoding='utf-8') as f: + global _template _template = f.read() async def oauth_redirect_page(lang: str, status: str) -> str: """Return oauth redirect page.""" - global template + global _template if _template == "": await asyncio.get_event_loop().run_in_executor( None, _load_page_template) - web_page = _template.replace('LANG_PLACEHOLDER', lang) - web_page = web_page.replace('STATUS_PLACEHOLDER', status) + web_page = _template.replace("LANG_PLACEHOLDER", lang) + web_page = web_page.replace("STATUS_PLACEHOLDER", status) return web_page