From 7640568a42493bc5a5e44bc82b1ecfa87e51c5f1 Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Tue, 26 Jan 2021 18:43:13 +0800 Subject: [Update] --- ATRI/service/dormant.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ATRI/service/dormant.py (limited to 'ATRI/service/dormant.py') diff --git a/ATRI/service/dormant.py b/ATRI/service/dormant.py new file mode 100644 index 0000000..7482d53 --- /dev/null +++ b/ATRI/service/dormant.py @@ -0,0 +1,19 @@ +from ATRI.exceptions import InvalidSetting + +from . import state + +class Dormant: + @staticmethod + def is_sleep() -> bool: + return True if state != 1 else False + + @staticmethod + def cont_wake(_type: bool) -> None: + global state + try: + if _type: + state = 0 + else: + state = 1 + except InvalidSetting: + raise InvalidSetting('Failed to modify variable!') -- cgit v1.2.3