mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-12-12 01:00:31 +08:00
fix: pylint 4.0.0 (#1455)
Some checks failed
Tests / check-rule-format (push) Has been cancelled
Validate / validate-hassfest (push) Has been cancelled
Validate / validate-hacs (push) Has been cancelled
Validate / validate-lint (push) Has been cancelled
Validate / validate-setup (push) Has been cancelled
Some checks failed
Tests / check-rule-format (push) Has been cancelled
Validate / validate-hassfest (push) Has been cancelled
Validate / validate-hacs (push) Has been cancelled
Validate / validate-lint (push) Has been cancelled
Validate / validate-setup (push) Has been cancelled
This commit is contained in:
parent
a11c3e2fda
commit
fbddaf80a7
@ -49,7 +49,7 @@ MIoT redirect web pages.
|
||||
import os
|
||||
import asyncio
|
||||
|
||||
_template = ''
|
||||
web_template = ''
|
||||
|
||||
|
||||
def _load_page_template():
|
||||
@ -57,18 +57,18 @@ def _load_page_template():
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
'resource/oauth_redirect_page.html')
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
global _template
|
||||
_template = f.read()
|
||||
global web_template
|
||||
web_template = f.read()
|
||||
|
||||
|
||||
async def oauth_redirect_page(
|
||||
title: str, content: str, button: str, success: bool
|
||||
) -> str:
|
||||
"""Return oauth redirect page."""
|
||||
if _template == '':
|
||||
if web_template == '':
|
||||
await asyncio.get_running_loop().run_in_executor(
|
||||
None, _load_page_template)
|
||||
web_page = _template.replace('TITLE_PLACEHOLDER', title)
|
||||
web_page = web_template.replace('TITLE_PLACEHOLDER', title)
|
||||
web_page = web_page.replace('CONTENT_PLACEHOLDER', content)
|
||||
web_page = web_page.replace('BUTTON_PLACEHOLDER', button)
|
||||
web_page = web_page.replace(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user