diff options
| author | Scott <[email protected]> | 2022-01-12 09:06:29 -0800 |
|---|---|---|
| committer | Scott <[email protected]> | 2022-01-12 09:06:29 -0800 |
| commit | 55a3172e37855f388b9ba0dfc91641a6c9ad1376 (patch) | |
| tree | 01285a4abb59103ec437375d1133f9d00caa1497 /smart_home | |
| parent | ffc4022c1ea2c2a5892150ff55e6c9a9ddbb8756 (diff) | |
Scale back warnings.warn and add stacklevels= where appropriate.
Diffstat (limited to 'smart_home')
| -rw-r--r-- | smart_home/lights.py | 3 | ||||
| -rw-r--r-- | smart_home/outlets.py | 3 | ||||
| -rw-r--r-- | smart_home/registry.py | 5 |
3 files changed, 1 insertions, 10 deletions
diff --git a/smart_home/lights.py b/smart_home/lights.py index 44b3634..237d4e0 100644 --- a/smart_home/lights.py +++ b/smart_home/lights.py @@ -11,7 +11,6 @@ import re import subprocess import sys from typing import Any, Dict, List, Optional, Tuple -import warnings from overrides import overrides import tinytuya as tt @@ -49,7 +48,6 @@ def tplink_light_command(command: str) -> bool: if signal != 0: msg = f'{command} died with signal {signal}' logger.warning(msg) - warnings.warn(msg) logging_utils.hlog(msg) return False else: @@ -57,7 +55,6 @@ def tplink_light_command(command: str) -> bool: if exit_value != 0: msg = f'{command} failed, exited {exit_value}' logger.warning(msg) - warnings.warn(msg) logging_utils.hlog(msg) return False logger.debug(f'{command} succeeded.') diff --git a/smart_home/outlets.py b/smart_home/outlets.py index 6cc8d57..c079cfd 100644 --- a/smart_home/outlets.py +++ b/smart_home/outlets.py @@ -13,7 +13,6 @@ import re import subprocess import sys from typing import Any, Dict, List, Optional -import warnings from meross_iot.http_api import MerossHttpClient from meross_iot.manager import MerossManager @@ -51,7 +50,6 @@ def tplink_outlet_command(command: str) -> bool: if signal != 0: msg = f'{command} died with signal {signal}' logger.warning(msg) - warnings.warn(msg) logging_utils.hlog(msg) return False else: @@ -59,7 +57,6 @@ def tplink_outlet_command(command: str) -> bool: if exit_value != 0: msg = f'{command} failed, exited {exit_value}' logger.warning(msg) - warnings.warn(msg) logging_utils.hlog(msg) return False logger.debug(f'{command} succeeded.') diff --git a/smart_home/registry.py b/smart_home/registry.py index 20fb3f4..75fe052 100644 --- a/smart_home/registry.py +++ b/smart_home/registry.py @@ -3,7 +3,6 @@ import logging import re from typing import List, Optional, Set -import warnings import argparse_utils import config @@ -64,9 +63,8 @@ class SmartHomeRegistry(object): try: (mac, name, keywords) = line.split(",") except ValueError: - msg = f'SH-CONFIG> {line} is malformed?!' + msg = f'SH-CONFIG> "{line}" is malformed?! Skipping it.' logger.warning(msg) - warnings.warn(msg) continue mac = mac.strip() name = name.strip() @@ -190,7 +188,6 @@ class SmartHomeRegistry(object): return device.Device(name, mac, kws) msg = f'{mac} is not a known smart home device, returning None' logger.warning(msg) - warnings.warn(msg) return None def query(self, query: str) -> List[device.Device]: |
