Scale back warnings.warn and add stacklevels= where appropriate.
[python_utils.git] / smart_home / registry.py
index 20fb3f43807bf0dbbd45fa7f5c36ed8f4d1bc917..75fe05256cc9f51cdc06a497fe9304917a510218 100644 (file)
@@ -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]: