aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2019-04-02 02:53:21 +0000
committerMike Crute <mike@crute.us>2019-04-02 03:24:37 +0000
commitc53035eaeb98d9f07978f249308599d722cae28c (patch)
tree28433c8f56d2610e15b7a78fe73b2fe2208d478a
parent82988c77fbbc893e5659e3085bbc32f0580c74d1 (diff)
downloadpydora-c53035eaeb98d9f07978f249308599d722cae28c.tar.bz2
pydora-c53035eaeb98d9f07978f249308599d722cae28c.tar.xz
pydora-c53035eaeb98d9f07978f249308599d722cae28c.zip
Remove deprecated constructors
-rw-r--r--pandora/client.py15
-rw-r--r--pandora/util.py35
-rw-r--r--tests/test_pandora/test_util.py22
3 files changed, 0 insertions, 72 deletions
diff --git a/pandora/client.py b/pandora/client.py
index df09144..658fb0d 100644
--- a/pandora/client.py
+++ b/pandora/client.py
@@ -14,7 +14,6 @@ For simplicity use a client builder from pandora.clientbuilder to create an
14instance of a client. 14instance of a client.
15""" 15"""
16from . import errors 16from . import errors
17from .util import deprecated
18 17
19 18
20class BaseAPIClient(object): 19class BaseAPIClient(object):
@@ -40,20 +39,6 @@ class BaseAPIClient(object):
40 self.username = None 39 self.username = None
41 self.password = None 40 self.password = None
42 41
43 @classmethod
44 @deprecated("1.3", "2.0",
45 "Replaced by clientbuilder.SettingsDictBuilder")
46 def from_settings_dict(cls, settings): # pragma: no cover
47 from .clientbuilder import SettingsDictBuilder
48 return SettingsDictBuilder(settings).build()
49
50 @classmethod
51 @deprecated("1.3", "2.0",
52 "Replaced by clientbuilder.PydoraConfigFileBuilder")
53 def from_config_file(cls, path, authenticate=True): # pragma: no cover
54 from .clientbuilder import PydoraConfigFileBuilder
55 return PydoraConfigFileBuilder(path, authenticate).build()
56
57 def _partner_login(self): 42 def _partner_login(self):
58 partner = self.transport("auth.partnerLogin", 43 partner = self.transport("auth.partnerLogin",
59 username=self.partner_user, 44 username=self.partner_user,
diff --git a/pandora/util.py b/pandora/util.py
deleted file mode 100644
index e0fc7fd..0000000
--- a/pandora/util.py
+++ /dev/null
@@ -1,35 +0,0 @@
1"""
2Utility Functions
3
4Functions that don't have a home anywhere else.
5"""
6
7import warnings
8from functools import wraps
9
10
11def warn_deprecated(in_version, remove_version, what, message):
12 """Warn that something is deprecated
13 """
14 msg = ("{} is deprecated as of version {}"
15 " and will be removed in version {}. {}")
16
17 warnings.warn(
18 msg.format(what, in_version, remove_version, message),
19 DeprecationWarning)
20
21
22def deprecated(in_version, remove_version, message):
23 """Deprecated function decorator
24
25 Decorator to warn that a function is deprecated and what version it will be
26 removed in.
27 """
28 def wrapper(wrapped):
29 @wraps(wrapped)
30 def inner_wrapper(self, *args, **kwargs):
31 warn_deprecated(
32 in_version, remove_version, wrapped.__name__, message)
33 return wrapped(self, *args, **kwargs)
34 return inner_wrapper
35 return wrapper
diff --git a/tests/test_pandora/test_util.py b/tests/test_pandora/test_util.py
deleted file mode 100644
index d8c3876..0000000
--- a/tests/test_pandora/test_util.py
+++ /dev/null
@@ -1,22 +0,0 @@
1import warnings
2from unittest import TestCase
3from unittest.mock import patch
4
5from pandora import util
6
7
8class TestDeprecatedWarning(TestCase):
9
10 def test_warning(self):
11 class Bar(object):
12
13 @util.deprecated("1.0", "2.0", "Don't use this")
14 def foo(self):
15 pass
16
17 with patch.object(warnings, "warn") as wmod:
18 Bar().foo()
19
20 wmod.assert_called_with(
21 ("foo is deprecated as of version 1.0 and will be removed in "
22 "version 2.0. Don't use this"), DeprecationWarning)