mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
deprecate features and identify, use state_information in __repr__ instead of identify
This commit is contained in:
parent
31b5b89d35
commit
a9c1d08d66
@ -16,6 +16,7 @@ http://www.apache.org/licenses/LICENSE-2.0
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
import warnings
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from .types import SmartDeviceException
|
from .types import SmartDeviceException
|
||||||
@ -86,6 +87,13 @@ class SmartDevice(object):
|
|||||||
:return: list of features
|
:return: list of features
|
||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
|
warnings.simplefilter('always', DeprecationWarning)
|
||||||
|
warnings.warn(
|
||||||
|
"features works only on plugs and its use is discouraged, "
|
||||||
|
"and it will likely to be removed at some point",
|
||||||
|
DeprecationWarning
|
||||||
|
)
|
||||||
|
warnings.simplefilter('default', DeprecationWarning)
|
||||||
if "feature" not in self.sys_info:
|
if "feature" not in self.sys_info:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -135,6 +143,12 @@ class SmartDevice(object):
|
|||||||
:return: (alias, model, list of supported features)
|
:return: (alias, model, list of supported features)
|
||||||
:rtype: tuple
|
:rtype: tuple
|
||||||
"""
|
"""
|
||||||
|
warnings.simplefilter('always', DeprecationWarning)
|
||||||
|
warnings.warn(
|
||||||
|
"please use alias and model properties directly instead of idenfity()",
|
||||||
|
DeprecationWarning
|
||||||
|
)
|
||||||
|
warnings.simplefilter('default', DeprecationWarning)
|
||||||
|
|
||||||
info = self.sys_info
|
info = self.sys_info
|
||||||
|
|
||||||
@ -483,5 +497,8 @@ class SmartDevice(object):
|
|||||||
raise NotImplementedError("Device subclass needs to implement this.")
|
raise NotImplementedError("Device subclass needs to implement this.")
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s at %s: %s>" % (self.__class__.__name__,
|
return "<%s at %s (%s), is_on: %s - dev specific: %s>" % (self.__class__.__name__,
|
||||||
self.ip_address, self.identify())
|
self.ip_address,
|
||||||
|
self.alias,
|
||||||
|
self.is_on,
|
||||||
|
self.state_information)
|
||||||
|
Loading…
Reference in New Issue
Block a user